I’ve been having a similar issue with Nagios sending out emails, when it sends them out I’ve been getting the email correctly to my email but I’ve also been getting delivery failure notifications with the below in them.
[code]""@b, *****@nagiosserver.domain.name,
[email protected],
*****[email protected],
“Type:RECOVERYnnService:PINGnHost:XxxX”@nagiosserver.domain.name,
[email protected],
“RouternAddress:xxx.xxx.x.xxxnState:OKnnDate/Time:Wed”@devexternal.harp.loca
l,
[email protected], [email protected],
“14:45:07”@nagiosserver.domain.name, [email protected],
[email protected],
“Info:nnPING”@nagiosserver.domain.name, [email protected],
[email protected], [email protected],
[email protected], [email protected], 0@,
[email protected], [email protected],
[email protected], [email protected]
[/code]
Which is a malformed email because if you remove all of the @nagiosserver.domain.name you get
""@b, ***** nagios *****nnNotification Type:RECOVERYnnService: PINGnHost:XXXXXXXX RouternAddress: xx.xxx.x.xxxnState:OKnn Date/Time:Wed Feb, 16, 14:45:07, EST, 2011 nnAdditional Info:nn PING OK- Packetloss=0 RTA=89.33 ms
Which is the information sent in the alert command
In my research I found this thread and tried changing the commands as described at infosecprojects.net/nagios-sendmail.html
# NEW 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "Subject:** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\n***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\nnAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/sbin/sendmail $CONTACTEMAIL$
Today we had a server CPU go into the critical state. Nagios shows in the logs that it sent out emails to the correct people to let them know, but no one got any emails.
The issue with the malformed emails only started in the last week and had been running w/o issue for months up until now. I’m the only person who makes changes to the system and the only change I’ve made recently was to change the the email address for the nagios contact to my e-mail address and that was over a moth ago.
Currently on ones getting emails at all which isn’t good, luckily nothing bad happened when the server CPU use reached critical today but I need to get emails working again A.S.A.P. and figure out why with the old command it both worked and didn’t work at the same time.