Nagios在发送通知邮件时不稳定的行为

我有一个非常艰难的时间设置nagios3做我想要的。 太多的configuration文件,并不能确定问题的确切位置。

首先,通知是closures主机和关键服务,然后我想configuration它,所以它也发送通知恢复,现在它只发送,但不是所有的东西。

我想configuration它的方式是这样的,它使用通用服务作为模板,然后configuration额外的细节,如果我需要,但它不是玩球,这里是我的configuration文件看看你是否看到任何错误:

我想要的是简单的。 当主机closures,服务关键时,以及恢复时发送电子邮件 – 就是这样!

—-文件contacts.cfg —

define contact{ contact_name admin alias administrator service_notification_period 24x7 host_notification_period 24x7 service_notification_options u,c,r host_notification_options d,u,r service_notification_commands notify-service-by-email host_notification_commands notify-host-by-email email [email protected] } define contactgroup{ contactgroup_name admins alias Nagios Administrators members admin } 

——————— EOF ———-

——文件generic-service.cfg ———

 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 ; Active service checks should be parallelized (disabling this can lead to major performance problems) obsess_over_service 1 ; We should obsess over this service (if necessary) 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 failure_prediction_enabled 1 ; Failure prediction 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_interval 0 ; Only send notifications on status change by default. is_volatile 0 check_period 24x7 normal_check_interval 1 retry_check_interval 1 max_check_attempts 4 notification_period 24x7 notification_options w,u,c,r contact_groups admins register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE! } 

————— EOF ——–

—- generic-host.cfg文件—-

 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 failure_prediction_enabled 1 ; Failure prediction 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 # check_command check-host-alive check_command check_tcp_alive max_check_attempts 10 notification_interval 0 notification_period 24x7 notification_options d,u,r contact_groups admins register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! } 

—-从servicegroups.cfg中摘录—–

 define service { hostgroup_name Live, inhouse service_description USERS check_command check_nrpe_1arg!check_users use generic-service normal_check_interval 10 retry_check_interval 10 contact_groups admins notification_interval 0 ; set > 0 if you want to be renotified } # check the LOAD define service { hostgroup_name Live, inhouse service_description LOAD check_command check_nrpe_1arg!check_load use generic-service normal_check_interval 5 retry_check_interval 1 notification_interval 0 ; set > 0 if you want to be renotified } # check the HDD define service { hostgroup_name Live, inhouse service_description HDD check_command check_nrpe_1arg!check_all_disks use generic-service normal_check_interval 600 retry_check_interval 30 notification_interval 0 ; set > 0 if you want to be renotified } 

—– —– EOF

—摘自Hostgroups.cfg —-

 define hostgroup { hostgroup_name http-servers alias HTTP servers members * } 

—- EOF —–

你的configuration对我来说似乎有点不对劲。 如果检查不正确,那么Nagios将会重新检查每个'retry_check_interval'(每次重试之间的时间)X'max_check_attempts'(连续失败的次数), 然后它会发送一个警告事件中断。 在“硬盘”检查的原因中,这意味着硬盘需要在2小时内处于非正常状态, 才能收到通知。 如果在满足上述条件之前支票应该返回到OK状态,则不会发送失败的通知。 但是,您将收到恢复通知。 这很可能会发生在'LOAD'检查上,即使是更小的retry_check_interval也是如此,因为系统的使用往往是非常dynamic的。

此外,我不相信设置通知间隔为'0' – 我觉得这是一个非常糟糕的做法,导致警报被遗漏,特别是在generic-*模板上。 我在60分钟的时间内将模板放在模板上,然后在那些我不想经常听到的检查中用240分钟。

你还应该再次检查'hostgroup.cfg'文件。 您在您的检查中定义的主机组没有列在您的示例的主机组configuration文件中。

在Nagios 3及以上版本中:

'retry_check_interval'更改为'retry_interval'

“normal_check_interval”更改为“check_interval”

这就是说,为了向后兼容老版本的configuration文件,所有四个仍然支持 – 即使在Nagios版本4。