Nagios is the most popular infrastructure monitoring server on internet. You can use our tutorial to install Nagios on RHEL based systems or Debian systems. You need to install NRPE on all remote Linux systems to monitor with Nagios.
NRPE is known as Nagios Remote Plugin Executor. The NRPE add-on is designed to execute plugins on remote Nix systems. In this setup, NRPE daemon is installed on the remote system to which services need to monitor through Nagios server. NRPE runs as a daemon on remote systems and waits for Nagios requests. When Nagios server needs to check the status of any resources or applications to that remote host, sends and commands signal, which command definition is stored on NRPE service. NRPE takes Nagios server request and execute the command on the local system and sends the result back to Nagios.
This article will help you to install NRPE service on your Linux system and add a host in Nagios server for monitoring.
Step 1 – Configure NRPE on Linux Host
Follow the below steps to install and configure NRPE on client machine and check connectivity with Nagios server.
Step 1.1 – Install NRPE
Firstly we would require installing nrpe service on remote Linux system, which we need to monitor through Nagios server.
On CentOS/RHEL/Fedora
# yum install nrpe nagios-plugins*
On Debian/Ubuntu/LinuxMint
$ sudo apt-get install nagios-nrpe-server nagios-plugins
Step 1.2 – Configure NRPE
After successfully installing NRPE service, Edit nrpe configuration file /etc/nagios/nrpe.cfg in your favorite editor and add your nagios service ip in allowed hosts.
# vim /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1, 192.168.1.100
Where 192.168.1.100 is your Nagios server ip address.
After making above changes in nrpe configuration file, Lets restart NRPE service as per your system
# service nrpe restart# On CentOS/RHEL/Fedora $ sudo /etc/init.d/nagios-nrpe-server restart# On Debian/Ubuntu/LinuxMint
Step 1.3 – Verify Connectivity from Nagios
Now run the below command from Nagios server to make sure your nagios is able to connect nrpe client on remote Linux system. Here 192.168.1.11 is your remote Linux system ip.
# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.11 NRPE v2.15
Step 2 – Add Linux Host in Nagios
We recommend using NagiosQL3 web interface for managing configuration of Nagios server. Below steps is for CLI lovers. To add a host in your Nagios server from command line.
First create a configuration file
# vim /usr/local/nagios/etc/servers/MyLinuxHost001.cfg
######################################################### # Linux Host 001 configuration file ######################################################### define host { use linux-server host_name Linux_Host_001 alias Linux Host 001 address 192.168.1.11 register 1 } define service{ host_name Linux_Host_001 service_description PING check_command check_ping!100.0,20%!500.0,60% max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } ######################################################### # END OF FILE #########################################################
Now verify configuration files using following command. If there are no errors found in configuration, restart nagios service.
# nagios -v /usr/local/nagios/etc/nagios.cfg # service nagios restart
Step 3 – Check Host in Nagios Web Interface
Open your Nagios web interface and check for new Linux hosts added in Nagios core service. In my case, it looks like below.
is it possible if nrpe pkg vary both end remote host and nagios server.
HI Rahul,
i need realtime examples for how to monitor the servers and services in nagios.
HI Rahul,
i have added hosts in my nagios config but has not configured nrpe in any remote hosts…although i can c the hosts added in my nagios server but nagios not showing it correctly. Even when my hosts is down it is showing as up…is this the reason that i have not configured nrpe in my remote host?? please reply at the earliest.
Hi Prateek,
check_ping does not require nrpe on the remote system. Check ping will return OK only if remote system IP ping successfully.
Hi Rahul,
I am trying to configure multiple windows host as nagios monitoring it is not allowing . Please suggest on this
Is nrpe running under secure layer, Nagios, and NRPE communication is encrypted?
Hi!
Thanks for your tutorial, but why i can’t find the “check_nrpe”? I’m using Ubuntu Server 14.04 btw
Hope you can explain why ASAP
Thanks!
HI,
Check_nrpe command will be found on Nagios server. This command is part of nagios-nrpe-plugin package. Install it on your Nagios server.
i have downloaded nrpe pkg and installed it. so how can i restart it.
[[email protected] ~]# service nrpe restart
nrpe: unrecognized service
Hello Brother,
My question is : How to add icon/image in front of host or services on nagios portal.
for example i have one host in nagios it is Windows 2008 i want to keep icon/image of M.S.Windows in front of host on nagios portal so that i can recognize easily.
how to do this process through nagios configurations ?
Thank you very much in advance.
[email protected]
-Jonus Joseph
Hi Joseph,
Edit you host configuration file and add below line under define host section.
define host {
——–
——–
icon_image windowsserver.png
}
Now update an icon image at DOCUMENTROOT/images/logos/ directory with name windowsserver.png. change DOCUMENTROOT with path of your nagios html directory.
I hope this will help you.