Check_http redirect

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
onlyme
Posts: 6
Joined: Wed Dec 09, 2015 5:22 am

Check_http redirect

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check_http redirect

Post by hsmith »

What kind of login page is it? AFAIK, check_http only will accept basic authentication, but I may be wrong.
Former Nagios Employee.
me.
onlyme
Posts: 6
Joined: Wed Dec 09, 2015 5:22 am

Re: Check_http redirect

Post 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?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check_http redirect

Post 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
Former Nagios Employee
onlyme
Posts: 6
Joined: Wed Dec 09, 2015 5:22 am

Re: Check_http redirect

Post 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"
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check_http redirect

Post by hsmith »

Is there anything else you would like help with, or is this resolved?
Former Nagios Employee.
me.
Locked