Checking website with LDAP authentication


I am trying to setup a Nagios check that hits a web address and logs in via an LDAP user and password. Using a browser, the website returns a pop-up box asking for username and password. I have tried using the check_http plugin with no success.

check_http -H -u /path_to_secure -S -s “string I am looking for” -a ‘user:password’

The web server log shows the connection coming in but I get an authorization failed (401). We have Sitescope logging into this website and working just fine.

Any ideas or recommendations on how to monitor this?


you should have a log of the authentication attempts… is there anything? or nothing at all?


I run the check with the -v option and get the following:

GET /discoverer/viewer HTTP/1.0
User-Agent: check_http/v1861 (nagios-plugins 1.4.11)
Connection: close
Authorization: Basic c2l0ZXNjb3BlOnBhc3MxMjNcIQ== is 557 characters
STATUS: HTTP/1.1 401 Unauthorized
**** HEADER ****
Server: Sun-ONE-Web-Server/6.1
Date: Mon, 22 Jun 2009 19:02:50 GMT
Set-Cookie: ObSSOCookie=loggedoutcontinue; path=/;;
Set-Cookie: OBBasicAuth=fromDialog; path=/;
WWW-authenticate: basic realm="LDAP username + password"
Set-cookie: OBBasicAuth=fromDialog; path=/;
Connection: close
**** CONTENT ****



Proper authorization is required for this area. Either your browser does not perform authorization, or your authorization has failed. HTTP WARNING: HTTP/1.1 401 Unauthorized

#4 - - [22/Jun/2009:14:02:50 -0500] “GET /discoverer/viewer HTTP/1.0” 401 223 “-” “check_http/v1861 (nagios-plugins 1.4.11)” 2xx.x.xx.x

This is on the webserver log file.


I figured the problem out. Instead of using the -H and putting in the FQDN of the vhost, I put in its IP address and used the -I option. It worked so I knew something was messing up during the resolution of the name. I tried the -H option again, but this time I just used the name without the at the end. It worked both from command line and in the services.cfg file. Thought I would pass this along.


thanks for sharing :slight_smile: