The NRPE addon is designed to allow you to execute Nagios plugins on remote Linux/Unix machines. The main reason for doing this is to allow Nagios to monitor "local" resources (like CPU load, memory usage, etc.) on remote machines. Since these public resources are not usually exposed to external machines, an agent like NRPE must be installed on the remote Linux/Unix machines.
Need personal assistance on Nagios? Please contact me at immukesh72@gmail.comat very nominal charges |
---|
Note: It is possible to execute Nagios plugins on remote Linux/Unix machines through SSH. There is a check_by_ssh plugin that allows you to do this. Using SSH is more secure than the NRPE addon, but it also imposes a larger (CPU) overhead on both the monitoring and remote machines. This can become an issue when you start monitoring hundreds or thousands of machines. It is useful to use NRPE to lower load on monitoring and remote host as well.
As showing in above image the NRPE addon consists of two pieces:
– The check_nrpe plugin, which resides on the local monitoring machine.
– The NRPE daemon, which runs on the remote Linux/Unix machine.
Step 1. Install NRPE and Nagios Plugins
NRPE is available under default apt repositories of Ubuntu systems. Execute the following command to install it
$ sudo apt-get install nagios-nrpe-server nagios-plugins nagios-plugins-basic nagios-plugins-standard
Step 2. Configure NRPE
Edit the /etc/nagios/nrpe.cfg file and in allowed_hosts give the ip address of Nagios monitoring Server from which monitoring will be done. For example nagios monitoring host server ip is 192.168.182.130, then add this IP address to allowed_hosts list.
allowed_hosts=127.0.0.1,192.168.182.130
Step 3. Restart the NRPE service
Restart the nrpe service in client machine with following command.
$ sudo /etc/init.d/nagios-nrpe-server restart
Step 4. Install nagios-nrpe-plugin package in your nagios monitoring server. Run the following command to install the check_nrpe plugin on your Nagios server. It will install check_nrpe plugin under /usr/lib/nagios/plugins/.
$ sudo apt-get install nagios-nrpe-plugin
Step 5. Verification
Now login to the nagios server and sudo nagios user. To verify if nagios are able to communicate with nrpe agent in client machine run check_nrpe plugin by passing client machine IP address ( In my case client machine IP is 192.168.182.131 )as following. If you are not able to find check_nrpe plugin please follow the setp 4 to install check_nrpe plugin.
nagios@ubuntu:~$ /usr/lib/nagios/plugins/check_nrpe -H 192.168.182.131
NRPE v2.12
NRPE v2.12
The output "NRPE v2.12" shows that the nagios server was successfully communicating with NRPE agent.
Step 6. Add nagios check command in NRPE
By defaults all nagios installed in /usr/lib/nagios/plugins/ directory. You can add new service check as per your requirements in /etc/nagios/nrpe.cfg. Folloing are the default check commans in nrpe.cfg file.
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
Step 7. Start/Stop/Restart NRPE service
Each time when we make change into the configuration file which are in client machine that time we need to restart the nrpe srevice.
$ sudo /etc/init.d/nagios-nrpe-server stop
$ sudo /etc/init.d/nagios-nrpe-server start
$ sudo /etc/init.d/nagios-nrpe-server restart
$ sudo /etc/init.d/nagios-nrpe-server start
$ sudo /etc/init.d/nagios-nrpe-server restart
Need personal assistance on Nagios? Please contact me at immukesh72@gmail.comat very nominal charges |
---|
default NRPE port is 5666
ReplyDelete