Nagios Check_HTTP via Config Wizard

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Nagios Check_HTTP via Config Wizard

Post 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!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Check_HTTP via Config Wizard

Post 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.
Former Nagios employee
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: Nagios Check_HTTP via Config Wizard

Post 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
You do not have the required permissions to view the files attached to this post.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Check_HTTP via Config Wizard

Post 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.
Former Nagios employee
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: Nagios Check_HTTP via Config Wizard

Post 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.
You do not have the required permissions to view the files attached to this post.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios Check_HTTP via Config Wizard

Post 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))"
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: Nagios Check_HTTP via Config Wizard

Post 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?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Check_HTTP via Config Wizard

Post 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.
Former Nagios employee
krobertson71
Posts: 444
Joined: Tue Feb 11, 2014 10:16 pm

Re: Nagios Check_HTTP via Config Wizard

Post by krobertson71 »

PM sent as requested.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios Check_HTTP via Config Wizard

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked