首先定义 check_ping check_ssh check_http时按照正常流程都没有问题,唯一的区别是ssh的端口我是自定义的,之后更改commands.cfg 添加:
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
然后客户端配置文件追加:
define service{
use generic-service
host_name 192.168.1.201
service_description check_load
check_command check_nrpe!check_load
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service
host_name 192.168.1.201
service_description check_disk_sda1
check_command check_nrpe!check_hda1
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service
host_name 192.168.1.201
service_description check_disk_sda3
check_command check_nrpe!check_hda3
max_check_attempts 5
normal_check_in
对应的客户端文件修改:
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1
command[check_hda3]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda3
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
保存重启后发现问题:
然后我试着使用
/usr/lib/nagios/plugins/check_nrpe -H 192.168.1.201 -c check_ssh 直接连接客户端但是失败了:
connect to address 192.168.1.201 port 5666: Connection refused
connect to host 192.168.1.201 port 5666: Connection refused
端口没有占用,防火墙清空selinux也关闭了但是依然连接不上,很奇怪。
编辑回复