Nagios is the industry standard infrastructure monitoring tool. This integration expands the alerting capabilities of Nagios to leverage the xMatters communication protocols and integration platform for driving workflow across tools.
An updated version of this integration is available, supporting the latest version of Nagios and based on xMatters Flow Designer so you can easily connect other tools to your toolchain. Install it right from the Workflow Template directory within your xMatters instance. Learn more.
- Nagios Core 4.3.x
- xMatters account - If you don't have one, get one!
- Nagios.zip - Nagios Workflow with necessary the notification templates and integration scripts.
- xmatters.cfg - The contact and command entries for the xMatters notifications
This integration uses a Nagios command to fire a curl request into one of the flow designer canvases, either Host or Service.
- Create a new user called
nagiosand grant theStandard User,Limited DeveloperandREST Web Services Userroles. - Click the Login as This User and nagivate to the Workflow page. Click the Import button and import the Nagios.zip file. If other users should be able to edit the scripts or forms going forward, click the Edit > Access Permissions on the Nagios Workflow and add the necessary users or roles.
- On the Flows tab, click inside the New Host Notification and double click (or click the edit pencil) next to the New Host Notification http trigger with the Nagios icon on it. In the dialog presented, copy the url at the bottom.
Repeat for the **New Service Notification** flow. Keep urls for later.
- Login to the Nagios host machine and navigate to the
NAGIOS_HOMEdirectory. - Copy the xmatters.cfg file to the
NAGIOS_HOME/etcdirectory. Open this file and replace theXMATTERS_SERVICE_URL_HEREandXMATTERS_HOST_URL_HEREvalue with the inbound urls copied from above. Note If a different authentication method on the inbound integration was selected above, then the curl command will need to be updated. The-u, --userparameter will do basic auth or API Key auth. The syntax will be--user "username:password"See the curl help for more details. - Open the
nagios.cfgfile and in theOBJECT CONFIGURATION FILESsection, add this line, replacingNAGIOS_HOMEwith the full path to Nagios.
cfg_file=NAGIOS_HOME/etc/xmatters.cfg
- Add the
xmatterscontact to the appropriate service by updating the service definition file. For example, to add xmatters to the ping service in theNAGIOS_HOME/etc/objects/localhost.cfg, add acontactsentry to make it look like this:
define service{
use local-service ; Name of service template to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
contacts xmatters
}
- Restart Nagios for the changes to take effect.
Instead of adding the xmatters contact to each host and service entry, the contact can be added at the template level the host or service inherits from. In the local-service example above, instead of adding xmatters to the service, track down the template definition for local-service.
To test the integration, find a service that can be taken down for testing, or, alternatively, use the "Send custom service notification" on the service updated above. This is a screen shot of the PING service:
The nagios.cfg file contains debug logging settings and the debug log information. Setting the debug_level to 256 and inspecting the debug_file file should show debug level information and any errors associated with the curl command.
Also check the activity stream in the host or service canvas for additional details.
Some curl installations have reported a NSS error -5938 error when making the curl request to xMatters. This can be solved by adding the -1, --tlsv1 parameter to force TLS v1. For example:
define command {
command_name notify_xmatters_service
command_line curl --tlsv1 -X POST -H "Content-Type: application/json" -d '{ "NAGIOS_CONTACTGROUPNAME": "$SERVICEDISPLAYNAME$", "NAGIOS_HOSTDISPLAYNAME": "$HOSTDISPLAYNAME$", "NAGIOS_HOSTNAME": "$HOSTNAME$", "NAGIOS_HOSTOUTPUT": "$HOSTOUTPUT$", "NAGIOS_HOSTSTATE": "$HOSTSTATE$", "NAGIOS_LASTHOSTSTATECHANGE": "$LASTHOSTSTATECHANGE$", "NAGIOS_LASTSERVICESTATECHANGE": "$LASTSERVICESTATECHANGE$", "NAGIOS_NOTIFICATIONAUTHOR": "$NOTIFICATIONAUTHOR$", "NAGIOS_NOTIFICATIONCOMMENT": "$NOTIFICATIONCOMMENT$", "NAGIOS_NOTIFICATIONTYPE": "$NOTIFICATIONTYPE$", "NAGIOS_SERVICEDESC": "$SERVICEDESC$", "NAGIOS_SERVICEOUTPUT": "$SERVICEOUTPUT$", "NAGIOS_SERVICESTATE": "$SERVICESTATE$", "NAGIOS_TIMET": "$TIMET$" }' "XMATTERS_INBOUND_URL_HERE"
}