Skip to main content

Nagios integration

You can configure the Nagios webhook to post notifications to the Moogsoft Cloud 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.

Create a Nagios integration in Moogsoft Cloud

To create a Nagios integration, do the following initial setup steps to provision your integration:

  1. Log in to your Moogsoft Cloud instance.

  2. Choose Integrations > Ingestion Services > Nagios.

  3. Click Add New Integration.

  4. Under Moogsoft Endpoint, enter a unique name for your new integration (required).

    Note

    The name of the integration can be anything you choose. Moogsoft Cloud will automatically generate an API endpoint URL independent of what you enter for this field.

  5. Under API Description, enter a description for the integration (optional).

  6. Click Save at the bottom of the page.

    The custom endpoint is now provisioned. Moogsoft Cloud displays the integration name you specified, the API description, if provided, and a status of Provisioned.

  7. Under the heading, Configuration Information, copy the Moogsoft Endpoint URL generated when you provisioned your integration and the Moogsoft Cloud API Key. You will be using these 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 Moogsoft Cloud, do the following:

  1. Edit the send_to_moogsoft.sh script and update the following variables.

    1. MOOGSOFT_URL: Enter the Moogsoft Endpoint URL.

    2. MOOGSOFT_API_KEY: Enter your Moogsoft API key.

  2. Copy the send_to_moogsoft.sh script to the /usr/local/nagios/libexec folder of your Nagios server.

  3. Make the script executable:

    chmod +x send_to_moogsoft.sh
  4. 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:

  1. Navigate to Configure > Core Config Manager.

  2. Click Commands in the CCM Object summary pane.

  3. Click + Add New.

  4. In the Command Name field, enter send-host-event-moogsoft.

  5. 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$"
  6. On the Command Type menu, click misc command.

  7. Click Save.

Create a service notification command in Nagios

To create a service notification command in Nagios, do the following:

  1. Navigate to Configure > Core Config Manager.

  2. Click Commands in the CCM Object summary pane.

  3. Click + Add New.

  4. In the Command Name field, enter send-service-event-moogsoft.

  5. 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$"
  6. In the Command Type list, click misc command.

  7. Click Save.

  8. Click Apply Configuration.

Create a notification contact group

To create a Moogsoft Cloud contact group in Nagios, do the following:

  1. Navigate to Configure > Core Config Manager.

  2. Under Alerting in the side panel, click Contact Groups.

  3. Click + Add New.

  4. In the Contact Group Name field, enter moogsoft.

  5. In the Alias field, enter Send notifications to Moogsoft.

  6. Click Save.

  7. Click Apply Configuration.

Create a Moogsoft Cloud contact and configure notification settings

To create a Moogsoft contact and configure notification settings in Nagios, do the following:

  1. Navigate to Configure > Core Config Manager.

  2. Under Alerting in the side panel, click Contacts.

  3. Click + Add New.

  4. In the Contact Name field, enter moogsoft.

  5. (Optional): Add a Description for the contact.

  6. Click Manage Contact Groups.

  7. Add the moogsoft contact group to the Assigned list.

  8. Click Close.

  9. Click the Alert Settings tab.

  10. Set Host Notifications Enabled to On.

  11. Set the preferred notification time period via the Host Notifications Timeperiod dropdown.

  12. Set Host Notifications Options to Down, Unreachable, Up, Flapping, and Scheduled Downtime.

  13. Click Manage Host Notification Commands.

  14. Add the send-host-event-moogsoft command to the Assigned list.

  15. Click Close.

  16. Set Service Notifications Enabled to On.

  17. Set the preferred notification time period via the Service Notifications Timeperiod dropdown.

  18. Set Service Notifications Options to Warning, Unknown, Critical, Flapping, Scheduled Downtime, and Ok.

  19. Click Manage Service Notification Commands.

  20. Add the send-service-event-moogsoft command to the Assigned list.

  21. Click Close.

  22. Click Save.

  23. 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.

  1. Navigate to Configure > Core Config Manager.

  2. Under Templates in the side panel, click Host Templates.

  3. From the list of templates, select xiwizard_generic_host.

  4. Click the Alert Settings tab.

  5. Click Manage Contact Groups.

  6. Add the moogsoft contact group to the Assigned list.

  7. Click Close and then click Save.

  8. Click Apply Configuration.

  9. On the Core Config Manager page, under Templates in the side panel, click Service Templates.

  10. From the list of templates select xiwizard_generic_service.

  11. Click the Alert Settings tab.

  12. Click Manage Contact Groups.

  13. Add the moogsoft contact group to the Assigned list.

  14. Click Close and then click Save.

  15. Click Apply Configuration.

2023-01-20T19:04:10-05:00