Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
etc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Nagios integration

To integrate Nagios with st2, we will need to add a nagios event handler which POSTs a HTTP webbhook to st2.

Nagios event handler

The event handler script is available at etc/st2service_handler.py.

Configuring the event handler

The event handler tries to register a trigger type first before sending any notifications to st2. This trigger type is then referenced in st2 rules. See rules/ for examples.

Installing the event handler

  1. Pick the nagios host where you want the event handler to be placed.

  2. Copy st2service_handler.py and st2service_handler.yaml to /usr/local/nagios/libexec/

    cp etc/st2service_handler.* /usr/local/nagios/libexec/
  3. Make sure st2service_handler.py is executable.

    chmod +x /usr/local/nagios/libexec/st2service_handler.py
  4. Handlers require a configuration file (See etc/st2service_handler.yaml) containing st2 credentials, st2 API URL and st2 auth URL, st2 API Key, Unauthed and SSL Verify Flag.

  5. Test the event handler manually.

    python st2service_handler.py st2service_handler.yaml 44534 3 WARNING HARD "/var/log" 4 host-name
    # You'd see something like the following if the test succeeds.
    Sent nagios event to st2. HTTP_CODE: 202

Handler options

  1. The handler supports unauthed st2 endpoints (server side authentication turned off). Though this is not recommended, you can use this for local testing. To turn on the unauthed flag to true in st2service_handler.yaml

    unauthed: True
    
  2. The handler also supports turning on/off ssl verification for all API requests to st2. By default, SSL verification is turned off as evaluation versions of st2 ship with self-signed certs. To turn on ssl verify, change the flag in st2service_handler.yaml to True.

    ssl_verify: True
    
  3. If for whatever reason, you've to debug the handler, you can use the --verbose option.

    python st2service_handler.py st2service_handler.yaml 44534 3 WARNING HARD "/var/log" 4 host-name --verbose

About

Nagios integration pack. See README.md for setup instructions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages