我的三台服务器从星期五21:50到星期五5:30停机。 所以我在timeperiod.cfg中configuration了以下时间段:
define timeperiod{ timeperiod_name 24x7_without_exclude_hours_for_AZE alias 24x7 without 21:50 for friday to 5:30 for saturday sunday 00:00-24:00 monday 00:00-24:00 tuesday 00:00-24:00 wednesday 00:00-24:00 thursday 00:00-24:00 friday 00:00-21:50 saturday 05:30-24:00 }
然后在template.cfg文件中为这三个服务器创build一个:
define host{ name windows-server-AZE ; The name of this host template use generic-host ; Inherit default values from the gene$ check_period 24x7_without_exclude_hours_for_AZE ; By def$ check_interval 5 ; Actively check the server every 5 mi$ retry_interval 1 ; Schedule host check retries at 1 min$ max_check_attempts 10 ; Check each server 10 times (max) check_command check-host-alive ; Default command to check if $ notification_period 24x7_without_exclude_hours_for_AZE ; Send n$ notification_interval 1440 ; Resend notifications every 24 hours notification_options d,r ; Only send notifications for specific$ contact_groups admins ; Notifications get sent to the admins$ hostgroups windows-servers ; Host groups that Windows servers sho$ register 0 ; DONT REGISTER THIS - ITS JUST A TEMP$ }
最后在这3个服务器configuration中我设置了:
define host{ use windows-server-AZE ; Inherit default values fro$ host_name ServerAZE1 ; The name we're giving to t$ alias Server AZE 1 ; A longer name associated $ address XXX.XXX.XXX.XXX ; IP address of the host }
但每个星期五晚上22:00,我收到了很多邮件,比如说服务器AZE 1 CPU负载很重要,因为服务器无法在其IP和端口上访问。
难道我做错了什么 ?
首先请注意,* _period更改与Nagios中的“计划停机时间”不同。
你的问题是你只在主机上设置* _period,而不是在服务上。
所以你的主机检查将不会运行,并在排除的时间通知,但所有的服务将仍然运行在默认的时间段。