community / community.general / 0.1.4 / module / sensu_handler Manages Sensu handler configuration Authors: David Moreau Simard (@dmsimard)community.general.sensu_handler (0.1.4) — module
Install with ansible-galaxy collection install community.general:==0.1.4
collections: - name: community.general version: 0.1.4
Manages Sensu handler configuration
For more information, refer to the Sensu documentation: U(https://sensuapp.org/docs/latest/reference/handlers.html)
# Configure a handler that sends event data as STDIN (pipe) - name: Configure IRC Sensu handler 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 sensu_handler: name: "irc_handler" state: "absent"
# Example of a TCP handler - name: Configure TCP Sensu handler 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 file: path: "{{ handler['file'] }}" owner: "sensu" group: "sensu" mode: "0600"
name: description: - A unique name for the handler. The name cannot contain special characters or spaces. required: true pipe: description: - The pipe definition scope, used to configure the Sensu transport pipe. - 'NOTE: the pipe attribute is only required for Transport handlers (i.e. handlers configured with "type": "transport").' type: choices: - pipe - tcp - udp - transport - set description: - The handler type required: true state: choices: - present - absent default: present description: - Whether the handler should be present or not filter: description: - The Sensu event filter (name) to use when filtering events for the handler. socket: description: - The socket definition scope, used to configure the TCP/UDP handler socket. - 'NOTE: the socket attribute is only required for TCP/UDP handlers (i.e. handlers configured with "type": "tcp" or "type": "udp").' command: description: - The handler command to be executed. - The event data is passed to the process via STDIN. - 'NOTE: the command attribute is only required for Pipe handlers (i.e. handlers configured with "type": "pipe").' filters: description: - An array of Sensu event filters (names) to use when filtering events for the handler. - Each array item must be a string. mutator: description: - The Sensu event mutator (name) to use to mutate event data for the handler. timeout: default: 10 description: - The handler execution duration timeout in seconds (hard stop). - Only used by pipe and tcp handler types. handlers: description: - An array of Sensu event handlers (names) to use for events using the handler set. - Each array item must be a string. - 'NOTE: the handlers attribute is only required for handler sets (i.e. handlers configured with "type": "set").' severities: choices: - warning - critical - unknown description: - An array of check result severities the handler will handle. - 'NOTE: event resolution bypasses this filtering.' handle_flapping: default: 'no' description: - If events in the flapping state should be handled. type: bool handle_silenced: default: 'no' description: - If events matching one or more silence entries should be handled. type: bool
config: description: Effective handler configuration, when state is present returned: success sample: command: /usr/local/bin/notify-irc.sh name: irc type: pipe type: dict file: description: Path to the handler configuration file returned: success sample: /etc/sensu/conf.d/handlers/irc.json type: str name: description: Name of the handler returned: success sample: irc type: str