sensu.sensu_go.check (0.7.6) — module

Manages Sensu checks

| "added in version" 0.1.0 of sensu.sensu_go"

Authors: Paul Arthur (@flowerysong), Aljaz Kosir (@aljazkosir), Miha Plesko (@miha-plesko), Tadej Borovsak (@tadeboro)

preview | supported by community

Install collection

Install with ansible-galaxy collection install sensu.sensu_go:==0.7.6


Add to requirements.yml

  collections:
    - name: sensu.sensu_go
      version: 0.7.6

Description

For more information, refer to the Sensu documentation at U(https://docs.sensu.io/sensu-go/latest/reference/checks/)

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Check executing command every 30 seconds
  check:
    name: check
    command: check-cpu.sh -w 75 -c 90
    subscriptions:
      - checks
    interval: 30
    publish: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Check executing command with cron scheduler
  check:
    name: check
    command: check-cpu.sh -w 75 -c 90
    subscriptions:
      - systems
    handlers:
      - slack
    cron: "* * * * *"
    publish: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ad-hoc scheduling
  check:
    name: check
    command: check-cpu.sh -w 75 -c 90
    subscriptions:
      - systems
    handlers:
      - slack
    interval: 60
    publish: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Report events under proxy entity name instead of agent entity
  check:
    name: check
    command: http_check.sh https://sensu.io
    subscriptions:
      - proxy
    handlers:
      - slack
    interval: 60
    proxy_entity_name: sensu-site
    round_robin: yes
    publish: yes

Inputs

    
ttl:
    description:
    - Amount of time after which a check result is considered stale.
    type: int

auth:
    description:
    - Authentication parameters. Can define each of them with ENV as well.
    suboptions:
      namespace:
        default: default
        description:
        - RBAC namespace to operate in. If this is not set the value of the SENSU_NAMESPACE
          environment variable will be checked.
        type: str
      password:
        default: P@ssw0rd!
        description:
        - The Sensu user's password. If this is not set the value of the SENSU_PASSWORD
          environment variable will be checked.
        type: str
      url:
        default: http://localhost:8080
        description:
        - Location of the Sensu backend API. If this is not set the value of the SENSU_URL
          environment variable will be checked.
        type: str
      user:
        default: admin
        description:
        - The username to use for connecting to the Sensu API. If this is not set the
          value of the SENSU_USER environment variable will be checked.
        type: str
    type: dict

cron:
    description:
    - Schedule check requests using crontab syntax
    type: str

name:
    description:
    - The Sensu object's name.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Target state of the Sensu object.
    type: str

stdin:
    description:
    - Enables writing of serialized JSON data to the check command's stdin.
    - Only usable with checks written specifically for Sensu Go.
    type: bool

labels:
    description:
    - Custom metadata fields that can be accessed within Sensu, as key/value pairs.
    type: dict

command:
    description:
    - Check command to run.
    required: true
    type: str

publish:
    description:
    - Enables or disables scheduled publication of check requests.
    type: bool

timeout:
    description:
    - Check execution timeout
    type: int

env_vars:
    description:
    - A mapping of environment variable names and values to use with command execution.
    type: dict

handlers:
    description:
    - List of handlers which receive check results.
    type: list

interval:
    description:
    - Check request interval
    type: int

annotations:
    description:
    - Custom metadata fields with fewer restrictions, as key/value pairs.
    - These are preserved by Sensu but not accessible as tokens or identifiers, and are
      mainly intended for use with external tools.
    type: dict

check_hooks:
    description:
    - A mapping of response codes to hooks which will be run by the agent when that code
      is returned.
    type: dict

round_robin:
    description:
    - An array of environment variables to use with command execution.
    type: bool

subscriptions:
    description:
    - List of subscriptions which receive check requests.
    type: list

proxy_requests:
    description: Allows you to assign the check to run for multiple entities according
      to their entity_attributes
    suboptions:
      entity_attributes:
        description:
        - List of attribute checks for determining which proxy entities this check should
          be scheduled against.
        type: list
      splay:
        description:
        - Enables or disables splaying of check request scheduling.
        type: bool
      splay_coverage:
        description:
        - Percentage of the C(interval) over which to splay checks.
        type: int
    type: dict

runtime_assets:
    description:
    - List of runtime assets required to run the check
    type: list

proxy_entity_name:
    description:
    - Entity name to associate this check with instead of the agent it ran on.
    type: str

low_flap_threshold:
    description:
    - Low flap threshold.
    type: int

high_flap_threshold:
    description:
    - High flap threshold.
    type: int

output_metric_format:
    choices:
    - graphite_plaintext
    - influxdb_line
    - nagios_perfdata
    - opentsdb_line
    description:
    - Enable parsing of metrics in the specified format from this check's output.
    type: str

output_metric_handlers:
    description:
    - List of handlers which receive check results. I'm not sure why this exists.
    type: list

Outputs

object:
  description: object representing Sensu check
  returned: success
  type: dict