How to monitor a remote Linux host using Nagios?
Installing NRPE via Yum on Remote Linux client
Now we need to configure Remote linux client. I am using Dag’s repo (rpmforge) for installation via yum.
Download Dag’s repo:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
Details of Dag’s repo can be found at http://dag.wieers.com/rpm/FAQ.php#B
Installing NRPE
[you@you-remoter-machine /] yum install nrpe
Setup NRPE to run as daemon (i.e as part of xinetd):
[you@you-remoter-machine /] vi /etc/xinetd.d/nrpe
# default: off
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
type = UNLISTED
port = 5666
socket_type = stream
wait = no
user = nagios
group = nagios
server = /usr/sbin/nrpe
server_args = -c /etc/nagios/nrpe.cfg –inetd
log_on_failure += USERID
disable = yes
only_from = 127.0.0.1, X.X.X.X # Your Nagios server ip
Save the file and exit. Now restart Xinetd
[you@you-remoter-machine /] service xinetd restart
IPTABLES setting if applicable.
[you@you-remoter-machine /] iptables -A INPUT -p tcp –dport 5666 -s -j ACCEPT
[you@you-remoter-machine /] iptables-save -c
Modify the nrpe.cfg on remote linux client:
Make sure that you have added the ip of your Nagios server in allowed_hosts parameter. You may not need to change as the default setting will work for you.
[you@you-remoter-machine /] vi /etc/nagios/nrpe.cfg
———————————-
#…. Output omitted
———————————–
# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client’s IP
# address. I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
#allowed_hosts=127.0.0.1,192.168.0.2
allowed_hosts=X.X.X.X # Nagios Server IP
Verifying the remote host connectivity with Nagios Server
Lets verify whether nagios monitoring server can talk to the remotehost.
[you@yourmachine objects] /usr/lib/nagios/plugins/check_nrpe -H
NRPE v2.12
References
- http://www.nagios.org
- http://www.nagios.org/about/
- http://support.nagios.com/knowledgebase
- http://exchange.nagios.org/