-
在 Client 端主機上,利用 yum 進行 EPEL 套件安裝升級:
#yum udpate epel-release
-
在 Client 端主機上,安裝 NRPE 與 Plugin 套件:
#yum install nrpe nagios-plugins-*
-
在 Client 端主機上,編寫相關 NRPE 的設定檔:
# vim /etc/nagios/nrpe.cfg
(增加下列設定:)
allowed_hosts=127.0.0.1,192.168.100.250
dont_blame_nrpe=1
command[check_users]=/usr/lib64/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/lib64/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
-
在 Client 端主機上,起動 NRPE :
#systemctl enable nrpe
#systemctl start nrpe
-
在 Client 端主機上,打開防火牆設定:
#firewall-cmd --add-port=5666/tcp --permanent
#firewall-cmd --reload
-
在 Server 端主機上,安裝 Nagios 的 NRPE Plugin 套件:
#yum install nagios-plugins-nrpe
-
在 Server 端主機上,修改 Nagios 相關設定:
#vim /etc/nagios/objects/commands.cfg
(在檔尾加入下列設定:)
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
-
在 Server 端主機上,編寫被監控端的監控設定:
#vim /etc/nagios/conf.d/node01.cfg
define host{
use linux-server
host_name node01
alias node01
address 192.168.100.1
}
define service{
use generic-service
host_name node01
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
define service{
use generic-service
host_name node01
service_description Root Partition
check_command check_nrpe!check_disk\!20%\!10%\!/
}
define service{
use generic-service
host_name node01
service_description Current Users
check_command check_nrpe!check_users\!20\!50
}
define service{
use generic-service
host_name node01
service_description Total Processes
check_command check_nrpe!check_procs\!250\!400\!RSZDT
}
define service{
use generic-service
host_name node01
service_description Current Load
check_command check_nrpe!check_load\!5.0,4.0,3.0\!10.0,6.0,4.0
}
-
在 Server 端主機上,重新起動 Nagios :
#systemctl restart nagios