Page 1 of 2

Nagios Check_HTTP via Config Wizard

Posted: Sat Nov 22, 2014 1:40 pm
by krobertson71
I am trying to check an IIS site at our office. The site requires IE8 or 9.

I want the full page to load, graphics and all so I can get a good byte size and check time. If I use the check as is from the wizard, it works, but does not load anything but the text at the top of the window; no graphics or logon fileds come up.

I did google-foo and found the check_http options and found -A where you can insert the user agent.

Code: Select all

check_xi_service_http! -f ok -I 152.16.197.36 -u "/bacteremia/" -S -p 443 -A "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))"
Be after putting in the -A the checks fails with:

Code: Select all

(No output on stdout) stderr: /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
I have tried using ' and ` to no avail. Lost!

Re: Nagios Check_HTTP via Config Wizard

Posted: Mon Nov 24, 2014 10:13 am
by tmcdonald
How are you editing that command? Is it via the CCM or the config file? I'd like to see where you are putting the -A option. It may be that you need to escape some characters.

Re: Nagios Check_HTTP via Config Wizard

Posted: Mon Nov 24, 2014 11:15 am
by krobertson71

Code: Select all

 -f ok -I 152.16.197.36 -u "/bacteremia/" -S -p 443 -A "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))"
This is in CCM for the HTTP Service check

Re: Nagios Check_HTTP via Config Wizard

Posted: Mon Nov 24, 2014 11:21 am
by tmcdonald
Are you testing the command using the "Test Check Command" button? If so it does have some issues with escaping. A true test would be to save the check and let it run naturally.

Also bear in mind that if javascript or other interpreted languages are loading images, the check_http script does not have a JS interpreter built in so it will not run anything.

Re: Nagios Check_HTTP via Config Wizard

Posted: Mon Nov 24, 2014 11:53 am
by krobertson71
The check has been running with a warning and yes the site is mostly javascript.

Is there an alternative, maybe web-inject to get around this? None of these web checks are of much use if you cant run them against java, which is heavily used.

Re: Nagios Check_HTTP via Config Wizard

Posted: Mon Nov 24, 2014 3:42 pm
by sreinhardt
What output do you recieve when running this via command line?

Code: Select all

./check_http -H [host address] -f ok -I 152.16.197.36 -u "/bacteremia/" -S -p 443 -A "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))"
The other thing I am noticing, is the extra ) after en-US. How about if you run it either of these ways?

Code: Select all

./check_http -H [host address] -f ok -I 152.16.197.36 -u "/bacteremia/" -S -p 443 -A "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US)"
./check_http -H [host address] -f ok -I 152.16.197.36 -u "/bacteremia/" -S -p 443 -A "(Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))"

Re: Nagios Check_HTTP via Config Wizard

Posted: Mon Nov 24, 2014 7:37 pm
by krobertson71
Actually this works:

Code: Select all

./check_http -H sitename -f ok -I 152.16.197.36 -u "/subsite/" -S -p 443 -A "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))"
But still gives the same byte counts which means it's not interpreting the Javascript call to load the images. Will have to do I guess.

Still what is funny that creating this exact same thing with the wizard causes the error to occur, but runn check_http from the command line the -A argument works just fine.

Code: Select all

HTTP OK: HTTP/1.1 200 OK - 15043 bytes in 0.024 second response time |time=0.023550s;;;0.000000 size=15043B;;;0
Is there something in the wizard that could be causing this when specifing -A and providing a user agent?

Re: Nagios Check_HTTP via Config Wizard

Posted: Tue Nov 25, 2014 4:04 pm
by tmcdonald
It might be escaping the output. Can you PM me a copy of the /usr/local/nagios/etc/services/XXX.cfg file where XXX is the name of the host that service is attached to?

File received and placed in network drive.

Re: Nagios Check_HTTP via Config Wizard

Posted: Wed Nov 26, 2014 10:20 am
by krobertson71
PM sent as requested.

Re: Nagios Check_HTTP via Config Wizard

Posted: Wed Nov 26, 2014 1:49 pm
by sreinhardt
But still gives the same byte counts which means it's not interpreting the Javascript call to load the images. Will have to do I guess.
This is actually expected behavior. Check_http does not evaluate active code that it receives. The most it really does for working with received data is byte size, response time, and string checks. If you're looking to check final load size I might suggest selenium or webinject to actively load the entire page, then check totals. They both provide the ability to execute or at least basic evaluation of javascript and other active scripting languages.

When you say run from the wizard, is this via the test command window or actually letting nagios run the check as it would normally? If you weren't aware, the test command button may add unnecessary escaping that nagios itself would not.