Nagios主机通知不通过电子邮件或日志记录发送

时间:2016-08-09 00:39:42

标签: notifications monitoring host nagios

我正在用木偶重新做我们的nagios基础设施,但我目前停在一个看似简单的问题(很可能是配置问题)。

使用puppet,我在磁盘上吐出一些基本的nagios配置文件。 Nagios重新加载很好,一切看起来都不错,但是,当我标记主机时,它不会发送通知。

nagios.log显示:

  

[1470699491]外部命令:   PROCESS_HOST_CHECK_RESULT; divcont01; 1;测试通知

     

[1470699491] PASSIVE HOST CHECK:divcont01; 1;测试通知

     

[1470699491] HOST ALERT:divcont01; DOWN; HARD; 1;测试通知

在制作中(我没有改变任何东西),我在nagios.log中看到(在用ui标记主机之后):

  

[1470678186]外部指令:   PROCESS_HOST_CHECK_RESULT; PALTL12; 1;测试ey

     

[1470678187]被动主机检查:PALTL12; 1;测试ey

     

[1470678187] HOST ALERT:PALTL12; DOWN; HARD; 1; test ey

     

[1470678187]主机通知:   pal_infra; PALTL12; DOWN; host-notify-by-pom; test ey

     

[1470678187]主机通知:   pal_infra; PALTL12; DOWN; host-notify-by-email; test ey

     

[1470678192]主机警告:PALTL12; UP; HARD; 1; PING OK - 数据包丢失= 0%,   RTA = 0.81 ms

     

[1470678192]主机通知:   pal_infra; PALTL12; UP; host-notify-by-pom; PING OK - 数据包丢失= 0%,   RTA = 0.81 ms

     

[1470678192]主机通知:   pal_infra; PALTL12; UP;主机通过电子邮件通知; PING OK - 数据包丢失= 0%,   RTA = 0.81 ms

如日志中所示,在prod中的HOST ALERT之后会记录并直接发送主机通知。我已经详尽地比较了今天的配置文件,我找不到新配置没有通知的原因。

我已经确认在顶层启用了通知。我已经验证可以从此框发送电子邮件(但是,我使用日志来验证功能,而不是电子邮件)。我也尝试了其他多个谷歌建议(并将继续我的搜索)。

下面的相关配置详情。请原谅我的配置的冗长和乏味的堆栈溢出格式。提前谢谢。

主机/ divcont01.cfg:

  

定义主机{

  address              snip   
  host_name  divcont01                    
  use          generic-host-puppetized  
     

}

主机模板/通用宿主puppetized.cfg:

  

定义主机{

    check_command                  check-host-alive
    check_interval                 1
    contact_groups                 generic-contactgroup
    checks_enabled                 1
    event_handler_enabled          0
    flap_detection_enabled         0
    name                           generic-host-puppetized
    hostgroups                     +generic-host-puppetized
    max_check_attempts             4
    notification_interval          4
    notification_options           d,u,r
    notification_period            24x7
    notifications_enabled          1
    process_perf_data              0
    register                       0
    retain_nonstatus_information   1
    retain_status_information      1 
     

}

hostgroups /通用宿主puppetized.cfg:

  

定义hostgroup {

    hostgroup_name                 generic-host-puppetized 
     

}

contactgroups /仿制contactgroup.cfg

  

定义联系人组{

    contactgroup_name              generic-contactgroup
    members                        generic-puppetized-contact
     

}

触点/仿制puppetized-contact.cfg

  

定义联系人{

    use                            generic-contact
    contact_name                   generic-puppetized-contact
    email                          <my email>
     

}

objects / templates.cfg(仅限generic-contact config)

  

定义联系人{

    use                             my email  
    name                            generic-contact         ; The name of this contact template
    service_notification_period     24x7                    ; service notifications can be sent anytime
    host_notification_period        24x7                    ; host notifications can be sent anytime
    host_notification_commands     generic-puppetized-contact-host-notify-by-email-low
    service_notification_commands  notify-by-email,service-notify-by-pom
    service_notification_options    u,c,r,f         ; send notifications for all service states, flapping events, and scheduled downtime events
    host_notification_options       d,r,f           ; send notifications for all host states, flapping events, and scheduled downtime events

    register                        0                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
     

}

命令/仿制puppetized接触宿主通知逐电子邮件low.cfg:

  

定义命令{

    command_line                   /etc/nagios/global/scripts/nagios-mailx.sh -t my email -s "** notification Host Alert: hostname is hoststate **" -m "***** Nagios ***** Notification Type: notification type Host: host State: hoststate Address: address Info: output Date/Time: date"
    command_name                   generic-puppetized-contact-host-notify-by-email-low 
     

}

1 个答案:

答案 0 :(得分:0)

想出来......我正在另一个预先存在的系统中构建我的系统(危险,我知道),我的联系人实际上指的是通知联系人已禁用通知。

哎呀:)