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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
pyu
Posts: 2
Joined: Mon Aug 04, 2014 6:52 am

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

Post 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
}
Last edited by scottwilkerson on Mon Aug 04, 2014 8:52 am, edited 1 time in total.
Reason: removed weird char and replaced with xxx
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post 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.
Former Nagios employee
pyu
Posts: 2
Joined: Mon Aug 04, 2014 6:52 am

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

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post 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?
Former Nagios employee
Locked