Discussion:
[Nagios-users] check_http --url and --string don't work together?
Hari Sekhon
2006-08-17 09:58:10 UTC
Permalink
I can't seem to use --url and --string together. Url seems to make it
not bother checking the string.

First I test the --string works as follows:

check_http -S -H www.somedomain.com --string='<html blah blah <title>
The Wrong Nonexistent Web Page</title>...'

which returns as expected. This is what I want to make sure it will warn
me if it isn't finding exactly what I expect.

CRITICAL - string not found|time=0.210894s;;;0.000000 size=6403B;;;0


But if I do

check_http -S -H www.somedomain.com --url="/some/path/" --string='<html
blah blah <title> The Wrong Nonexistent Web Page</title>...'

I get

OK - HTTP/1.1 302 Found - 0.110 second response time
|time=0.110347s;;;0.000000 size=690B;;;0


It doesn't check the string! Instead it just says that because some page
was directed to that everything must be ok... ie False Positive.


The bigger picture:

I am trying to do testing of an https login page and get into a website.
This requires that I log in via ssl and supply a username and password.
The problem is that the login page will redirect to somewhere regardless
of the result. If the login is successful you can get the internal pages
and if unsuccessful it redirects to another login page. So I really need
to get --url and --string working together to check the actual html.

I know there is webinject but I'd rather stick to check_http, it's much
more straight forward and webinject's dependencies failed to install
yesterday so I'd rather do this than bother fixing that just to try it.


Any ideas on getting this url and string business to work together?


Hari
Hari Sekhon
2006-08-17 10:05:23 UTC
Permalink
Post by Hari Sekhon
I can't seem to use --url and --string together. Url seems to make it
not bother checking the string.
check_http -S -H www.somedomain.com --string='<html blah blah <title>
The Wrong Nonexistent Web Page</title>...'
which returns as expected. This is what I want to make sure it will
warn me if it isn't finding exactly what I expect.
CRITICAL - string not found|time=0.210894s;;;0.000000 size=6403B;;;0
But if I do
check_http -S -H www.somedomain.com --url="/some/path/"
--string='<html blah blah <title> The Wrong Nonexistent Web
Page</title>...'
I get
OK - HTTP/1.1 302 Found - 0.110 second response time
|time=0.110347s;;;0.000000 size=690B;;;0
It doesn't check the string! Instead it just says that because some
page was directed to that everything must be ok... ie False Positive.
I am trying to do testing of an https login page and get into a
website. This requires that I log in via ssl and supply a username and
password. The problem is that the login page will redirect to
somewhere regardless of the result. If the login is successful you can
get the internal pages and if unsuccessful it redirects to another
login page. So I really need to get --url and --string working
together to check the actual html.
I know there is webinject but I'd rather stick to check_http, it's
much more straight forward and webinject's dependencies failed to
install yesterday so I'd rather do this than bother fixing that just
to try it.
Any ideas on getting this url and string business to work together?
Hari
I thought this was because of the redirect so I went back to --help and
found --onredirect so now when I do --onredirect=follow it works fine
and complains about the string.

Sorted.


Hari

Loading...