NRDP - Installing NRDP From Source


Installing NRDP From Source

This document describes how to install Nagios Remote Data Processor (NRDP) from source. NRDP is a simple, PHP-based passive result collector for use with Nagios. It is designed to be a flexible data transport mechanism and processor, with a simple and powerful architecture that allows for it to be easily extended and customized to fit individual users' needs.

This guide is broken up into several sections and covers different Linux distributions and operating systems (OS). If your Linux Distribution or operating system is not included in this guide then please contact us to see if we can get it added. Some distributions may be missing as we don't have access to a test environment that allows us to develop the documentation.

NRDP 1.5.1 is what this guide instructs you to install, however future versions should also work fine with these steps.

Note: This guide is based on Nagios Core being installed using the following KB article:

Documentation - Installing Nagios Core From Source

Because this guide is based on Nagios Core already being installed, prerequisites like Apache and PHP will already be installed on the Nagios Core server and hence the installation process is relatively simple.

 

Nagios XI includes NRDP and hence you should NOT follow this documentation.

 

 

Editing Files

In many steps of this article you will be required to edit files. This documentation will use the vi text editor. When using the vi
editor:

 

 

Please select your OS:

 

 

 

RHEL | CentOS | Oracle Linux

Prerequisites

RHEL 8 and CentOS 8 require the php-xml and php-json modules to be installed, execute the following commands to do so:

dnf install -y php-xml php-json

 

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

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

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

cp nrdp.conf /etc/httpd/conf.d/

 

Restart Apache Web Server

===== RHEL 5/6 | CentOS 5/6 | Oracle Linux 5/6 =====

service httpd restart

 

===== RHEL 7/8 | CentOS 7 | Oracle Linux 7 =====

systemctl restart httpd.service

 

You can now proceed to the Test NRDP section.

 

 

Ubuntu

Prerequisites

Ubuntu 16/17/18 requires the php-xml module to be installed, execute the following commands to do so:

apt-get update
apt-get install -y php-xml

 

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

cd /tmp/nrdp-1.5.1/
sudo mkdir -p /usr/local/nrdp
sudo cp -r clients server LICENSE* CHANGES* /usr/local/nrdp
sudo chown -R nagios:nagios /usr/local/nrdp

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

sudo vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

sudo cp nrdp.conf /etc/apache2/sites-enabled/

 

Restart Apache Web Server

===== Ubuntu 13.x / 14.x =====

sudo service apache2 restart

 

===== Ubuntu 15.x / 16.x / 17.x =====

sudo systemctl restart apache2.service

 

You can now proceed to the Test NRDP section.

 

 

 

SUSE SLES | openSUSE Leap

Prerequisites

The php5-json or php7-json module needs to be installed, execute the following commands to do so:

===== SUSE SLES 12.x | openSUSE 42.x =====

sudo zypper --non-interactive install php5-json

 

===== openSUSE 15.x ===== 

sudo zypper --non-interactive install php7-json

 

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

cd /tmp/nrdp-1.5.1/
sudo mkdir -p /usr/local/nrdp
sudo cp -r clients server LICENSE* CHANGES* /usr/local/nrdp
sudo chown -R nagios:nagios /usr/local/nrdp

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

sudo vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

sudo cp nrdp.conf /etc/apache2/vhosts.d/

 

Restart Apache Web Server

===== SUSE SLES 11.x =====

sudo /sbin/service apache2 restart

 

===== SUSE SLES 12.x | openSUSE =====

sudo systemctl restart apache2.service

 

You can now proceed to the Test NRDP section.

 

 

Debian | Raspbian

All steps on Debian require to run as root. To become root simply run:

Debian:

su

 

Raspbian:

sudo -i

 

All commands from this point onwards will be as root.

 

Prerequisites

Debian | Raspbian v9 requires the php-xml module to be installed, execute the following commands to do so:

apt-get update
apt-get install -y php-xml

 

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

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

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

cp nrdp.conf /etc/apache2/sites-enabled/

 

Restart Apache Web Server

===== Debian 7.x =====

service apache2 restart

 

===== Debian 8.x / 9.x =====

systemctl restart apache2.service

 

You can now proceed to the Test NRDP section.

 

 

 

Fedora

Prerequisites

The php-xml and php-json module to be installed, execute the following commands to do so:

dnf install -y php-xml php-json

 

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

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

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

cp nrdp.conf /etc/httpd/conf.d/

 

Restart Apache Web Server

systemctl restart httpd.service

 

You can now proceed to the Test NRDP section.

 

 

