Missing ampersand character in notifications

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
tkurek
Posts: 8
Joined: Sat Sep 01, 2012 4:20 am

Missing ampersand character in notifications

Post by tkurek »

Hi

I'm experiencing some issues when setting up my Nagios XI instance.

I'd like to deploy a feature that a direct link to host / service will be included in a notification.

What I did until now is as follows:

1) From Nagios Core Configuration Manager I added a new host / service template and updated 'Notes URL' with the following content:

https://monitoring.eu.antennasoftware.c ... $HOSTNAME$
https://monitoring.eu.antennasoftware.c ... RVICEDESC$

2) I added new host / service that is using the above templates

3) I modified 'xi_host_notification_handler' and 'xi_service_notification_handler' commands and appended the following strings respectively:

--notes_url="$HOSTNOTESURL$"
--notes_url="$SERVICENOTESURL$"

4) I changed my notification messages both for host / service alert to include the following variables respectively:

URL: %notes_url%

I saved everything, reloaded the configuration and so on. Now, when receiving a notification alert, the following line is included in the message:

URL: https://monitoring.eu.antennasoftware.c ... rvice=TEST

It looks like '&' character is missing. I've checked the template configuration file and everything seems to be find there:

Code: Select all

define service {
       name                                     TEST
       service_description                      Global network issues
       initial_state                            o
       max_check_attempts                       1
       check_interval                           1
       retry_interval                           1
       check_period                             24x7
       notification_interval                    15
       notification_period                      24x7
       notification_options                     u,r,c,f,s
       notifications_enabled                    1
       contact_groups                           IT - All
       notes_url                                https://monitoring.eu.antennasoftware.com/nagios/cgi-bin/extinfo.cgi?type=2&host=$HOSTNAME$&service=$SERVICEDESC$
       register                                 0

}
It looks like some PHP issue then, especially I'd suspect 'xi_host_notification_handler' and 'xi_service_notification_handler' scripts.

Please, let me know if you'll need any details about licensing, etc.

I'm looking forward to hearing from you.

Regards
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Missing ampersand character in notifications

Post by mguthrie »

Can you try passing the URL encoded value for the & symbol and see if that works?

%26


cgi-bin/extinfo.cgi?type=2%26host=$HOSTNAME$
cgi-bin/extinfo.cgi?type=2%26host=$HOSTNAME$%26service=$SERVICEDESC$
tkurek
Posts: 8
Joined: Sat Sep 01, 2012 4:20 am

Re: Missing ampersand character in notifications

Post by tkurek »

I've updated the 'Notes URL' field according to your post above:

https://monitoring.eu.antennasoftware.c ... $HOSTNAME$
https://monitoring.eu.antennasoftware.c ... RVICEDESC$

Now, when receiving a notification, I get the following URL in the e-mail:

https://monitoring.eu.antennasoftware.c ... rvice=TEST

The above doesn't work of course as well.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Missing ampersand character in notifications

Post by mguthrie »

Alrighty, lets try one more:

&

cgi-bin/extinfo.cgi?type=&host=$HOSTNAME$
cgi-bin/extinfo.cgi?type=&host=$HOSTNAME$&service=$SERVICEDESC$

If that doesn't work we can maybe tinker with adding the notes url and action url to the list of XI macros, I think someone else has actually posted that as a feature request to our tracker.
tkurek
Posts: 8
Joined: Sat Sep 01, 2012 4:20 am

Re: Missing ampersand character in notifications

Post by tkurek »

I've changed the 'Notes URL' field one more time according to your clue. What am I getting right now is

https://monitoring.eu.antennasoftware.c ... ?type=2amp

Is there anything more that you could do at this point or do I have to wait for the updates then?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Missing ampersand character in notifications

Post by mguthrie »

Rats, it's not encoding it then, it's just removing it altogether. Ok. I've got it on the dev TODO to add those to the built-in macro list. If you want I can post a hotfix to this thread once it's ready.
tkurek
Posts: 8
Joined: Sat Sep 01, 2012 4:20 am

Re: Missing ampersand character in notifications

Post by tkurek »

OK, thanks. And yes, please link this thread for me once it will be ready. Thanks!
Locked