Nagios被監(jiān)控端的安裝
Nagios被監(jiān)控端安裝
沒(méi)安裝xinetd的要安裝
- yum -y install xinetd
- yum -y install xinetd
安裝Nagios插件
- ./configure --with-nagios-user=nagios --with-nagios-group=nagios
- make
- make install
- ./configure --with-nagios-user=nagios --with-nagios-group=nagios
- make
- make install
安裝nrpe
- ./configure
- make all
- make install-daemon
- make install-daemon-config
- make install-xinetd
- ./configure
- make all
- make install-daemon
- make install-daemon-config
- make install-xinetd
配置nrpe啟動(dòng)
- vi /etc/xinetd.d/nrpe
- service nrpe
- {
- flags = REUSE
- socket_type = stream
- port = 5666
- wait = no
- user = nagios
- group = nagios
- server = /usr/local/nagios/bin/nrpe
- server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
- log_on_failure += USERID
- disable = no
- only_from = 127.0.0.1 10.3.37.110
- #only_from: allow monit server ip. “ ”ge kai duo ge ip
- }
- vi /etc/xinetd.d/nrpe
- service nrpe
- {
- flags = REUSE
- socket_type = stream
- port = 5666
- wait = no
- user = nagios
- group = nagios
- server = /usr/local/nagios/bin/nrpe
- server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
- log_on_failure += USERID
- disable = no
- only_from = 127.0.0.1 10.3.37.110
- #only_from: allow monit server ip. “ ”ge kai duo ge ip
- }
- vi /etc/services
- vi /etc/services
加入以下:
- nrpe 5666/tcp # nrpe
- nrpe 5666/tcp # nrpe
重啟 xinetd 服務(wù)
- /etc/init.d/xinetd restart
- /etc/init.d/xinetd restart
檢查nrpe是否正常工作
在監(jiān)控端執(zhí)行以下命令,返回版本則成功。
/usr/local/nagios/libexec/check_nrpe -H 被監(jiān)控端ip
NRPE v2.8.1
/usr/local/nagios/libexec/check_nrpe -H 被監(jiān)控端ip
NRPE v2.8.1
配置監(jiān)控命令
- vi /usr/local/nagios/etc/nrpe.cfg
- vi /usr/local/nagios/etc/nrpe.cfg
- # The following examples use hardcoded command arguments...
- ###############
- command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 20
- command[check_load]=/usr/local/nagios/libexec/check_load -w 16,10,8 -c 30,25,20
- command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
- command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
- command[check_sda5]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda5
- command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
- command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 300 -c 360
- command[check_http]=/usr/local/nagios/libexec/check_http -H 10.3.37.110 -u /nagios.php
- command[check_ftp]=/usr/local/nagios/libexec/check_ftp -H 10.3.37.110 -p 21
- command[check_ssh]=/usr/local/nagios/libexec/check_ssh 10.3.37.110
- command[check_alive]=/usr/local/nagios/libexec/check_ping -H 10.3.37.110 -w 100,20% -c 500,60% -p 4
- command[check_105mysql]=/usr/local/nagios/libexec/check_mysql -H 10.3.37.110 -P 3306 -u nagios -p ***
- ##############
- # The following examples use hardcoded command arguments...
- ###############
- command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 20
- command[check_load]=/usr/local/nagios/libexec/check_load -w 16,10,8 -c 30,25,20
- command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
- command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
- command[check_sda5]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda5
- command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
- command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 300 -c 360
- command[check_http]=/usr/local/nagios/libexec/check_http -H 10.3.37.110 -u /nagios.php
- command[check_ftp]=/usr/local/nagios/libexec/check_ftp -H 10.3.37.110 -p 21
- command[check_ssh]=/usr/local/nagios/libexec/check_ssh 10.3.37.110
- command[check_alive]=/usr/local/nagios/libexec/check_ping -H 10.3.37.110 -w 100,20% -c 500,60% -p 4
- command[check_105mysql]=/usr/local/nagios/libexec/check_mysql -H 10.3.37.110 -P 3306 -u nagios -p ***
- ##############
檢查監(jiān)控命令是否生效
在監(jiān)控端執(zhí)行以下命令,返回結(jié)果則成功。
- /usr/local/nagios/libexec/check_nrpe -H被監(jiān)控端ip -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;
【編輯推薦】
【責(zé)任編輯:高圓圓 TEL:(010)68476606】