×


Install NRDP From Source - On different Linux Distribution

PHP-based passive result collector for use with Nagios, NRDP is a flexible data transport mechanism and processor.

It has a simple and powerful architecture that allows for it to be easily extended and customized to fit individual users needs.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Nagios queries.

In this context, we shall look into how to install Nagios Remote Data Processor (NRDP) from the source.


How to Install NRDP From Source ?

To begin with this installation procedure, we suggest that have the following:

  • Nagios Core.
  • Apache and PHP on the Nagios Core server.


Nagios XI includes NRDP by default.


1. On RHEL|CentOS|Oracle Linux

We need to install the php-xml and php-json modules in RHEL 8:

# dnf install -y php-xml php-json

a. Download 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

b. Copy Files

We create the /usr/local/nrdp directory 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

c. Define Tokens

Generally, the client uses tokens to authenticate with NRDP on the Nagios Core server.

We can use the same token on all clients or we can define a different token for each client.

We need to edit the config.inc.php file and define the token(s) to use. To do so, open the file in vi:

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

The section to define the tokens is at the top of the file, it is a PHP array.

For example,

$cfg[‘authorized_tokens’] = array(
“cda35gtdfu72”,
“90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53”,
“+23rf==34m12n-v73nciu”,
);

Here, we can see three tokens.

We should surround each token with double quotes and end with a comma.

Once done, we save the changes and close config.inc.php file.


d. Copy Apache Config File

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


e. 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


2. On Ubuntu

Ubuntu 16/17/18 requires the php-xml module to be installed:

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

a. Download 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

b. Copy Files

We will create the /usr/local/nrdp directory 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

c. Define Tokens

We can define different tokens for each client. This allows us to revoke access at a later date by removing it. But it also adds an extra level of administration.

Here, we will edit the config.inc.php file and define the token(s):

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

For exampe,

$cfg[‘authorized_tokens’] = array(
“cda35gtdfu72”,
“90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53”,
“+23rf==34m12n-v73nciu”,
);

Eventually, we save the changes and close config.inc.php file.


d. Copy Apache Config File

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

e. 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


3. On Debian

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

# su

From this point, all commands will be as root.


Debian requires the php-xml module:

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

a. Download 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

b. Copy Files

Then we proceed to create the /usr/local/nrdp directory:

# 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

c. Define Tokens

We edit the config.inc.php file and define the token(s):

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

For example,

$cfg[‘authorized_tokens’] = array(
“cda35gtdfu72”,
“90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53”,
“+23rf==34m12n-v73nciu”,
);

Each token surrounds by double quotes and ends with a comma.

Then, we save the changes and close config.inc.php file.


d. Copy Apache Config File

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

e. Restart Apache Web Server

Debian 7.x

# service apache2 restart

Debian 8.x/9.x

# systemctl restart apache2.service


4. On Fedora

Here, we need to install the php-xml and php-json module:

# dnf install -y php-xml php-json

a. Download 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

b. Copy Files

Then we create the /usr/local/nrdp directory:

# 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

c. Define Tokens

We define the token(s) in the config.inc.php file:

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

For example,

$cfg[‘authorized_tokens’] = array(
“cda35gtdfu72”,
“90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53”,
“+23rf==34m12n-v73nciu”,
);

We surround each token with double quotes and end with a comma.

Once we add, we save the changes and close the config.inc.php file.


d. Copy Apache Config File

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

e. Restart Apache Web Server

# systemctl restart httpd.service


5. On FreeBSD

a. Download 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


b. Copy Files

Then we create the /usr/local/nrdp directory:

# 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


c. Define Tokens

We edit the config.inc.php file and define the token(s) we want to use:

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

For example,

$cfg[‘authorized_tokens’] = array(
“cda35gtdfu72”,
“90dfs7jwncsd908fng8fhgb54ynq690xc9vt8uw9ty53”,
“+23rf==34m12n-v73nciu”,
);

Eventually, we save the changes and close config.inc.php file.


d. Copy Apache Config File

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

e. Restart Apache Web Server

# service apache24 restart


How to Test NRDP ?

NRDP is now running. To confirm this, we can open the NRDP Web Interface.

Point the web browser to the IP address or FQDN of our NRDP server, for example:

http://10.25.5.143/nrdp
http://xyz.domain.local/nrdp

Then, we will see the Nagios Remote Data Processor screen.

To test that it is working, we submit a passive check result. 

It populates the Token field and defines both a host and service passive check result. Then we click the Submit JSON Check Result button.

If successful, the browser will display an OK under the Submit JSON Check Result button.

In addition, we will 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

We can expect this error because the somehost host does not actually exist in the Nagios configs. 

So Nagios will record this in the log file.

On the other hand, if the configs exist, then we will this reflected in the Nagios Core GUI.


[Need urgent help with NRDP installation? We'd be happy to assist. ]


Conclusion

This article covers how to install NRDP from the 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.