Page 1 of 1

email notify send att00001.bin instead of text in email body

Posted: Mon Aug 04, 2014 7:41 am
by pyu
I am current met the issue during set up nagios server.
email notify send att00001.bin instead of text in email body, the command.cfg is by default,

***** Nagios *****

Notification Type: CUSTOM

Service: DISK-C
Host: sg-ts01
Address: 10.65.2.86
State: WARNING

Date/Time: Mon Aug 4 05:11:39 PDT 2014

Additional Info:

WARNING: Only 7.69G (12%) free on xxx.65.2.86

my env is
########################################
# NAGIOS STATUS FILE
#
# THIS FILE IS AUTOMATICALLY GENERATED
# BY NAGIOS. DO NOT MODIFY THIS FILE!
########################################

info {
created=1407156064
version=4.0.7
last_update_check=1407115858
update_available=0
last_version=4.0.7
new_version=4.0.7
}

Re: email notify send att00001.bin instead of text in email

Posted: Mon Aug 04, 2014 10:55 am
by tmcdonald
I've definitely seen this before:

http://support.nagios.com/forum/viewtop ... SOH#p88033

Essentially any non-ASCII characters will cause the email to attach the body as a .bin since it thinks it is a binary file. You will need to find out what is sending that 0x01 character and remove it.

Re: email notify send att00001.bin instead of text in email

Posted: Mon Aug 04, 2014 10:17 pm
by pyu
Yes, I have follow the the post modify the command.cfg and %b%s%b after printf, but doesn't work.

Code: Select all

# 'notify-service-by-email' 
define command{
command_name notify-service-by-email-smb
command_line /usr/bin/printf "%b%s%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" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
deeply grateful
I also tried remove the "$SERVICEOUTPUT$" from the notify command, email can send in text body normally.
This issue has troubled me more than one week, really no idea what can do to let it works normally. Any help will be deeply grateful.

Re: email notify send att00001.bin instead of text in email

Posted: Wed Aug 06, 2014 10:17 am
by tmcdonald
The solution you implemented was specific to that other thread where the user had a \\store\nagios SMB share and the \n was being treated as a newline. That solution will not help you here.

In your case, the $SERVICEOUTPUT$ macro outputs a non-ASCII string which causes the body to become an attachment. Can you manually run the plugin command for that service and show us the output?