Skip to content


Nagios 定义hostescalation控制报警频率

最近上海移动机房在做调整(调到现在还没搞完…都换了几次IP了),导致nagios服务器不能连通应用服务器。
然后nagios每半小时就给我发短信囧,受不了了

1.hostescalation定义格式;蓝色为可选项

define hostescalation{
  host_name host_name
  hostgroup_name hostgroup_name
  contacts contacts
  contact_groups contactgroup_name
  first_notification #
  last_notification #
  notification_interval #
  escalation_period timeperiod_name
  escalation_options [d,u,r]
    }

2.定义hostescalation将报警频率延长
vi /usr/local/nagios/etc/objects/lavida.cfg

define host{
use linux-server,host-pnp
host_name lavida
alias apply
address 192.168.1.2
check_command check-host-alive
max_check_attempts 5
check_period 24×7
contact_groups admins
notification_interval 60 #正常报警频率改成60分钟
notification_period 24×7
notification_options d,u,r
}

#第三次到第五次报警频率为120分钟
define hostescalation{
host_name lavida
first_notification 3
last_notification 5
notification_interval 120
contact_groups admins
}
#第6次以后为240分钟一次
define hostescalation{
host_name lavida
first_notification 6 #第六次
last_notification 0 #不限次数
notification_interval 240 #4小时,也可以改小成10分钟等
contact_groups admins #可以增加组如:admins,managers
}

3.检查nagios配置

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

4.重启nagios

service nagios reload

针对service的定义方法

define serviceescalation{
host_name lavida
service_description Root Partition
first_notification 6
last_notification 0
notification_interval 240
contact_groups admins
}

参考:
http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#hostescalation
http://nagios.sourceforge.net/docs/3_0/escalations.html

Posted in Nagios, 技术.

Tagged with .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.