如何关闭负载警报?

如何关闭负载警报?

在组成我们的 Nagios 服务器的大量文件中,有一项服务检查负载:

define service{
        use                             generic-service
        name                            check-load
        hostgroup_name                  nrpe-hosts,!webnodes,!build-cluster
        notification_options            c,r
        service_description             NRPE - Load
        check_command                   check_nrpe!check_load
        contacts                        irc
}

还有两个联系方式:

define contact{
        contact_name                    irc
        alias                           ircbot
        host_notification_period        24x7
        service_notification_period     24x7
        host_notification_options       d,u,r,f
        service_notification_options    w,u,c,r,f
        service_notification_commands   notify-by-epager
        host_notification_commands      host-notify-by-epager
        pager                           [email protected]
        }

define contact {
       contact_name                             pagerduty
       alias                                    PagerDuty Pseudo-Contact
       service_notification_period              24x7
       host_notification_period                 24x7
       service_notification_options             u,c,r
       host_notification_options                d,r
       service_notification_commands            notify-service-by-pagerduty
       host_notification_commands               notify-host-by-pagerduty
       pager                                    lol-no
}

编辑:此外,服务继承的事情:

define service{
        name                            generic-service
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           3
        retry_check_interval            1
        notification_interval           0
        notification_period             24x7
        notification_options            w,c,r
        register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}

编辑2:还有一个通知命令定义,仅针对怀疑者;):

# 'notify-by-epager' command definition
define command{
        command_name    notify-by-epager
        command_line    /usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$
}

Edit3:以及主机定义:

define host{
        host_name                       vmprod1
        alias                           vmprod1.example.com
        address                         192.1.1.123
        use                             generic-host
        hostgroups                      nrpe-hosts,vm-hosts,vm-prod,dellraid-hosts
        contact_groups                  example,example-pager
}

这是唯一一次检查服务描述“NRPE - Load”。根据我的理解,这应该只会提醒 irc 联系人,而不会提醒 pagerduty 联系人。然而,上个月我在 PagerDuty 中收到了 100 多个“NRPE - Load”警报。

我错过了什么?

答案1

为了报答你的感激之情,我将回答我自己的问题。事实证明服务隐式继承自主机,因此上述服务检查有一个联系人设置和一个继承的 contact_group。

对服务检查进行简单的修复即可:

define service{
        use                             generic-service
        name                            check-load
        hostgroup_name                  nrpe-hosts,!webnodes,!build-cluster
        notification_options            c,r
        service_description             NRPE - Load
        check_command                   check_nrpe!check_load
        contacts                        irc
        contact_groups
}

相关内容