Page 1 of 1

Notify by Email sends attachment AT00001.bin

Posted: Fri Mar 08, 2024 12:33 am
by kuchenmann
Hi,
I have a NRPE check on a Windows-server which is checking the size of files.
Unfortunately the returned string "C:\folder\archive1\archive.zip" contains \a which is interpreted as BEL.
And so the notify-service-by-email does not send the text, it sends an attachment.
I've seen this only for this check.
Is there a way to modify the string or to make a mail-notify just for this case?
The check_nrpe is a binary file, so I can not make changes in this check.
Thanks.

Re: Notify by Email sends attachment AT00001.bin

Posted: Fri Mar 08, 2024 9:04 am
by kuchenmann
OK, I could solve it!
Before the | to the mail, I pipe it through sed...

define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nAlias: $HOSTALIAS$\n Address: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\n" | sed 's/\a/\\a/g' | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

Re: Notify by Email sends attachment AT00001.bin

Posted: Mon Mar 11, 2024 9:03 am
by gwesterman
I'm glad you could solve your issue!

If you need help with anything else, please let us know.

Thank you!