Friday, November 2, 2012

Nagios Remote Data Sender

http://beginlinux.com/server/nagios/nagios-remote-data-sender


NRDS, Nagios Remote Data Sender, is a component of Nagios XI that provides a passive method of communication. The unique aspect of NRDS is that on the Nagios server the administrator can design and build the configuration for multiple operating systems and then deploy those configurations with the plugins to the client.

Advantages of NRDS:
Passive Monitoring
Passive monitoring allows for considerable savings of resources on the Nagios server as the check management and check execution all occur on the client. The client uses cron or a similar tool to determine how often the check occurs on the client. The check then executes locally on the client and is sent to the Nagios server which processes the information and places it in the web interface.
Central Management
The configuration, in other words what checks will occur and the options they represent will all be created on the Nagios XI server using the interface provided. This provides a central location to manage these configurations and provides a way to create template configurations that could be used on multiple machines.

Configuration Templates
Configurations can be used by multiple hosts so that it provides a way to create templates saving on the time and testing for configurations which are similar. For example, if you create Windows metrics which for a Windows 2008 r2 machine, those settings can be saved and used by hundreds of machines which fit that configuration.

Client Call-In
Another advantage is that when the client sends information to Nagios, it also checks to see if there is a new configuration for the client, if there is it pulls it down and implements the new configuration allowing the administrator to add and subtract services checks in the configuration.

Plugin Implementation
When a configuration is created on the Nagios XI server, the configuration contains the necessary plugins that need to be implemented. In addition, if the client checks in and finds a new configuration that requires new plugins the client will download the newly required plugins.

Firewalls
A distinct advantage is that those machines behind a firewall will not have to have the firewall altered as they will be sending information to Nagios, Nagios will not be directly contacting the client. Often, passive checks make the most sense as it limits the firewall issues.
The advantages of NRDS are considerable and they solve many of the issues that administrators are looking to make easier. However, there are some disadvantages that must be considered.


Disadvantage of NRDS:
Passive Checks Depend on the Client
The nature of passive checks means that the timing, implementation and integrity of the checks are dependent upon the client. In other words, because Nagios depends on the client to send the check information, if no check information is delivered, Nagios does not know why and does not alert. Now this problem can be resolved by creating an active check from Nagios that determines if check information is arriving on time. This type of check is called a freshness check, so that Nagios can determine if checks are arriving within a legitimate period of time. One freshness check would be sufficient to manage this disadvantage. Typically you do not want to run more than one freshness check as this is the same as an active check and the assumption is that you want to save on resources if you are using NRDS.


NRDS Configuration

Nagios XI 2012 provides easy access to using this tool. Go to Admin/NRDS to start with your configuration.
Nagios NRDS

The first step with NRDS is to select the link to the NRDP server and create and update the token. You may be required to enter a password for NSCA in the process.

Nagios NRDS

Once this is set return to the NRDS link and start with creating a configuration. In this example the operating system Linux was chosen.


NRDS: Linux

Nagios NRDS
In the next step there are a number of sections to configure. The first section provides a way to name the configuration and to set the host name. Note the token that you set previously should be listed here.
Nagios NRDS

The second section provides access to create commands for metrics that you want to implement. Note the format of the commands are like NRPE.
Nagios NRDS
The last section allows you to save and apply the settings.
Nagios NRDS
Once you save the instructions for install on the client can be accessed by clicking on the second option under “Actions”.
Nagios NRDS

wget -O Centos_metrics.tar.gz "http://192.168.5.184/nrdp/?cmd=nrdsgetclient&token=test_token&configname=Centos_metrics"


tar zxvf Centos_metrics.tar.gz
cd clients


When you install you will need to enter the hostname of the server and the time interval for checks.
./installnrds centos 45
nagios group already exists.
nagios user already exists.
Installing NRDS Client
Adding cron jobs for centos at a 45 minute interval
no crontab for nagios
Crontabs installed OK
Updating config and plugins
Updated config to version 0.1 Updated 5 plugins
Installation complete



Once you have the install complete you will see the checks listed in Nagios with the host you selected.
Nagios NRDS

If you do not see the checks listed be sure to check Admin/Unconfigured Objects. It may look something like this:
Nagios NRDS
Select the blue arrow to configure each of these checks using the Wizard.
Nagios NRDS
Select the next step and then Finish and it should install your checks.
Nagios NRDS

Remember that NRDS is passive so until the checks complete the first round, you will see the checks pending.
Nagios NRDS

On the client if you go to /usr/local/nrdp/clients/nrds you will see the nrds.cfg file that was created.

CONFIG_VERSION="0.1"
CONFIG_OS="Linux"
CONFIG_NAME="Centos_metrics"
URL="http://192.168.5.184/nrdp/"
TOKEN="test_token"
HOSTNAME="centos"
PLUGIN_DIR="/usr/local/nagios/libexec"
SEND_NRDP="/usr/local/nrdp/clients/send_nrdp.sh"
TMPDIR="/usr/local/nrdp/clients/tmp"
COMMAND_PREFIX=""
LOG_FILE=""
UPDATE_CONFIG="1"
UPDATE_PLUGINS="1"


command[__HOST__]=/usr/local/nagios/libexec/check_ping -H localhost -w 200.0,40% -c 400.0,80% -p 1
command[Check Users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[Check Load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[Check Disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[Check Zombie Procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[Check Total Procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200


If you become the nagios user on the client, then view cronjobs.
su – nagios
crontab -l
*/45 * * * * /usr/local/nrdp/clients/nrds/nrds.pl -H centos 2>&1

If you make changes to the configuration you will see it update the config files as it checks in. Here is an example that shows the output version once the configuration is updated.
Sent 6 checks to http://192.168.5.99/nrdp/
Updated config to version 0.3
Updated 5 plugins

No comments:

Post a Comment