community / community.general / 1.3.11 / module / sensu_check Manage Sensu checks Authors: Anders Ingemann (@andsens)community.general.sensu_check (1.3.11) — module
Install with ansible-galaxy collection install community.general:==1.3.11
collections: - name: community.general version: 1.3.11
Manage the checks that should be run on a machine by I(Sensu).
Most options do not have a default and will not be added to the check definition unless specified.
All defaults except I(path), I(state), I(backup) and I(metric) are not managed by this module,
they are simply specified for your convenience.
# Fetch metrics about the CPU load every 60 seconds, # the sensu server has a handler called 'relay' which forwards stats to graphite - name: Get cpu metrics community.general.sensu_check: name: cpu_load command: /etc/sensu/plugins/system/cpu-mpstat-metrics.rb metric: yes handlers: relay subscribers: common interval: 60
# Check whether nginx is running - name: Check nginx process community.general.sensu_check: name: nginx_running command: /etc/sensu/plugins/processes/check-procs.rb -f /var/run/nginx.pid handlers: default subscribers: nginx interval: 60
# Stop monitoring the disk capacity. # Note that the check will still show up in the sensu dashboard, # to remove it completely you need to issue a DELETE request to the sensu api. - name: Check disk community.general.sensu_check: name: check_disk_capacity state: absent
ttl: description: - Time to live in seconds until the check is considered stale type: int name: description: - The name of the check - This is the key that is used to determine whether a check exists required: true type: str path: default: /etc/sensu/conf.d/checks.json description: - Path to the json file of the check to be added/removed. - Will be created if it does not exist (unless I(state=absent)). - The parent folders need to exist when I(state=present), otherwise an error will be thrown type: str state: choices: - present - absent default: present description: - Whether the check should be present or not type: str backup: default: 'no' description: - Create a backup file (if yes), including the timestamp information so - you can get the original file back if you somehow clobbered it incorrectly. type: bool custom: default: {} description: - A hash/dictionary of custom parameters for mixing to the configuration. - You can't rewrite others module parameters using this type: dict handle: description: - Whether the check should be handled or not - Default is C(false). type: bool metric: default: 'no' description: - Whether the check is a metric type: bool source: description: - The check source, used to create a JIT Sensu client for an external resource (e.g. a network switch). type: str command: description: - Path to the sensu check to run (not required when I(state=absent)) type: str publish: description: - Whether the check should be scheduled at all. - You can still issue it via the sensu api - Default is C(false). type: bool refresh: description: - Number of seconds handlers should wait before taking second action type: int timeout: description: - Timeout for the check - If not specified, it defaults to 10. type: int handlers: default: [] description: - List of handlers to notify when the check fails elements: str type: list interval: description: - Check interval in seconds type: int aggregate: description: - Classifies the check as an aggregate check, - making it available via the aggregate API - Default is C(false). type: bool standalone: description: - Whether the check should be scheduled by the sensu client or server - This option obviates the need for specifying the I(subscribers) option - Default is C(false). type: bool subdue_end: description: - When to enable handling of check failures type: str occurrences: description: - Number of event occurrences before the handler should take action - If not specified, defaults to 1. type: int subscribers: default: [] description: - List of subscribers/channels this check should run for - See sensu_subscribers to subscribe a machine to a channel elements: str type: list dependencies: default: [] description: - Other checks this check depends on, if dependencies fail handling of this check will be disabled elements: str type: list subdue_begin: description: - When to disable handling of check failures type: str low_flap_threshold: description: - The low threshold for flap detection type: int high_flap_threshold: description: - The high threshold for flap detection type: int