sensu_check - Manage Sensu checks
New in version 2.0.
Synopsis
- Manage the checks that should be run on a machine by Sensu.
- Most options do not have a default and will not be added to the check definition unless specified.
- All defaults except path, state, backup and metric are not managed by this module,
- they are simply specified for your convenience.
Options
parameter | required | default | choices | comments |
---|---|---|---|---|
aggregate | no |
| Classifies the check as an aggregate check, making it available via the aggregate API | |
backup | no |
| Create a backup file (if yes), including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. | |
command | yes | Path to the sensu check to run (not required when state=absent) | ||
custom (added in 2.1)
| no | A hash/dictionary of custom parameters for mixing to the configuration. You can't rewrite others module parameters using this | ||
dependencies | no | Other checks this check depends on, if dependencies fail, handling of this check will be disabled | ||
handle | no | True |
| Whether the check should be handled or not |
handlers | no | List of handlers to notify when the check fails | ||
high_flap_threshold | no | The high threshold for flap detection | ||
interval | no | Check interval in seconds | ||
low_flap_threshold | no | The low threshold for flap detection | ||
metric | no |
| Whether the check is a metric | |
name | yes | The name of the check This is the key that is used to determine whether a check exists | ||
occurrences | no | 1 | Number of event occurrences before the handler should take action | |
path | no | /etc/sensu/conf.d/checks.json | Path to the json file of the check to be added/removed. Will be created if it does not exist (unless state=absent). The parent folders need to exist when state=present, otherwise an error will be thrown | |
publish | no | True |
| Whether the check should be scheduled at all. You can still issue it via the sensu api |
refresh | no | Number of seconds handlers should wait before taking second action | ||
source (added in 2.1)
| no | The check source, used to create a JIT Sensu client for an external resource (e.g. a network switch). | ||
standalone | no |
| Whether the check should be scheduled by the sensu client or server This option obviates the need for specifying the subscribers option | |
state | no | present |
| Whether the check should be present or not |
subdue_begin | no | When to disable handling of check failures | ||
subdue_end | no | When to enable handling of check failures | ||
subscribers | no | List of subscribers/channels this check should run for See sensu_subscribers to subscribe a machine to a channel | ||
timeout | no | 10 | Timeout for the check | |
ttl (added in 2.4)
| no | Time to live in seconds until the check is considered stale |
Examples
# 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 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 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 sensu_check: name: check_disk_capacity state: absent
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/sensu_check_module.html