【发布时间】:2020-10-10 15:10:16
【问题描述】:
我有两台主机,它们的主机检查不再起作用(因为 ping 被防火墙阻止),导致 Nagios 发送有关它们的通知并将它们列为 DOWN 并显示为红色。我想暂时禁用对这些主机的主机检查(但不删除它们,或者禁用对它们的服务检查,因为这些工作正常)。最好的方法是什么?
我尝试将它们的定义更改为 use generic-host 而不是 use linux-server。这些模板定义如下:
define host{
name linux-server ; The name of this host template
use generic-host ; This template inherits other values from the generic-host template
check_period 24x7 ; By default, Linux hosts are checked round the clock
check_interval 5 ; Actively check the host every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each Linux host 10 times (max)
check_command check-host-alive ; Default command to check Linux hosts
notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
; Note that the notification_period variable is being overridden from
; the value that is inherited from the generic-host template!
notification_interval 120 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_period 24x7 ; Send host notifications at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
max_check_attempts 1
}
我原以为主机检查会停止,因为 generic-host 没有配置 check_command,但它们会继续(不知道 Nagios 实际运行的是什么命令)并且主机保持状态 DOWN。
我还尝试在主机的定义中添加一个空的 check_command 行,以将 check_command 参数覆盖为空白,Nagios 文档说应该禁用主机检查,但是 Nagios 不接受配置,说“没有名为''的命令”。
我希望 Nagios 停止对这些主机进行主机检查,并将状态返回到 OK/UP。实现这一目标的正确方法是什么?
【问题讨论】:
标签: nagios