【发布时间】:2018-05-22 12:03:03
【问题描述】:
有没有什么方法可以在 Nagios 中使用 NRPE 实现以下场景?
Nagios 盒子将首先检查客户端盒子上的 NRPE 是否启动,如果是,它将检查为该客户端配置的其他服务。如果客户端上的 NRPE 已关闭,它将为 NRPE 发出通知,并将停止检查为该客户端框配置的其余服务,直到 NRPE 出现。
【问题讨论】:
有没有什么方法可以在 Nagios 中使用 NRPE 实现以下场景?
Nagios 盒子将首先检查客户端盒子上的 NRPE 是否启动,如果是,它将检查为该客户端配置的其他服务。如果客户端上的 NRPE 已关闭,它将为 NRPE 发出通知,并将停止检查为该客户端框配置的其余服务,直到 NRPE 出现。
【问题讨论】:
您正在寻找此设置。看看你的nagios.cfg
# DISABLE SERVICE CHECKS WHEN HOST DOWN
# This option will disable all service checks if the host is not in an UP state
#
# While desirable in some environments, enabling this value can distort report
# values as the expected quantity of checks will not have been performed
host_down_disable_service_checks=1
通过check_nrpe 检查您的主机状态。如果没有,请在配置中创建新命令:
define command{
command_name check-host-alive-nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$
}
现在,在你的主机定义中使用这个命令,类似这样:
define host {
host_name your_server
address your_server
use generic-host
check_command check-host-alive-nrpe
}
当远程主机上的 NRPE 由于某些问题停止响应时,该主机将处于 CRITICAL 状态,并且远程检查服务将被暂时禁用。
配置后不要忘记重启 Nagios 服务。
PS:此设置仅适用于 Nagios 4+
【讨论】: