Enabling alerts posted to a URL

OpsCenter can post alerts to a URL if you provide a correctly formatted POST script.

OpsCenter can be configured to send alerts within an HTTP POST request to a specified URL. For example, a simple PHP script containing print_r($_POST); will echo the received POST request. An example POST request is:

POST / HTTP/1.0
Host: localhost
User-Agent: Twisted PageGetter
Content-Length: 184
Content-type: application/x-www-form-urlencoded
connection: close

target_node=None&event_source=OpsCenter&success=None&level=1&level_str=INFO&api_source_ip=None&user=None&time=1400098707681966&action=18&message=OpsCenter+starting+up.&source_node=None

The request body contains fields described in Alerts.

To enable URL posting on the OpsCenter side:

Procedure

  1. Edit the posturl.conf file and provide a path to your script.
    • Package installations: /etc/opscenter/event-plugins
    • Binary tarball installations (Linux and Mac OSX): install_location/opscenter/conf/event-plugins
    • Windows installations: Program Files (x86)\DataStax Community\opscenter\conf\event-plugins
  2. Make sure your web server and posting script are configured to receive alerts.
  3. On the OpsCenter daemon host, open posturl.conf for editing.
  4. Set enabled to 1. For url, provide a valid path to your posting script.
    url=http://50.1.1.11/postOPSCevents.php
  5. Optionally, select the desired logging level. The default is to listen for all levels of events.
  6. Save posturl.conf and restart the OpsCenter daemon.

Example

In a system with posting enabled for critical and alert-level events, posturl.conf looks like:


[posturl] 
enabled = 1
url =http://10.1.1.11/postOPSCevents.php
# levels can be comma delimited list of any of the following: 
# DEBUG,INFO,WARN,ERROR,CRITICAL,ALERT 
# If left empty, will listen for all levels 
levels =CRITICAL,ALERT