Page 1 of 2

Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Wed Apr 17, 2013 5:00 am
by Jimmy
Hello,

We just update to Nagios 3.5.0 on our nagios server and we have a problem with $ADMINEMAIL$ macro in notification.

We have a charset problem with the value passed to our notification commands.

In nagios.cfg file :
The value of $ADMINEMAIL$ in our notification process :

Code: Select all

username%40domain.fr
The @ character is transorm in %40

The changelog of Nagios 3.5.0 :
This release contains bug fixes and updates related to downtimes, restarts, and to the way non-ASCII characters are handled
Do someone else had the same problem since Nagios 3.5.0 ? Is this a bug in the new version ? Where can we see this charset translation in source code ?

Thank you !

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Wed Apr 17, 2013 5:29 pm
by abrist
This is curious. I emailed a link to one of our core devs, if he does not get back to me by Friday, I will see him in person. Sit tight.

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Thu Apr 18, 2013 2:17 am
by Jimmy
We see that if we do a Nagios restart, the problem disappeared. But when we do a Nagios Reload, the problem is back again.

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Thu Apr 18, 2013 8:02 am
by misterdev
Hello,

I work with Jimmy (author of the topic), and I work on this problem too.

For French speaker, I made more debug here :
http://forums.monitoring-fr.org/index.php?topic=6612

I will try to explain everything here :

The problem occurs after a second reload of Nagios.

Here is the notification command :

Code: Select all

define command{
        command_name            notification_service_par_mail
        command_line            $USER1$/sendmailservices.sh "$CONTACTEMAIL$" "$ADMINEMAIL$"
}
Here is my notification script (for test) :

Code: Select all

#!/bin/bash

TO=$1
EMETTEUR=$2

echo "$TO $EMETTEUR" >> /tmp/notifBash.log
1- I restart Nagios and force a notification, everything works fine :

Code: Select all

tail /tmp/notifBash.log
[email protected] [email protected]
2- I reload Nagios and force a notification, everything works fine :

Code: Select all

tail /tmp/notifBash.log
[email protected] [email protected]

3- I reload Nagios again and force a notification, problem occurs :

Code: Select all

tail /tmp/notifBash.log
[email protected] user%40domain.fr
--- Another test, if my script sendmailservices.sh is not executable :

1- I restart Nagios and force a notification, here is the nagios warning :
[1366287128] Warning: Attempting to execute the command "/usr/local/nagios/libexec/sendmailservices.sh "[email protected]" "[email protected]"" resulted in a return code of 126. Make sure the script or binary you are trying to execute actually exists...
2- I reload Nagios and force a notification, here is the nagios warning :
[1366287189] Warning: Attempting to execute the command "/usr/local/nagios/libexec/sendmailservices.sh "[email protected]" "[email protected]"" resulted in a return code of 126. Make sure the script or binary you are trying to execute actually exists...

3- I reload Nagios again and force a notification, here is the nagios warning :
[1366287254] Warning: Attempting to execute the command "/usr/local/nagios/libexec/sendmailservices.sh "[email protected]" "user%40domain.fr"" resulted in a return code of 126. Make sure the script or binary you are trying to execute actually exists...
My conclusion : after a second reload, nagios converts the '@' in the 'ADMINEMAIL' macro...

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Thu Apr 18, 2013 2:52 pm
by abrist
Make sure that you do not have orphans or hung copies of the nagios process on reload.

Code: Select all

service nagios stop
killall nagios
Verify they are gone:

Code: Select all

ps -aef | grep nagios 
If so, restart:

Code: Select all

service nagios start

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Fri Apr 19, 2013 2:06 am
by misterdev
Hello,

Well, everything works fine when I restart nagios ( nagios restart / nagios stop && nagios start / killall nagios && nagios start )
It's after the second reload that the bug seems to appear.

Edit : I opened an issue in the bugtracker http://tracker.nagios.org/view.php?id=444

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Fri Apr 19, 2013 2:38 pm
by scottwilkerson
When you are stopping Nagios is it going down cleanly or giving an error that it didn't stop in a timely manner?

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Fri Apr 19, 2013 3:35 pm
by misterdev
Hello,

Nagios is going down cleanly when I stop it.

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Mon Apr 22, 2013 10:46 am
by abrist
If you stop nagios and kill any orphans, wait a moment, and then start nagios, is this reproducible every time?

Re: Nagios 3.5.0 problem with macro $ADMINEMAIL$

Posted: Mon Apr 22, 2013 11:00 am
by misterdev
Hi,

Here is how I reproduce the bug :
1 - /etc/init.d/nagios stop
2 - kill any nagios processes left / any orphan / etc... --> killall nagios + kill -9 <pid>
3 - /etc/init.d/nagios start
--> bug not present

4 - /etc/init.d/nagios reload
--> bug not present

5 - /etc/init.d/nagios reload
--> bug present