Friday, December 3, 2010

Process of add new services to Nagios Monitor


Scenario / Question:

I followed the Tutorial on installing and configuring NRPE, but now I want to monitor more services on the remote server.

Solution / Answer:

You can add services by configuring nrpe.cfg on the remote host and adding a new service definition on the Nagios monitoring server.

Download Service Plugin on Remote Host Server

1. Download the plugin to folder /usr/local/nagios/libexec/
2. Change permissions on plugin to nagios
# cd /usr/local/nagios/libexec/
# chown nagios.nagios check_something
# chmod 775 check_something
3. Test the plugin works
# /usr/local/nagios/libexec/check_something

Edit nrpe.cfg File on Remote Host Server

Add a new command definition to the nrpe.cfg file on the remote host
# vi /usr/local/nagios/etc/nrpe.cfg
Add a new check_something command definition. (replace “check_something” with the actual plugin file name). Also you must define any arguments. Do a “check_something -h” for a plugins arguments.
command[check_something]=/usr/local/nagios/libexec/check_something -t 20 -c 30
Because we are running xinetd we do not need to restart the NRPE daemon. Otherwise you would have to restart the NRPE daemon for the changes to take effect.

Add Service Definition to Nagios Monitoring Server

On the monitoring host, you need to define a new service for check_something on the remote host. Add
the following entry to one of your object configuration files (linux-server-remote.cfg)
define service{
use generic-service
host_name remotehost
service_description Check Something
check_command check_nrpe!check_something
}

Next, verify your Nagios configuration files and restart Nagios.
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

# service nagios restart

No comments:

Post a Comment