Nagios NRPE monitoringThe procedure for a remote host is as follows.
Install nrpe on the invigilator
Wget http://nchc.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
Tar zxvf nrpe-2.12.tar.gz
Cd nrpe-2.12
./Configure -- prefix =/usr/local/nagios
Make all
Make install-plugin
# Install the supervisor in this step
Add a user to the monitored Machine
Groupadd nagios
Useradd-g nagios-d/usr/local/nagios-s/sbin/nologin nagios
Install plugin on the monitored Machine
Wget http://nchc.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
Tar zxf nagios-plugins-1.4.13.tar.gz
Cd nagios-plugins-1.4.13
. /Configure -- with-nagios-user = nagios -- with-nagios-group = nagios -- prefix =/usr/local/nagios -- with-ping-command = "/bin/ping" -- with-mysql =/opt/mysql
Make
Make install
# Check whether the playback file has been installed in this directory
Ls/usr/local/nagios/libexec
NRPE installed on the monitored Machine
Wget http://nchc.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
Tar zxvf nrpe-2.12.tar.gz
Cd nrpe-2.12
./Configure -- prefix =/usr/local/nagios
Make all
Make install-plugin
Make install-daemon
Make install-daemon-config
Chown-R nagios: nagios/usr/local/nagios
Configure NRPE:
Vi/usr/local/nagios/etc/nrpe. cfg
Allowed_hosts = 127.0.0.1, 192.168.1.91
# Nagios monitoring host address or domain name
Modify/etc/hosts. allow to add the ip address of the invigilator.
Echo 'nrpe: 192.168.1.91 '>/etc/hosts. allow
Start the NRPE daemon:
/Usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe. cfg-d
You can add this command to/etc/rc. local to enable automatic startup upon startup.
Echo "/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe. cfg-d">/etc/rc. local
Check whether NRPE is normal:
On the monitored Machine
/Usr/local/nagios/libexec/check_nrpe-H 127.0.0.1
View the corresponding port: netstat-an | grep 5666
Enable Firewall 5666 to allow lan ip addresses or fixed IP addresses to connect
On the monitoring host
/Usr/local/nagios/libexec/check_nrpe-H $ target host address
Both should be able to output the NRPE version: NRPE v2.12
Check monitored services
In the nrpe. cfg file of the monitored end, you can see the following Configuration:
Command [check_load] =/usr/local/nagios/libexec/check_load-w 15,10, 5-c 30,25, 20
This is used to check the CPU load.
Use the following command to customize parameters:
Command [check_load] =/usr/local/nagios/libexec/check_load-w $ ARG1 $-c $ ARG2 $
And enable dont_blame_nrpe = 1
Enabling parameters poses certain security risks.
Restart nrpe
Ps aux | grep nrpe
Kill $ pid
/Usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe. cfg-d