NRPE stand for Nagios Remote Plugin Executor, Which nagios’s agent and allow to monitoring nagios’s client machine services and applications like Apache, mysql, redis, solr, Jenkins etc.
- Root permission access.
- Basic knowledge of linux commands.
In this blog we are going to configure nagios remote machine using NRPE plugin uisng ubuntu 16.04 and we must have running nagios server in a same network.
Nagios client side installation and configuration:-
Step 1: Installation of Nagios Plugins
You need login as root user in your nagios’s client machine and need to install required packages by following the commands.
apt install nagios-nrpe-server nagios-plugins -y
Step 2: Nagios server ip configuration on NRPE Agent
To allow nagios server to access the remote machine you need to edit the /etc/nagios/nrpe.cfg file by using given commands.
Add the Nagios servers IP address, separated by comma like below.
Save and exit from the nano editor.
Step 3: Verifying Nagios Checks
To get status of machine CPU, Memory, Disk Spcace, Totoal Process, and more, We need to verify the all pre configure nagios check is working file for that we need to opwn the nrpe.cfg config file using following commands and check the nrpe commands.
to check monitoring check you need to move
/usr/lib/nagios/plugins/ and test some nrpe commands by following the command.
./check_procs -w 200 -c 250
here w for warning and c for critical status for nagios alerts and after execute the commands you will get output of the checks like that.
PROCS OK: 190 processes | procs=189;200;250;0;
After that you need to restart the nrpe service and enable nrpe service on boot.
systemctl restart nagios-nrpe-server
systemctl enable nagios-nrpe-server
ufw allow 5666/tcp
Your client side nagios host configuration is completed.
Step 4: Server-side nagios configuration for remote machine
Login to your nagios-server with root privileges and edit the nagios main config file located in
/usr/local/nagios/etc/nagios.cfg and add the nagios-client server directory or uncomment it.
and uncommet the following lines.
You need to create a configuration directory.
Step 5: Configure Nagios Server
Now it’s time to configure the Nagios server to monitor the remote client machine, and You’ll need to create a command definition in Nagios object configuration file to use the
check_nrpe plugin. Open the commands.cfg file.
Paste the follwoing configuration.
# .check_nrpe. command definition
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
Save and exit.
Step 6: Configure remote nagios client
Open the configuration file.
Paste the following configurtion.
alias Linux Servers
service_description SWAP Uasge
service_description Root / Partition
service_description Current Users
service_description Total Processes
service_description Current Load
Save and exit from nano editor.
Step 6: Verify Nagios for any errors
Execute the follwing command check error with nagios.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Step 7: Restart the Nagios server
To get new changes we need to restart the nagios server by using the following command.
systemctl restart nagios
Now open the browser with http://localhost/nagios and you should get this screen.
Now nagios nrpe client is successful configured.