[Pkg-nagios-devel] Bug#440284: GNU mailutils' mail requires \n at end of last line

Athanasius debian at miggy.org
Fri Aug 31 09:14:43 UTC 2007

Package: nagios-common
Version: 1.4-3

The definition of notify-by-email and the like in
/etc/nagios/misccommands.cfg defines the body of the email to have a
last line NOT ending in a \n character.  GNU mailutils' mail will drop
these last lines.

For example, in the package source file

command[notify-by-email]=/usr/bin/printf "%b" "***** Nagios @VERSION@ *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | @MAIL_PROG@ -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

needs to be:

command[notify-by-email]=/usr/bin/printf "%b" "***** Nagios @VERSION@ *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$\n" | @MAIL_PROG@ -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

else the contents of $OUTPUT$ don't make it into the email.  Similarly
for other commands utilising @MAIL_PROG@ where that may be GNU
mailutils' mail program.

It's simple to test this with two quick commandlines:

/usr/bin/printf "%b" "***** Testing *****\n\nWibble" | /usr/bin/mail -s "** test **" <user>
/usr/bin/printf "%b" "***** Testing *****\n\nWibble\n" | /usr/bin/mail -s "** test **" <user>

The first email will NOT have the line 'Wibble' in it, the second will.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-nagios-devel/attachments/20070831/49218b22/attachment.pgp 

More information about the Pkg-nagios-devel mailing list