Macros in notification e-mails appear URL encoded

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
hillardn
Posts: 2
Joined: Tue Mar 12, 2013 5:01 am

Macros in notification e-mails appear URL encoded

Post by hillardn »

Hi. We're experiencing a problem with our Nagios installation that seems to have occurred since we upgraded from 3.4.1 to 3.4.4.

We have host and service notifications configured with the default option, here's the configuration for the service notifications:

Code: Select all

# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%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$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }
However, when the notification e-mail arrives, it appears like this:
From: [email protected]
Sent: 12 March 2013 00:40
To: Joe User
Subject: ** PROBLEM Service Alert: %5Bexternalserver%5D+External+FTP+/+web+server//var/www Filesystem is CRITICAL **

***** Nagios *****

Notification Type: PROBLEM

Service: /var/www Filesystem
Host: %5Bexternalserver%5D+External+FTP+/+web+server
Address: 1.2.3.4
State: CRITICAL

Date/Time: Tue+Mar+12+00:39:44+GMT+2013

Additional Info:

CRITICAL - Plugin timed out after 10 seconds
I've packet captured the SMTP traffic coming from the 'Nagios server' (CentOS 5.2 with sendmail) and can see the URL encoding so can confirm that it doesn't appear to be anything further down the line in our e-mail system.

Any advice would be appreciated.

Many thanks.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Macros in notification e-mails appear URL encoded

Post by sreinhardt »

This most likely has something to do with internationalization starting in 3.4.4. All URI and data relayed through it, has to be encoded to work with non-ascii formatted characters. Do you happen to have your system set to a non-english language?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
hillardn
Posts: 2
Joined: Tue Mar 12, 2013 5:01 am

Re: Macros in notification e-mails appear URL encoded

Post by hillardn »

Hmm. Many thanks for the reply but it appears to have cured itself yesterday!

I restarted Nagios on Monday, after I'd read this post:

http://support.nagios.com/forum/viewtop ... f=7&t=9502

On Monday evening, I left a packet capture running so that I could see all of the SMTP traffic the server generated and upon analysis, it showed that the problem was still occurring, hence raising the issue here.

However later on on Tuesday, the problem seemed to fix itself!

I see that there's someone else experiencing the same problem:

http://support.nagios.com/forum/viewtop ... f=7&t=9592

I have just reloaded Nagios to see if the problem returns. Assuming it does, I'll apply the patch that's linked to in the second topic and then retest.

For the record, the system is configured for English so I don't think that it's related to the internationalisation changes.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Macros in notification e-mails appear URL encoded

Post by slansing »

Excellent, glad to hear you got it working, and thank you for posting your solution. Locking as resolved! If you have further questions don't hesitate to open a new thread!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Macros in notification e-mails appear URL encoded

Post by abrist »

Let us know if the problem returns.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked