Notify by Email sends attachment AT00001.bin

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
kuchenmann
Posts: 4
Joined: Fri Jun 23, 2023 10:54 pm

Notify by Email sends attachment AT00001.bin

Post 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.
kuchenmann
Posts: 4
Joined: Fri Jun 23, 2023 10:54 pm

Re: Notify by Email sends attachment AT00001.bin

Post 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$
}
gwesterman
Posts: 97
Joined: Wed Aug 23, 2023 11:29 am

Re: Notify by Email sends attachment AT00001.bin

Post by gwesterman »

I'm glad you could solve your issue!

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

Thank you!
Locked