sensu_handler - Manages Sensu handler configuration
New in version 2.4.
Synopsis
- Manages Sensu handler configuration
 - For more information, refer to the Sensu documentation: https://sensuapp.org/docs/latest/reference/handlers.html
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| command |  Default: None   |    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").   |  
| filter |  Default: None   |    The Sensu event filter (name) to use when filtering events for the handler.   |  
| filters |  Default: None   |    An array of Sensu event filters (names) to use when filtering events for the handler.  Each array item must be a string.   |  
| handle_flapping |  Default: no   |    If events in the flapping state should be handled.   |  
| handle_silenced |  Default: no   |    If events matching one or more silence entries should be handled.   |  
|  handlers  required   |   Default: None   |    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").   |  
| mutator |  Default: None   |    The Sensu event mutator (name) to use to mutate event data for the handler.   |  
|  name  required   |   Default: None   |    A unique name for the handler. The name cannot contain special characters or spaces.   |  
| pipe |  Default: None   |    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").   |  
| severities |  
 None   |    An array of check result severities the handler will handle.  NOTE: event resolution bypasses this filtering.   |  
| socket |  Default: None   |    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").   |  
| state |  
  |    Whether the handler should be present or not   |  
| timeout |  Default: 10   |    The handler execution duration timeout in seconds (hard stop).  Only used by pipe and tcp handler types.   |  
|  type  required   |   
 None   |    The handler type   |  
Notes
Note
- Check mode is supported
 
Examples
# 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"
   Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
|  config  dict   |  success |   Effective handler configuration, when state is present  Sample:  {'type': 'pipe', 'command': '/usr/local/bin/notify-irc.sh', 'name': 'irc'}   |  
|  file  string   |  success |   Path to the handler configuration file  Sample:  /etc/sensu/conf.d/handlers/irc.json   |  
|  name  string   |  success |   Name of the handler  Sample:  irc   |  
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Author
- David Moreau Simard (@dmsimard)
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
    © 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
    https://docs.ansible.com/ansible/2.5/modules/sensu_handler_module.html