Nagios integration
You can configure the Nagios webhook to post notifications to the APEX AIOps Incident Management Events API when events of interest occur.
Before you begin
This integration was validated with Nagios v5.9.1.
Before you start to set up your integration, make sure:
You have an active Nagios account.
You have the necessary permissions to create alerts and notification channels in Nagios.
Nagios can make requests to external endpoints over port 443. This is the default.
You have downloaded the send_to_moogsoft.sh script.
You have a valid Incident Management API key.
Create an Incident Management Nagios integration
To create a Nagios integration, do the following initial setup steps to provision your integration:
Log in to your Incident Management instance.
Choose Integrations > Ingestion Services > Nagios.
Click Add New Integration.
Under APEX AIOps Incident Management Endpoint, enter a unique name for your new integration (required).
Note
The name of the integration can be anything you choose. Incident Management will automatically generate an API endpoint URL independent of what you enter for this field.
Under API Description, enter a description for the integration (optional).
Click Save at the bottom of the page.
The custom endpoint is now provisioned. Incident Management displays the integration name you specified, the API description, if provided, and a status of Provisioned.
Under the heading, Configuration Information, copy the APEX AIOps Incident Management Endpoint URL generated when you provisioned your integration. You will be using this for your Nagios integration.
Follow the next steps to configure your Nagios instance, map your payload data (optional), and preview the deduplication key. You will not be able to click Save until you complete all of the steps.
Note
Keep the web page for this integration open in your browser while you complete the following steps.
Initial configuration
To prepare your Nagios instance for integration with Incident Management, do the following:
Edit the
send_to_moogsoft.sh
script and update the following variables.MOOGSOFT_URL: Enter the APEX AIOps Incident Management Endpoint URL.
MOOGSOFT_API_KEY: Enter your Incident Management API key.
Copy the
send_to_moogsoft.sh
script to the/usr/local/nagios/libexec
folder of your Nagios server.Make the script executable:
chmod +x send_to_moogsoft.sh
Change the ownership of the script to
apache:nagios
:chown apache:nagios send_to_moogsoft.sh
Create a host notification command in Nagios
To create a host notification command in Nagios, do the following:
Navigate to Configure > Core Config Manager.
Click Commands in the CCM Object summary pane.
Click + Add New.
In the Command Name field, enter send-host-event-moogsoft.
In the Command Line field, enter the following:
/usr/local/nagios/libexec/send_to_moogsoft.sh HOST "$HOSTNAME$" "$HOSTALIAS$" $TIMET$ "$HOSTCHECKCOMMAND$" $HOSTSTATEID$ "$HOSTOUTPUT$" $HOSTSTATETYPE$ "state_type:$HOSTSTATETYPE$" "desc:$HOSTDESC$" "last_ok:$LASTHOSTOK$" "$HOSTADDRESS$"
On the Command Type menu, click misc command.
Click Save.
Create a service notification command in Nagios
To create a service notification command in Nagios, do the following:
Navigate to Configure > Core Config Manager.
Click Commands in the CCM Object summary pane.
Click + Add New.
In the Command Name field, enter send-service-event-moogsoft.
In the Command Line field, enter the following:
/usr/local/nagios/libexec/send_to_moogsoft.sh SERVICE "$HOSTNAME$" "$HOSTALIAS$" $TIMET$ "$SERVICECHECKCOMMAND$" $SERVICESTATEID$ "$SERVICEOUTPUT$" $SERVICESTATETYPE$ "state_type:$SERVICESTATETYPE$" "desc:$SERVICEDESC$" "last_ok:$LASTSERVICEOK$" "$HOSTADDRESS$"
In the Command Type list, click misc command.
Click Save.
Click Apply Configuration.
Create a notification contact group
To create an APEX AIOps Incident Management contact group in Nagios, do the following:
Navigate to Configure > Core Config Manager.
Under Alerting in the side panel, click Contact Groups.
Click + Add New.
In the Contact Group Name field, enter moogsoft.
In the Alias field, enter Send notifications to Moogsoft.
Click Save.
Click Apply Configuration.
Create an Incident Management contact and configure notification settings
To create an Incident Management contact and configure notification settings in Nagios, do the following:
Navigate to Configure > Core Config Manager.
Under Alerting in the side panel, click Contacts.
Click + Add New.
In the Contact Name field, enter moogsoft.
(Optional): Add a Description for the contact.
Click Manage Contact Groups.
Add the moogsoft contact group to the Assigned list.
Click Close.
Click the Alert Settings tab.
Set Host Notifications Enabled to On.
Set the preferred notification time period via the Host Notifications Timeperiod dropdown.
Set Host Notifications Options to Down, Unreachable, Up, Flapping, and Scheduled Downtime.
Click Manage Host Notification Commands.
Add the send-host-event-moogsoft command to the Assigned list.
Click Close.
Set Service Notifications Enabled to On.
Set the preferred notification time period via the Service Notifications Timeperiod dropdown.
Set Service Notifications Options to Warning, Unknown, Critical, Flapping, Scheduled Downtime, and Ok.
Click Manage Service Notification Commands.
Add the send-service-event-moogsoft command to the Assigned list.
Click Close.
Click Save.
Click Apply Configuration.
Assign the contact group to host and service templates
Next, apply the contact group and associated notification settings to the relevant host and service templates used for monitoring in your environment. These examples use the xiwizard_generic_host and xiwizard_generic_service templates as created and assigned by the Nagios XI auto-discovery function, but you need to ensure that notification are enabled for each template in use in your environment.
Navigate to Configure > Core Config Manager.
Under Templates in the side panel, click Host Templates.
From the list of templates, select xiwizard_generic_host.
Click the Alert Settings tab.
Click Manage Contact Groups.
Add the moogsoft contact group to the Assigned list.
Click Close and then click Save.
Click Apply Configuration.
On the Core Config Manager page, under Templates in the side panel, click Service Templates.
From the list of templates select xiwizard_generic_service.
Click the Alert Settings tab.
Click Manage Contact Groups.
Add the moogsoft contact group to the Assigned list.
Click Close and then click Save.
Click Apply Configuration.