Page 1 of 2
Nagios escaping ? in URL
Posted: Thu Dec 10, 2020 9:48 am
by hbouma
We are having an issue where Nagios XI is returning a different result than the command line. This appears to be related to
https://support.nagios.com/forum/viewto ... stion+mark. We have a URL that contains a ? and when the check is run, Nagios escapes the ? in the URL causing it to fail.
The check works fine from CLI which does not add the \ before the ?.
We have the servers running Nagios 5.7.3 at this time on RHEL 7.8 VMs.
Re: Nagios escaping ? in URL
Posted: Fri Dec 11, 2020 11:40 am
by dchurch
If you mean by this that you're running this in the "Run Check Command" modal dialog from within the Nagios XI web interface, then that's a known issue. There's a bug in the escaping of the command when you run it from that dialog box.
Best workaround I can give is to take what that the command line says in the dialog, and try running that directly on the command line.
Re: Nagios escaping ? in URL
Posted: Fri Dec 11, 2020 11:43 am
by hbouma
Is there a timeframe for fixing the bug? We have several critical production URLs that need monitored that use a ? in the URL.
Running the command from the command line works fine. Letting Nagios XI run the command adds an escape \ in the URL and therefore the check fails.
Re: Nagios escaping ? in URL
Posted: Fri Dec 11, 2020 5:48 pm
by dchurch
It's already fixed as of Nagios XI 5.7.5.
Here's the change log
Re: Nagios escaping ? in URL
Posted: Mon Dec 14, 2020 10:47 am
by hbouma
We just tested this in our DEV server running Nagios XI 5.7.5 and the question mark is still being escaped.
Re: Nagios escaping ? in URL
Posted: Mon Dec 14, 2020 1:34 pm
by dchurch
Can you paste the configuration for the check command here (or if it contains sensitive information, PM it to me)?
Also, can you please paste the full output of running the check thru the CCM's Run Check Command dialog, as well as from the command line?
Re: Nagios escaping ? in URL
Posted: Mon Dec 14, 2020 1:55 pm
by hbouma
Check command is check_http
$ARG1$ is -s "
SEARCH_TERM" -f ok -I
IPADDRESS 24 -u "/_cat/master?v" -S --sni -p 443
Output is as follows:
2020-12-14 13_52_34-Window.png
Re: Nagios escaping ? in URL
Posted: Mon Dec 14, 2020 5:24 pm
by dchurch
I was unable to reproduce this issue in Nagios XI 5.7.5.
Can you send me a system profile (from your dev server) so I can diagnose further?
Re: Nagios escaping ? in URL
Posted: Tue Dec 15, 2020 10:16 am
by hbouma
Profile sent in PM.
Re: Nagios escaping ? in URL
Posted: Tue Dec 15, 2020 12:12 pm
by dchurch
I was able to reproduce it. The trick to reproducing it is to have a "?" inside of double-quoted string inside the check command arguments. The shell interpreter incorrectly puts a backslash in front of it when creating the command line.
The way to work around this and fix your particular problem is to replace the double quotes with single quotes.
I.e. Instead of "/_cat/master?v", use '/_cat/master?v'.