Page 1 of 1

String or regex expression always passes - should fail

Posted: Tue Oct 12, 2010 1:32 pm
by jpipitone
We've setup Nagios XI and I am adding a website to monitor using the Website Monitoring Wizard. I've added a host (substituted with www1.ourdomain.com) which exists and is currently live in production.

When going through the necessary steps in the configuration wizard, I've tried both Web Page Content, and Web Page Regular Expression Match - both of which are always reporting as OK. I've changed the string to something not found on the page such as "asdf" or "wtf" and it still passes the check.

I've also ran the check command via the command line, and it's also passing. What am I missing here? The below commands were taken from Service Management in the Nagios Core Config Manager.

See below and attached screen shot.

Code: Select all

[root@localhost libexec]# ./check_http -s "wtf" -f -I 66.XX.XX.XX -u "http://www1.ourdomain.com" -p 80
HTTP OK - HTTP/1.1 302 Found - 0.010 second response time |time=0.009645s;;;0.000000 size=574B;;;0

Code: Select all

[root@localhost libexec]# ./check_http -r "this-should-fail" -f -I 66.XX.XX.XX -u "http://www1.ourdomain.com" -p 80
HTTP OK - HTTP/1.1 302 Found - 0.012 second response time |time=0.011685s;;;0.000000 size=574B;;;0

Re: String or regex expression always passes - should fail

Posted: Tue Oct 12, 2010 3:53 pm
by jpipitone
UPDATE:

This check works for some of our websites, however on the websites I'm trying to get this check to work on, there is a blank page that is displayed initially with no content -

Is there a service check that exists for Nagios XI that will check the page source rather than for content on the site? I think I can get it to work if there is a check available that will check the source.

Re: String or regex expression always passes - should fail

Posted: Tue Oct 12, 2010 5:00 pm
by admin
Aha! I think I discovered a bug in the plugin. If you omit the "-f" argument, the pattern matching works properly. With the -f argument, it will sometimes not even attempt to match the pattern. Try this for a modified command line:

Code: Select all

./check_http -r "this-should-fail" -I 66.XX.XX.XX -u "http://www1.ourdomain.com" -p 80
FYI, another plugin that looks like it can check for content is "check_http_content":

http://exchange.nagios.org/directory/Pl ... nt/details