Your Linux Data Center Experts

We recently ran into an issue with Opsview notification emails from a fresh install on a CentOS 6 system. The delivered message had some headers misplaced in the body of the message rather than grouped with the rest of the message headers. These three headers, specifically:

User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

These headers being included in the message body resulted in an SMS message (which these notifications wind up being delivered as) that wasn't very informative as the actual content would get truncated. We tracked this down to the Opsview notify_by_email script passing the message subject to the /usr/bin/Mail command with trailing whitespace and a newline. Our install has this script located at /usr/local/nagios/libexec/notifications/notify_by_email.

On CentOS 6, /usr/bin/Mail is a link to /usr/bin/mailx and CentOS/RHEL release 6 has switched from the older BSD mailx package to the 'heirloom mailx' version.

Thankfully, perl has a nice way to handle this using chomp, and we modified the notify_by_email script as follows at about line 80, before the call to /usr/bin/Mail:

   chomp $sub;

As with all things perl, there are many ways this could have been done. I simply did it this way for the chomp to stand out amongst other customizations.

comments powered by Disqus

Join our other satisfied clients. Contact us today.