- 07 Jun 2022
- Print
- PDF
Setup Nagios Core Integration
- Updated on 07 Jun 2022
- Print
- PDF
After you generate your scripts in SysAid, you must configure Nagios Core 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 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
Before modifying any of your Nagios files, be sure to take the following steps.
- Backup the following files:
- contacts.cfg
- commands.cfg
- nagios.cfg
- Restart Nagios to validate the current configuration with the following command: ActionScript
service nagios restart
- Transfer the "sysaid_host_notification.bash" and the "sysaid_service_notification.bash" script files that you generated in SysAid to the nagios/libexec/eventhandlers folder.
- Change the access permissions on the scripts to allow their execution, using chmod: ActionScript
chmod +x sysaid_host_notification.bash sysaid_service_notification.bash
Update the Nagios configuration files
- Locate the nagios.cfg file and update the enable_environment_macros parameter to '1':ActionScript
enable_environment_macros=1
- Update the Command configuration file to run the scripts:
- Locate the commands.cfg file in the "/usr/local/nagios/etc/objects" directory.
- Add a command for each of the two scripts that includes a command name you select and command line that provides the full path for the script
- Sample command definitionsActionScript
define command{ command_name notify-sysaid-host-event command_line /usr/local/nagios/libexec/eventhandlers/sysaid_host_notification.bash } define command{ command_name notify-sysaid-service-event command_line /usr/local/nagios/libexec/eventhandlers/sysaid_service_notification.bash }
- Update the Contacts configuration file to run the script:
- Locate the contacts.cfg file in the "/usr/local/nagios/etc/objects" directory.
- Define a new contact to receive the commands you defined in the commands.cfg file.
- Specify the contact name and alias.
- Specify if the contact should receive both host and service notifications.
- Specify the time-frame for receiving notifications.
- Specify the type of host and service notifications that should be sent to the contact (see the Notification Options table below for more information).
- Specify the commands you defined in the commands.cfg file.
- Enable the new contact in Nagios by adding it to the hosts and services you want to receive notifications for. This is usually done by adding the contact to a contact group as in the following sample command in the contacts.cfg file:ActionScript
define contactgroup{ contactgroup_name admins alias Nagios Administrators members nagiosadmin,sysaid }
- Restart Nagios with the following command:ActionScript
service nagios restart
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 |
S | Scheduled Downtime |
Service Notifications | |
W | Warning |
U | Unknown |
C | Critical |
F | Flapping |
S | Scheduled Downtime |
R | RFecovery |
N | Null |
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.
- Transfer the "send_host_list_to_sysaid.bash" script file to a folder in Nagios.
- Change the access permissions on the secripts to allow their execution, using chmod:ActionScript
chmod +x send_host_list_to_sysaid.bash
- Run the script as follows:ActionScript
./send_host_list_to_sysaid.bash