escalation限制Nagios报警次数

用escalations限制Nagios报警次数

整合的飞信之后,如果出现问题未能即使解决的话,那么后果将十分“杯具”,每五分钟你将收到一条报警短信,你的邮箱也会被报警邮件塞满。nagios官方也想到了这个问题,于是他们给出了解决办法,http://nagios.sourceforge.net/docs/3_0/escalations.html,这里是官方的说明,以下是我的做法。

首先编辑contact.cfg,把原有的配置复制一份在下面,变成:
define contact{
        contact_name            nagiosadmin      
        use                           generic-contact  
        alias                          Nagios Admin      
        email                        stcomd@163com ;
        service_notification_commands   notify-service-by-email,service-notify-by-fetion
        host_notification_commands      notify-host-by-email,host-notify-by-fetion
        pager                          13691515****
        }

define contactgroup{
        contactgroup_name         admins
        alias                               Nagios Administrators
        members                        nagiosadmin
        }

define contact{
        contact_name               scomd    
        use                             generic-contact      
        alias                            Nagios Admin      
        email                           stcomd@163com  
        service_notification_commands    notify-service-by-email
        host_notification_commands     notify-host-by-email
        pager                          13691515****
        }

define contactgroup{
        contactgroup_name               sysadmin
        alias                            sysadmin
        members                        scomd
        }

然后然后创建一个配置文件: escalations.cfg

#vi /usr/local/nagios/etc/objects/escalations.cfg

添加如下内容:
define serviceescalation{
host_name               scomd.com    ;被监控主机名称,多个用逗号隔开
first_notification         4           ; 第4条信息起,改变频率间隔
last_notification          0          ; 第n条信息起,恢复频率间隔
notification_interval     30         ; 通知间隔(单位:分)
contact_groups          sysadmin
}

define serviceescalation{
host_name                  scomd.com          ;被监控主机名称    
service_description        PING            ;被监控服务名称,多个用逗号隔开
first_notification            4
last_notification            0
notification_interval        30
contact_groups          sysadmin
}

最后,编辑nagios.cfg文件

#vi /usr/local/nagios/etc/nagios.cfg
添加:
cfg_file=/usr/local/nagios/etc/objects/escalations.cfg

检查nagios配置文件是否正确
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

没有问题就重启nagios服务吧
service nagios restart


新闻标题:escalation限制Nagios报警次数
本文路径:http://scyanting.com/article/igddgh.html