& in URL causes check_http to fail

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
pbohn77
Posts: 8
Joined: Mon May 18, 2015 3:02 pm

& in URL causes check_http to fail

Post by pbohn77 »

I cannot get a wsdl to work if it has an '&' in it.

Is there a list of reserved characters that will not work?
Last edited by pbohn77 on Tue Sep 27, 2016 1:05 pm, edited 1 time in total.
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: & in an URL causes check_http to fail

Post by bwallace »

Can't say that I've seen special characters cause check_http to fail...yet

Can you post the entire check command you're using as well as the results?
Be sure to check out the Knowledgebase for helpful articles and solutions!
pbohn77
Posts: 8
Joined: Mon May 18, 2015 3:02 pm

Re: & in URL causes check_http to fail

Post by pbohn77 »

I am using xi
the command is the check_http options are -p 10081 -u /GenericWebService/ws?service=WorkGroupService&appl=vantive&wsdl -s "getAllActiveAvailableWorkGroups"

that returns from the test command button

Test Check Command

Testing check from command line...
check_http -I bssapp.savvis.net -p 10081 -u /GenericWebService/ws\?service=WorkGroupService
OUTPUT: HTTP OK: HTTP/1.1 200 OK - 589 bytes in 0.018 second response time |time=0.017706s;;;0.000000 size=589B;;;0

if I run it from the command line on the nagios server I get
[root@dc2dccnagpd01 libexec]# ./check_http -H bssapp.savvis.net -p 10081 -u /GenericWebService/ws?service=WorkGroupService&appl=vantive&wsdl -s "getAllActiveAvailableWorkGroups"
[1] 13295
[2] 13296
-bash: wsdl: command not found
[2]+ Done appl=vantive
[root@dc2dccnagpd01 libexec]# HTTP OK: HTTP/1.1 200 OK - 589 bytes in 0.029 second response time |time=0.029294s;;;0.000000 size=589B;;;0

[1]+ Done ./check_http -H bssapp.savvis.net -p 10081 -u /GenericWebService/ws?service=WorkGroupService
[root@dc2dccnagpd01 libexec]#


then I make the test active and have it run in Xi.
Critical
(Return code of 127 is out of bounds - plugin may be missing)

it looks to me like anything after and including the & is not being looked for.
pbohn77
Posts: 8
Joined: Mon May 18, 2015 3:02 pm

Re: & in URL causes check_http to fail

Post by pbohn77 »

If I quote the url on the command line it appears to work
[root@dc2dccnagpd01 libexec]# ./check_http -H bssapp.savvis.net -p 10081 -u '/GenericWebService/ws?service=WorkGroupService&appl=vantive&wsdl' -s getAllActiveAvailableWorkGroups
HTTP OK: HTTP/1.1 200 OK - 20968 bytes in 0.010 second response time |time=0.010184s;;;0.000000 size=20968B;;;0
[root@dc2dccnagpd01 libexec]#

If I quote it in the Xi gui
I get
COMMAND: /usr/local/nagios/libexec/check_http -I bssapp.savvis.net -p 10081 -u \'/GenericWebService/ws\?service=WorkGroupService
OUTPUT: HTTP WARNING: HTTP/1.1 400 Invalid URI - 130 bytes in 0.005 second response time |time=0.004650s;;;0.000000 size=130B;;;

But it passes when I save and have it run in Xi.
So the test check command does not work, but quoted the real check works.....??
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: & in URL causes check_http to fail

Post by mcapra »

pbohn77 wrote: So the test check command does not work, but quoted the real check works.....??
The CLI is the final authority on what does/does not work when creating a check command. The "Test Command" component of the Nagios XI GUI is notoriously fickle (mostly due to PHP) and is getting an overhaul for 5.3.0.
Former Nagios employee
https://www.mcapra.com/
pbohn77
Posts: 8
Joined: Mon May 18, 2015 3:02 pm

Re: & in URL causes check_http to fail

Post by pbohn77 »

Cool, thanks.
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: & in URL causes check_http to fail

Post by bwallace »

- When you use the Test Check Command button, it runs as apache (where there are known escaping issues as mcapra mentioned)
- If the check is run organically, it runs as nagios.

Have you tried just configuring the check, and then applying configuration and allowing XI to perform the check normally?
Be sure to check out the Knowledgebase for helpful articles and solutions!
pbohn77
Posts: 8
Joined: Mon May 18, 2015 3:02 pm

Re: & in URL causes check_http to fail

Post by pbohn77 »

Yup.
That is what I will do from now on.
It's just that when it fails more people than just me get the alert emails. so if i fat finger something, I can't test it before I make it active.
This just makes it a longer process per test.
But I only have 80 more to go.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: & in URL causes check_http to fail

Post by rkennedy »

To help prevent fat fingering, you could turn off notifications on individual hosts / services, and then enable once you're sure it works. Just throwing this out there as it may help you with testing.
Former Nagios Employee
Locked