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

  1. define host{
  2. use linux-server,host-pnp
  3. host_name lavida
  4. alias apply
  5. address 192.168.1.2
  6. check_command check-host-alive
  7. max_check_attempts 5
  8. check_period 24x7
  9. contact_groups admins
  10. notification_interval 60 #正常报警频率改成60分钟
  11. notification_period 24x7
  12. notification_options d,u,r
  13. }
  14.  
  15. #第三次到第五次报警频率为120分钟
  16. define hostescalation{
  17. host_name lavida
  18. first_notification 3
  19. last_notification 5
  20. notification_interval 120
  21. contact_groups admins
  22. }
  23. #第6次以后为240分钟一次
  24. define hostescalation{
  25. host_name lavida
  26. first_notification 6 #第六次
  27. last_notification 0 #不限次数
  28. notification_interval 240 #4小时,也可以改小成10分钟等
  29. contact_groups admins #可以增加组如:admins,managers
  30. }

3.检查nagios配置

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

4.重启nagios

  1. service nagios reload

针对service的定义方法

  1. define serviceescalation{
  2. host_name lavida
  3.         service_description             Root Partition
  4. first_notification 6
  5. last_notification 0
  6. notification_interval 240
  7. contact_groups admins
  8. }

参考:
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.