Note
This module is part of the community.general collection (version 10.7.3).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.sensu_handler.
version 13.0.0
Sensu Core and Sensu Enterprise products have been End of Life since 2019/20.
Use Sensu Go and its accompanying collection sensu.sensu_go.
Parameter | Comments |
|---|---|
command string | |
filter string | The Sensu event filter (name) to use when filtering events for the handler. |
filters list / elements=string | An array of Sensu event filters (names) to use when filtering events for the handler. Each array item must be a string. |
handle_flapping boolean | If events in the flapping state should be handled. Choices:
|
handle_silenced boolean | If events matching one or more silence entries should be handled. Choices:
|
handlers list / elements=string | |
mutator string | The Sensu event mutator (name) to use to mutate event data for the handler. |
name string / required | A unique name for the handler. The name cannot contain special characters or spaces. |
pipe dictionary | The pipe definition scope, used to configure the Sensu transport pipe. NOTE: the |
severities list / elements=string | An array of check result severities the handler will handle. NOTE: event resolution bypasses this filtering. Example: [ ‘warning’, ‘critical’, ‘unknown’ ]. |
socket dictionary | |
state string | Whether the handler should be present or not. Choices:
|
timeout integer | The handler execution duration timeout in seconds (hard stop). Only used by pipe and tcp handler types. Default: |
type string | The handler type. Choices:
|
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
# Configure a handler that sends event data as STDIN (pipe)
- name: Configure IRC Sensu handler
community.general.sensu_handler:
name: "irc_handler"
type: "pipe"
command: "/usr/local/bin/notify-irc.sh"
severities:
- "ok"
- "critical"
- "warning"
- "unknown"
timeout: 15
notify:
- Restart sensu-client
- Restart sensu-server
# Delete a handler
- name: Delete IRC Sensu handler
community.general.sensu_handler:
name: "irc_handler"
state: "absent"
# Example of a TCP handler
- name: Configure TCP Sensu handler
community.general.sensu_handler:
name: "tcp_handler"
type: "tcp"
timeout: 30
socket:
host: "10.0.1.99"
port: 4444
register: handler
notify:
- Restart sensu-client
- Restart sensu-server
- name: Secure Sensu handler configuration file
ansible.builtin.file:
path: "{{ handler['file'] }}"
owner: "sensu"
group: "sensu"
mode: "0600"
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
config dictionary | Effective handler configuration, when state is present. Returned: success Sample: |
file string | Path to the handler configuration file. Returned: success Sample: |
name string | Name of the handler. Returned: success Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/sensu_handler_module.html