完成步骤:
在 Nagios 服务器 (CentOS 7) 上
yum install nagios nagios-plugins-all
达到目标(CentOS 7)
yum install nrpe nagios-plugins-all
修改nrpe.cfg
并添加主IP到allowed_hosts
systemctl enable nrpe && systemctl start nrpe
现在我尝试使用 check_nrpe 添加服务检查,因此我定义了主机、联系人、联系人组,然后定义了 check_nrpe 命令
nano /etc/nagios/objects/commands.cfg
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
然后添加了nrpe检查的服务
nano /etc/nagios/objects/services.cfg
define service {
use basic-new-service
name check-load-service
normal_check_interval 3
retry_check_interval 1
notification_interval 30
notification_options w,c,r,u
check_command check_nrpe!check_load
register 0
}
define service {
use check-load-service
service_description SYS_HostLoad
contact_groups Audit
host_name TGT
}
nagios服务启动成功
systemctl enable nagios && systemctl start nagios
我可以验证 check_nrpe 直接从 CLI 返回 Ok 状态
# /usr/lib64/nagios/plugins/check_nrpe -H TGT -c check_load
OK - load average per CPU: 0.00, 0.00, 0.01|load1=0.000;0.150;0.300;0; load5=0.002;0.100;0.250;0; load15=0.008;0.050;0.200;0;
但在仪表板 check_nrpe 检查由于权限而无法成功。 (我已经为nagios:nagios
和 都/etc/nagios
设置了/usr/lib64/nagios/plugins
)它在仪表板上针对此检查显示此错误
(Return code of 13 for service 'SYS_HostLoad' on host 'TGT' was out of bounds)