The experiment was conducted in the context of the previous experiment: Nagios Network Monitoring (1)--monitor the native running state and the MYSQ host
Required Package: nagios-plugins-2.1.1.tar.gz
Nrpe-2.15.tar.gz
Server side: server1.example.com 172.25.254.1
New monitoring end: Server2.example.com 172.25.254.2
Experimental Prerequisites:
/etc/init.d/httpd start
/etc/init.d/nagios start
/etc/init.d/mysqld start# #如果启不开的化, cd/var/lib/mysql/, then, RM-RF mysql.sock restart
Chkconfig httpd on
Chkconfig mysqld on
Browser login 172.25.38.6/nagios View service status
1. New monitoring terminal configuration (Server2)
1.1. Tar zxf nrpe-2.15.tar.gz
Tar zxf nagios-plugins-2.1.1.tar.gz #nagios plug-in installation
CD nagios-plugins-2.1.1
Yum Install gcc-y openssl-devel mysql-devel
Useradd-m-d/usr/local/nagios Nagios # #id号不规定一定是要900, because the server is set to 900, so the unification is considered better
1.2./configure--with-nagios-user=nagios--with-nagios-group=nagios
Make
Make install
1.3 Chown Nagios.nagios/usr/local/nagios
Chown-r nagios.nagios/usr/local/nagios/libexec
Yum Install xinetd
1.4 CD nrpe-2.15
./configure
Make all
Make Install-plugin
Make Install-daemon
Make Install-daemon-config
Make install-xinetd
cd/etc/xinetd.d/
1.5 Vim Nrpe
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/89/5E/wKiom1gQrjuSfi2xAADCxbOks6k559.png "title=" Picture 1.png "Width=" "height=" 275 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:275px; "alt=" Wkiom1gqrjusfi2xaadcxboks6k559.png "/>
#nrpe Service Listening Port
1.6 Vim/etc/services
Join
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/89/5B/wKioL1gQrlCwOt_8AAANlRfSfOw637.png "title=" Picture 2.png "alt=" Wkiol1gqrlcwot_8aaanlrfsfow637.png "/>
1.7 CD. /etc/
vim nrpe.cfg 650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M02/89/5B/wKioL1gQrl-QtWqjAADj-Jj3 Jdi642.png "title=" image 3.png "alt=" Wkiol1gqrl-qtwqjaadj-jj3jdi642.png "/>
#根分区监测
/etc/init.d/xinetd start
1.8 cd/usr/local/nagios/libexec/
SCP Check_nrpe [Email protected]:/usr/local/nagios/libexec/
2. Server-side configuration (SERVER1)
2.1 [[email protected] libexec]# ll Check_nrpe
-rwxr-xr-x 1 root root 76769 Jul 10:02 Check_nrpe
[Email protected] libexec]# chown nagios:nagios Check_nrpe# #更改脚本权限为nagios所有
[email protected] libexec]# ll Check_nrpe
-rwxr-xr-x 1 nagios nagios 76769 Jul 10:02 Check_nrpe
2.2 [[email protected] libexec]#./check_nrpe-h 172.25.254.2-c check_disk# #执行脚本
DISK ok-free Space:/5333 MB (83% inode=92%); |/=1086mb;5410;6086;0;6763
[Email protected] libexec]#/check_nrpe-h 172.25.254.2-c check_load# #执行脚本
Ok-load average:0.00, 0.00, 0.00|load1=0.000;15.000;30.000;0; load5=0.000;10.000;25.000;0; load15=0.000;5.000;20.000;0;
2.3 cd/usr/local/nagios/etc/objects/
Vim Commands.cfg
*****************************************************************************************
218 # ' Check_nrpe ' command definition
219 Define Command{
Command_name Check_nrpe
221 command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$
222
}
****************************************************************************************
Vim Services.cfg
*****************************************************************************************************
117 ########## #check_nrpe ############################
118 Define Service{
119 Use Local-service
HOST_NAME server2.example.com
121 Service_description Root Partition
122 Check_command Check_nrpe!check_disk
123}
124
125
126 Define Service{
127 Use Local-service
HOST_NAME server2.example.com
129 service_description Number of logged-in users
Check_command check_nrpe!check_users
131}
*******************************************************************************************************
2.4/etc/init.d/nagios Reload
This article from the "Technology life, Simple not simple" blog, please be sure to keep this source http://willis.blog.51cto.com/11907152/1866092
Nagios Network Monitoring (2)--nagios+nrpe monitor other hosts