Page 1 of 1

Authorization not being passed in http check.

Posted: Wed Feb 08, 2017 2:57 pm
by nthaler
Hi Nagios!

We currently run both Tomcat 5.5 and 7.

For 5.5 one of the checks we run is this;
/usr/local/nagios/libexec/check_http -H $HOSTNAME$ -p 8080 -t 50 -a $USER6$ -u '/manager/html/list' -R 'tomcat'

For Tomcat 7 we want to run almost the exact same check;
/usr/local/nagios/libexec/check_http -H $HOSTNAME$ -p 8080 -t 50 -a $USER6$ -u /manager/status -R 'tomcat'

The one for Tomcat 5.5 returns a success and the one for Tomcat 7 returns a 401.
[nthaler@nagios-02 ~]$ /usr/local/nagios/libexec/check_http -H wa-server-prod-30 -p 8080 -t 50 -a user:pw -u '/manager/status' -R Tomcat
HTTP WARNING: HTTP/1.1 401 Unauthorized - 2971 bytes in 0.002 second response time |time=0.002126s;;;0.000000 size=2971B;;;0

We have tested through the web browser and the username and pw work manually. Any idea why it is failing with a 401?

Re: Authorization not being passed in http check.

Posted: Wed Feb 08, 2017 3:00 pm
by rkennedy
Can you please run the following with -v appended so we can get a bit of verbose output?

Code: Select all

/usr/local/nagios/libexec/check_http -H wa-server-prod-30 -p 8080 -t 50 -a user:pw -u '/manager/status' -R Tomcat -v
Then, please run a regular curl with -v as well for us to review. (regular and w/ login)

Code: Select all

curl http://wa-server-prod-30:8080/manager/status -v
curl -u user:pass http://wa-server-prod-30:8080/manager/status -v
(may need to modify these slightly, but based on what you provided I think these are correct.)

This will provide a bit of information as to what's going on. Does the username / password have any special characters at all?

Re: Authorization not being passed in http check.

Posted: Wed Mar 01, 2017 1:58 pm
by tmcdonald
Just checking in since we have not heard from you in a while. Did @rkennedy's post clear things up?