Page 1 of 1

Check_http redirect

Posted: Wed Dec 09, 2015 5:57 am
by onlyme
I am trying to Monitor a Webpage to make sure it is always running.

The issue I am having is i get redirected to an Authentication Page and I can't get the command to input the Username and Password and redirect me to the webpage

Entering this url - http://urladdress/services Redirects me to here - http://CASserver/urladdress/services and I want it to redirect me back to http://urladdress/services after the user and password has been entered.

The commands I have tried are below and I always get to the login page and do not get redirected after

check_http -I ipaddress -H localhost -u http://urladdress/services -f follow -P "username=user&password=password" -s "you are logged in"
check_http -I ipaddress -H localhost -u http://urladdress/services -f follow -P user:password -s "you are logged in"
check_http -I ipaddress -H localhost -u http://urladdress/services -f follow -a "username=user&password=password" -s "you are logged in"
check_http -I ipaddress -H localhost -u http://urladdress/services -f follow -a user:password -s "you are logged in"

The reply is always HTTP CRITICAL: HTTP/1.1 200 OK - string 'you are logged in' not found on http://CASserver/urladdress/services

Re: Check_http redirect

Posted: Wed Dec 09, 2015 10:20 am
by hsmith
What kind of login page is it? AFAIK, check_http only will accept basic authentication, but I may be wrong.

Re: Check_http redirect

Posted: Wed Dec 09, 2015 10:46 am
by onlyme
I am redirected to a CAS (Central Authentication Service) server which uses LDAP.

If I am unable to authenticate is it possible to use check_http to perform a wms getcapabilities request?

Re: Check_http redirect

Posted: Wed Dec 09, 2015 12:55 pm
by rkennedy
What happens if you run it with a -r (match regex)? Can you verify the contents of the page?

It's working fine over here. Here's an example from a core system

Code: Select all

[root@nagios libexec]# ./check_http -H 127.0.0.1 -u http://127.0.0.1/nagios/ -a nagiosadmin:password -s 'Nagios Core'
HTTP OK: HTTP/1.1 200 OK - 1105 bytes in 0.004 second response time |time=0.003579s;;;0.000000 size=1105B;;;

Code: Select all

[root@nagios libexec]# ./check_http -H 127.0.0.1 -u http://127.0.0.1/nagios/ -a nagiosadmin:password -s 'Nagios C0r3'
HTTP CRITICAL: HTTP/1.1 200 OK - string 'Nagios C0r3' not found on 'http://127.0.0.1:80http://127.0.0.1/nagios/' - 1105 bytes in 0.002 second response time |time=0.002252s;;;0.000000 size=1105B;;;0

Re: Check_http redirect

Posted: Thu Dec 10, 2015 5:22 am
by onlyme
Thanks but I have decided to go a different route and have managed to use a GetCapabilities for WMS request

/usr/local/nagios/libexec/check_http -I ipaddress -p port -u "/thredds/wms/storelocation?REQUEST=GetCapabilities&SERVICE=WMS" -s "Automatically-generated field"

Re: Check_http redirect

Posted: Thu Dec 10, 2015 10:29 am
by hsmith
Is there anything else you would like help with, or is this resolved?