在我的 nagios 中,我已设置电子邮件以转到[电子邮件保护]但是当电子邮件发送到此电子邮件 ID 时,它会被发送到类似的域[电子邮件保护]。
为什么电子邮件发送到[电子邮件保护](mon.myd.com 是服务器的主机名)
这是发送电子邮件时后缀中的日志条目。
Oct 1 08:24:05 mon postfix/pickup[11811]: 73262140BA8: uid=1001 from=<[email protected]>
Oct 1 08:24:05 mon postfix/cleanup[10125]: 73262140BA8: message-id=<[email protected]>
Oct 1 08:24:05 mon postfix/qmgr[10872]: 73262140BA8: from=<[email protected]>, size=787, nrcpt=1 (queue active)
Oct 1 08:24:05 mon postfix/smtp[10127]: 73262140BA8: to=<[email protected]>, relay=10.0.0.12[10.0.0.12]:25, delay=0.04, delays=0.02/0/0.01/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 78A99400E7)
Oct 1 08:24:05 mon postfix/qmgr[10872]: 73262140BA8: removed
grep 电子邮件的输出
root@mon:~# grep email /etc/nagiosql/contacts.cfg
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
email [email protected]
邮件命令的输出:
grep 邮件 /etc/nagiosql/commands.cfg
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:$HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -r [email protected] -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ $HOSTSTATE$ **" $CONTACTEMAIL$
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -r [email protected] -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
答案1
您已将电子邮件命令定义为 event_handler,但这不是该命令应有的使用方式。对于事件处理程序,$CONTACTEMAIL$ 宏不可用。