Nagios NRDP – Configuring The send_nrdp Global Event Commands
This following pages of this article explain how to set up the global event commands on the remote Nagios server NAG-REMOTE to use the send_nrdp.py client and send check results to the central Nagios server NAG-CENTRAL.
Remote Server – Configuring a Global Host Event Command
To configure a Global Host Event Command on the remote Nagios server NAG-REMOTE perform the following steps:
- SSH to NAG-REMOTE as a normal user
- Switch to root in by executing the command below:
su
- Edit /usr/local/nagios/etc/objects/commands.cfg
vi /usr/local/nagios/etc/objects/commands.cfg
- Go to the end of the file and add in a new command as shown below, substituting the {Your Nagios server address here} with the IP Address of your Nagios Server with NRDP installed and configured and substituting {Your nrdp token here} with the token you created when setting up NRDP:
define command { command_name global_host_send_nrdp command_line /usr/bin/printf "%b" "$HOSTNAME$\t$HOSTSTATEID$\t$HOSTOUTPUT$" | $USER3$/send_nrdp.py -u http://{Your Nagios server address here}/nrdp/ -t {Your nrdp token here} }
- Save and exit the file
- Edit /usr/local/nagios/etc/nagios.cfg
vi /usr/local/nagios/etc/nagios.cfg
- Search for the line #global_host_event_handler=somecommand and change it to the following:
global_host_event_handler=global_host_send_nrdp
- Save and exit the file
- Restart the nagios service
Remote Server – Configuring a Global Service Event Command
The next piece of configuration on the Remote Server is to configure a Global Service Event Command which will then be used to send check results to the Central Nagios server via send_nrdp.py.
To configure a Global Host Event Command perform the following steps:
- Edit /usr/local/nagios/etc/objects/commands.cfg
vi /usr/local/nagios/etc/objects/commands.cfg
- Go to the end of the file and add in a new command as shown below, substituting the {Your Nagios server address here} with the IP Address of your Nagios Server with NRDP installed and configured and substituting {Your nrdp token here} with the token you created when setting up NRDP:
define command { command_name global_service_send_nrdp command_line /usr/bin/printf "%b" "$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATEID$\t$SERVICEOUTPUT$" | $USER3$/send_nrdp.py -u http://{Your Nagios server address here}/nrdp/ -t {Your nrdp token here} }
- Save and exit the file
- Edit /usr/local/nagios/etc/nagios.cfg
vi /usr/local/nagios/etc/nagios.cfg
- Search for the line #global_service_event_handler=somecommand and change it to the following:
global_service_event_handler=global_service_send_nrdp
- Save and exit the file
- Restart the nagios service