Nagios is a long favored monitoring solution for companies across the spectrum. XI adds much functionality and commercial support.
This integration is targeted for Nagios XI, if you are looking for Nagios Core, check here
- Nagios XI
- xMatters integration agent 5.1.8 - Download and documentation here
- xMatters account - If you don't have one, get one!
- NagiosXI-IAFiles.zip - Integration Agent integration service files.
- NagiosXICommPlan.zip - The Comm Plan for uploading to xMatters On Demand.
A contact with a notification command is notified when a host or service goes critical. The command fires to the Integration Agent and passes all the relevant information. The Integration Agent builds the payload and makes a REST call to the Integration Builder which creates the event. Responses are then sent back to the Integration Agent (through IA polling to xMoD) and Nagios is updated.
Pre-steps: Install and configure the Integration Agent on the same box as Nagios XI. See details here.
- Login to xMatters as a Developer and create a new user.
- Create a new REST user. See details here
- Import the NagiosXICommPlan.zip communications plan.
- Next to the NagiosXI comm plan, click Edit > Access Permissions and give access to the user created in step 2.
- Click Edit > Forms and next to the Host Notification form, click Edit > Sender Permissions and give access to the user created in step 2. Repeat for the Service Notification form.
- Navigate to the Integration Builder tab and expand the Inbound Integrations section. Click on
Inbound Host Events
and copy the URL at the bottom. Repeat forInbound Service Events
.
-
Open the
IAHOME/conf/IAConfig.xml
file and navigate to the<service-configs>
element near the bottom. Add the following two lines inside that tag:<path>applications/nagios/nagios_host.xml</path> <path>applications/nagios/nagios_service.xml</path>
-
Unzip the NagiosXI-IAFiles.zip to
IAHOME/integrationservices/applications/
. -
Open the
IAHOME/integrationservices/applications/nagios/configuration_host.js
file in a text editor. -
Update the
WEB_SERVICE_URL
value with the URL for theInbound Host Events
inbound integration copied from above. -
Update the
INITATOR
value to match the user created in xMatters above. -
Verify the
NAGIOS_COMMAND_FILE
path variable is correct and save the file. -
Repeat steps 4 through 6 for the
IAHOME/integrationservices/applications/nagios/configuration_service.js
file. -
Open the
IAHOME/integrationservices/applications/nagios/nagios_host.js
file in a text editor. -
Scroll down to the
execute
function. Update the path to theprintf_redirect.sh
script so it points toIAHOME/integrationservices/applications/nagios/printf_redirect.sh
-
Repeat step 9 for the
IAHOME/integrationservices/applications/nagios/nagios_service.js
file. -
To encrypt the password for the xMatters REST user, navigate to the
IAHOME/bin
directory and run the following command:./iapassword.bat --new "MYCOMPLEXPASSWORD" --old "xmatters" --file integrationservices/applications/nagios/.initiatorpasswd
Replacing
MYCOMPLEXPASSWORD
with the password for the xMatters REST user.
- Login to Nagios XI and into the Core Config Manager.
- Click Commands and create two new commands with the following info:
Command Name | Command | Command Type |
---|---|---|
xM-Agent-host | IAHOME/bin/APClient.bin --map-data "applications|nagios-host" "host" "$HOSTNAME$" "$HOSTGROUPNAME$" "$HOSTADDRESS$" "$HOSTSTATE$" "$HOSTSTATEID$" "$LASTHOSTSTATE$" "$LASTHOSTSTATEID$" "$HOSTSTATETYPE$" "" "" "$HOSTEVENTID$" "$HOSTPROBLEMID$" "$HOSTOUTPUT$" "$LONGHOSTOUTPUT$" "$HOSTDOWNTIME$" |
misc command |
xM-Agent-service | IAHOME/bin/APClient.bin --map-data "applications|nagios-service" "service" "$HOSTNAME$" "$SERVICEDESC$" "$HOSTGROUPNAME$" "$HOSTADDRESS$" "$HOSTSTATE$" "$HOSTSTATEID$" "$HOSTEVENTID$" "$HOSTPROBLEMID$" "$SERVICESTATE$" "$SERVICESTATEID$" "$LASTSERVICESTATE$" "$LASTSERVICESTATEID$" "$SERVICESTATETYPE$" "" "" "$SERVICEEVENTID$" "$SERVICEPROBLEMID$" "$SERVICEOUTPUT$" "$LONGSERVICEOUTPUT$" "$SERVICEDOWNTIME$" |
misc command |
Make sure to replace IAHOME
with the full path to the Integration Agent home directory.
- Click Contacts and create a new xMatters contact. Populate a Contact Name.
- On the Alert Settings tab, click on the Manage Host Notification Commands button and select the
xM-Agent-host
command from above. - Repeat for the Manage Service Notification Commands but select the
xM-Agent-service
command.
Finally, add the contact to a Service and/or a Host that needs to use the xMatters alerting capabilities as well as a Host and Service Group. These will be the targeted recipients when an event is triggered.
Make a service fail or a host bring a host offline that has the xMatters contact. This will trigger the command into the Integration Agent, which will create an event in xMatters. Responding with Acknowledge will acknowledge the Service or Host in Nagios.
If events are not making it to users:
- Check the Integration Agent log
IAHOME/log/AlarmPoint.txt
to make sure Nagios is actually attempting to send the event to the agent. - Check the activity stream for the
Inbound Service Events
(orInbound Host Events
) inbound integration service and check for errors. - Check the event log for any errors
If responses are not effecting changes in Nagios:
- Check the Integration Agent log
IAHOME/log/AlarmPoint.txt
for any errors.