我有一堆非服务器设备,我想跟踪它们的停机时间,因此我将它们集成到我的 Nagios 集合中(以便我可以生成可用性报告)。但是,如果无法联系到它们,我不希望通过电子邮件收到警报。因此,我对这些机器的条目如下所示:
define host{
host_name Moni_MacBook_Pro
address 10.10.10.27
use generic-host
notifications_enabled 0
}
但是,我仍然收到通知!我怀疑这与模板“genetic-host”包含以下行有关:
check_command check-host-alive
反过来,“通用服务”模板如下所示:
define service{
name generic-service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ;
obsess_over_service 1 ; We should obsess
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service 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
retain_nonstatus_information 1 ; Retain non-status information
is_volatile 0 ; The service is not volatile
check_period 24x7 ;
max_check_attempts 3 ;
normal_check_interval 10 ;
retry_check_interval 2 ; Re-check the service every two minutes
contact_groups admins ; Notifications get sent out to everyone in
notification_options u,c ;
notification_interval 1440 ; Re-notify about service problems every hour
notification_period 24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION
}
我的诊断是,服务模板中的“notification_options u,c”行以某种方式覆盖了我在主机定义中不发送通知的请求。如何才能解决这个问题?
答案1
我认为我已经整理好了。我有以下服务:
#Check that ping-only hosts are up
define service {
hostgroup_name all
service_description PING
check_command check_ping!100.0,20%!500.0,60%
use generic-service
notification_options d,u,r
notification_interval 0
}
这可能是所有垃圾邮件的来源。可能不需要,因为主机定义中的“check_command”也只是一个 ping。我已将此处的“notification_options”更改为“n”(无)。