Configure Nagios XI Integration
    • 07 Jun 2022
    • PDF

    Configure Nagios XI Integration

    • PDF

    Article summary

    After you generate your scripts in SysAid, you must configure Nagios XI to run those scripts to automatically generate the SRs you want and to import the hosts you are monitoring with Nagios to SysAid Asset Management.

    Automatically create SRs for Nagios events and alerts

    The first two of the three scripts you generated allow Nagios to automatically create SRs in SysAid for events and alerts relating to hosts and services you are monitoring. The following procedure allows enables Nagios to run those scripts and communicate the information to SysAid. You can repeat this process to configure different host groups or service groups to run different scripts.

    Preparatory Steps

    1. Transfer the "sysaid_host_notification.bash" and the "sysaid_service_notification.bash" script files that you generated in SysAid to the nagios/etc/objects folder.
    2. Change the access permissions on the scripts to allow their execution, using chmod:
      chmod +x sysaid_host_notification.bash sysaid_service_notification.bash
    3. Locate the nagios.cfg file and update the enable_environment_macros parameter to '1':
      enable_environment_macros=1
      IntegrationNagiosXIConfigurationfilesEnableMacros1.png

    Update the Nagios contacts and commands

    1. In the Nagios XI navigate to, Configure > Core Config Manager.
    2. Define a new command for each of the notification scripts you generated in SysAid:
      1. From the right-pane, click Commands.
      2. Click Add New.
        IntegrationNagiosXIConfigurationfilesCommands.png
      3. Enter a Command Name.
      4. Specify the full path to the script (for example, "/usr/local/nagios/libexec/eventhandlers/sysaid_host_notification.bash").
      5. From the Command Type drop-down list, select misc command.
      6. Click Save.
        IntegrationNagiosXIConfigurationfilesCommandManagement.png
      7. Repeat for these steps for the second script.
    3. Define a contact to receive the notifications:
      1. From the right-pane, select Alerting > Contacts.
      2. Click Add New.
        IntegrationNagiosXIConfigurationfilesContacts.png
      3. In the Common Settings tab, enter a Contact Name and Description.
      4. Click Manage Contact Groups.
        IntegrationNagiosXIConfigurationfilesContactCommonSettings.png
      5. Add the contact to a group that will receive the relevant notifications (we recommend adding the contact to the "Admin" group).
      6. In the Alert Settings tab, select the settings you want for host and service notifications (see the Notification Options table below for more information).
        IntegrationNagiosXIConfigurationfilesContactAlertSettings.png
      7. Click Manage Host Notification Commands, add the host command you created in the previous script, and click Close.
      8. Click Manage Service Notification Commands, add the service command you created in the previous script, and click Close.
        IntegrationNagiosXIConfigurationfilesSelectCommand.png
      9. Click Save.
    4. Click Apply Configuration.
      IntegrationNagiosXIConfigurationfilesApplySettingsApplySettings.png

    Notification options

    You can trigger a notification to run on the following host/service states.

    Syntax
    Definition
    Host Notifications
    D

    Down

    U

    Up

    R

    Recovery

    F

    Flapping

    SScheduled Downtime
    Service Notifications
    WWarning
    UUnknown
    CCritical
    FFlapping
    SScheduled Downtime
    RRecovery
    NNull

    Import Nagios hosts as assets in SysAid

    The third script you generate in SysAid allows you to import all of the hosts defined in Nagios into SysAid Asset Management.

    1. Transfer the "send_host_list_to_sysaid.bash" script file to a folder in Nagios.

    2. Change the access permissions on the scripts to allow their execution, using chmod:
      chmod +x send_host_list_to_sysaid.bash

    3. Configure Nagios XI to import assets to SysAid when it runs the script:

      1. Locate the httpd.conf file in the following directory: "/etc/httpd/conf/httpd.conf".
      2. Backup the httpd.conf file.
      3. Add the following lines to the file. Be sure to add the lines near the ScriptAlias tag and not within the VirtualHost tag.
        Text
        ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
        <Directory "/usr/local/nagios/sbin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
        </Directory>
        
      4. Restart the httpd service with the following command:
        service httpd restart
    4. Run the script as follows:
      ./send_host_list_to_sysaid.bash

    Note

    It is recommended to to set up a scheduled cron job to import assets on a regular basis.