Nagios NRDP – Installing and testing NRDP

Nagios NRDP – Installing and testing NRDP

This page of this series explains how to install and configure NRDP (Nagios Remote Data Protocol) on a central Nagios Core server and a remote Nagios Core server.

Full information can be found on the Nagios support site page NRDP – Installing NRDP From Source.

Central Nagios Server Install

The NRDP install on the Central Nagios server will be performed fully as this will be where the passive checks reside and the Remote Nagios server will send check results for processing.

To install NRDP on to the Central Nagios Server NAG-CENTRAL perform the following steps:

  • SSH to NAG-CENTRAL as a normal user
  • Switch to root in Raspian by executing the command below:
sudo -i
  • Update the software and install php-xml by executing the commands below:
apt-get update

apt-get install -y php-xml
  • Download the source and unpack by executing the commands below:
cd /tmp

wget -O nrdp.tar.gz https://github.com/NagiosEnterprises/nrdp/archive/1.5.1.tar.gz

tar xzf nrdp.tar.gz
  • Create the directory /usr/local/nrdp which will store the PHP files, copy the files, and change the permissions by executing the commands below:
cd /tmp/nrdp-1.5.1/

mkdir -p /usr/local/nrdp

cp -r clients server LICENSE* CHANGES* /usr/local/nrdp

chown -R nagios:nagios /usr/local/nrdp
  •  Edit the file /usr/local/nrdp/server/config.inc.php
vi /usr/local/nrdp/server/config.inc.php
  • Locate the section below:
$cfg['authorized_tokens'] = array(
 //"mysecrettoken", // <-- not a good token
 //"90dfs7jwn3", // <-- a better token (don't use this exact one, make your
 own)
);
  • Add the token (ThisIsMyTestNRDPToken) is the token used in this test environment) which is to be used to this section of the config file as shown below:
$cfg['authorized_tokens'] = array(
 "ThisIsMyTestNRDPToken",
 );
  • Save and exit the file
  • Copy the NRDP Apache config file by executing the command below:
cp nrdp.conf /etc/apache2/sites-enabled/
  • Restart Apache by executing the command below:
systemctl restart apache2.service

Remote Nagios Server Install

The NRDP install on the remote Nagios server will only be performed up to the copying of the client files as these are all that is needed on the remote Nagios server.

To install NRDP on to 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
  • Update the software and install php-xml and php-json by executing the commands below:
yum update

yum install -y php-xml

yum install -y php-json
  • Download the source and unpack by executing the commands below:
cd /tmp

wget -O nrdp.tar.gz https://github.com/NagiosEnterprises/nrdp/archive/1.5.1.tar.gz

tar xzf nrdp.tar.gz
  • Create the directory /usr/local/nrdp which will store the PHP files, copy the files, and change the permissions by executing the commands below:
cd /tmp/nrdp-1.5.1/

mkdir -p /usr/local/nrdp

cp -r clients server LICENSE* CHANGES* /usr/local/nrdp

chown -R nagios:nagios /usr/local/nrdp

Testing NRDP

The final part of this page in the series is to test NRDP is working both locally on the central Nagios server and from the remote Nagios server also.

Central Nagios Server Testing

To test that NRDP is installed and configured correctly perform the following steps:

  • Navigate to NRDP page of the central Nagios server NAG-CENTRAL http://nag-central/nrdp
  • If it hasn’t opened to the Submit Check Result tab select it
  • Enter the token defined in the Central Nagios Server Install section which in this example was ThisIsMyTestNRDPToken.
  • Click on the Submit JSON Check Result button at the bottom of the page and it will show OK
  • SSH to NAG-CENTRAL as a normal user view the /var/log/messages log file by executing the following command:
tail /var/log/messages
  • In the log there should be two entries for the check result tests as shown below:
Dec 5 08:43:32 NAG-CENTRAL nagios: Error: Got host checkresult for '', but no such host can be found
Dec 5 08:43:32 NAG-CENTROL nagios: Error: Got host checkresult for '', but no such host can be found
  • These show that NRDP has received the test check results but cannot process them as no hostname was given.

Remote Nagios Server Testing

To test that NRDP is installed and configured correctly to send check results from the remote Nagios server perform the following steps:

  • SSH to NAG-REMOTE as a normal user
  • Switch to root in by executing the command below:
su
  • Go to the /usr/local/nrdp/clients directory and execute the command below substituting NAG-CENTRAL for your central Nagios server address and ThisIsMyTestNRDPToken with the token defined in the Central Nagios Server Install section :
./send_nrdp.py -u http://NAG-CENTRAL/nrdp/ -t ThisIsMyTestNRDPToken --host=another-host --service="PASSIVE-CPU-CHECK" --state=1 --output="Server is DOWN"
  • SSH to NAG-CENTRAL as a normal user view the /var/log/messages log file by executing the following command:
tail /var/log/messages
  • In the log there should be two entries for the check result tests as shown below:
Dec 5 09:36:02 frontroom nagios: Error: Got host checkresult for 'another-host', but no such host can be found
  • This shows that the remote Nagios server has sent a check result using the send_nrdp.py client script and that the central Nagios server has received the check result but cannot process it as there is no host defined named another-host.

Previous Page                                                                                                                            Next Page

Leave a Reply

Your email address will not be published.