Nagios Herald won't send emails

时间:2016-04-21 22:29:35

标签: email monitoring nagios

I'm currently trying to set up nagios herald on my production nagios instance. I've made all the setup neccessary and when I run the following dry run, the notification is sent straight away:

root@mon1 objects]# /usr/local/nagios-herald/bin/nagios-herald --env-file /tmp/test_herald.out --message-type email -r my.email@address.net --formatter=$_SERVICEMESSAGE_FORMATTER_NAME$ --nagios-cgi-url=http://192.168.0.1/nagios/cgi-bin/cmd.cgi --reply-to=nagios@somehost.com

I want to be able to test keeping my legacy notifications in place, so I created a new command, contactgroup, and contact definition:

define command {
    command_name    herald-service-email
    command_line   /usr/local/nagios-herald/bin/nagios-herald --message-type email -r my.email@address.net --formatter=$_SERVICEMESSAGE_FORMATTER_NAME$ --nagios-cgi-url=http://192.168.0.1/nagios/cgi-bin/cmd.cgi --reply-to=nagios@somehost.com
     }

# nagios herald testing
define contactgroup {
    contactgroup_name              nagios-herald
    alias                          nagios herald
    name                           nagios-herald
    members                        nagios-herald
}
define contact {
    contact_name                   nagios-herald
    alias                          nagios-herald
    name                           nagios-herald
    use                            generic-pager
    service_notification_commands  herald-service-email
    register                       1
    email                          my.email@address.net
}

Lastly, I added the service notification command to my global contact used for all our alerting (the alert email is aliased to our actual email in /etc/aliases:

define contact {
    contact_name                   admin
    alias                          admin user
    name                           admin
    register                       1
    host_notification_period       24x7
    host_notification_options      d,u,r
    host_notification_commands     notify-host-by-email
    service_notification_period    24x7
    service_notification_options   w,u,c,r
    service_notification_commands  notify-service-by-email,dump-env,herald-service-email
    email                          admin
    pager                          admin-pager
}

And I see the notification getting invoked in my Thruk web UI, so I'm at a loss as to how/why this isn't working when the command invoked manually works. Anyone have any ideas or suggestions?

1 个答案:

答案 0 :(得分:-1)

您能否提供一个您期望看到来自的提醒的服务定义?也许你有一个格式错误的_message_formatter_name指令。

您还可以将--trace参数附加到nagios-herald通知命令的末尾,它将提供有关其执行操作的更多详细信息。还记得在命令中设置-l <logfile>或在配置中指定logfile:,以便在文件中捕获输出。