Arch Linux

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

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

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

The /etc/httpd/conf/httpd.conf file will also need to be updated to use the config file.

cp nrdp.conf /etc/httpd/conf/extra/
echo 'Include "conf/extra/nrdp.conf"' >> /etc/httpd/conf/httpd.conf

 

Restart Apache Web Server

systemctl restart httpd.service

 

You can now proceed to the Test NRDP section.

 

 

 

Gentoo

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

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

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

cp nrdp.conf /etc/apache2/vhosts.d/

 

Restart Apache Web Server

===== openrc =====

rc-service apache2 restart

 

===== systemd =====

systemctl restart apache2.service

 

You can now proceed to the Test NRDP section.

 

 

 

FreeBSD

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

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

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

cp nrdp.conf /usr/local/etc/apache24/Includes/

 

Restart Apache Web Server

service apache24 restart

 

You can now proceed to the Test NRDP section.

 

 

 

Solaris

Tested with Solaris 11.

 

Downloading the Source

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

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

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

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

cp nrdp.conf /etc/apache2/2.2/conf.d/

 

Restart Apache Web Server

svcadm disable apache22
svcadm enable apache22

 

You can now proceed to the Test NRDP section.

 

 

 

Apple OS X

Downloading the Source

cd /tmp
curl -L -o nrdp.tar.gz https://github.com/NagiosEnterprises/nrdp/archive/1.5.1.tar.gz
tar xzf nrdp.tar.gz

 

Copy Files

The /usr/local/nrdp directory is going to be created to store the NDRP php files.

cd /tmp/nrdp-1.5.1/
sudo mkdir -p /usr/local/nrdp
sudo cp -r clients server LICENSE* CHANGES* /usr/local/nrdp
sudo chown -R nagios:nagios /usr/local/nrdp

 

Define Tokens

The token is what the client uses to authenticate with NRDP on the Nagios Core server. You can use the same token on all your clients, or you could defined a different token for each client. Defining a different token for each client allows you to revoke access at a later date by removing the token, but it also adds an extra level of administration.

You will need to edit the config.inc.php file and define the token(s) you want to use. Execute the following command to open the file in vi:

sudo vi /usr/local/nrdp/server/config.inc.php

 

The section to define the tokens will be at the top of the file, it is a PHP array. Here is an example of three tokens:

$cfg['authorized_tokens'] = array(
"cda35gtdfu72",
"90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53",
"+23rf==34m12n-v73nciu",
);

 

Each token must be surrounded by double quotes and end with a comma:

"",

 

Once you've added the tokens save the config.inc.php file and exit vi.

 

Copy Apache Config File

The httpd.conf file also needs to be updated to include the new config file.

sudo cp nrdp.conf /opt/local/apache2/conf/extra/
printf '\nInclude conf/extra/nrdp.conf\n' | sudo tee -a /opt/local/apache2/conf/httpd.conf

 

Restart Apache Web Server

sudo port reload apache2

 

You can now proceed to the Test NRDP section.

 

 

 

Test NRDP

NRDP is now running, to confirm this you can open the NRDP Web Interface.

Point your web browser to the ip address or FQDN of your NRDP server, for example:

http://10.25.5.143/nrdp

http://core-013.domain.local/nrdp

 

You will be presented with a screen similar to the following:

 

 

To test that it is working you are going to submit a passive check result. You can see in the screenshot that the Token field has been populated and both a host and service passive check result has been defined. Click the Submit JSON Check Result button.

The browser will display an OK under the Submit JSON Check Result button if all was successful.

You'll see the following in the /usr/local/nagios/var/nagios.log file:

[1514933633] Error: Got host checkresult for 'somehost', but no such host can be found
[1514933633] Error: Got check result for service 'someservice' on host 'somehost'. Unable to find service

 

This error message is expected, because the somehost host doesn't actually exist in the Nagios configs so Nagios will record this in the log file. The following documentation provides examples of host and service configs:

NRDP - Passive Host And Service Definitions

 

If the configs exist then you'll also see this reflected in the Nagios Core GUI:

 

 

 

Additional Reading

The following KB article explains the send_nrdp client which can help integrate passive checks with Nagios Core.

Documentation - NRDP - send_nrdp Client

 

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

 



Article ID: 602
Created On: Fri, Jun 30, 2017 at 12:41 AM
Last Updated On: Thu, May 27, 2021 at 9:06 AM
Authored by: tlea

Online URL: https://support.nagios.com/kb/article/nrdp-installing-nrdp-from-source-602.html