Page 1 of 2
check_http "HTTP/1.1 302 Found"
Posted: Wed Jan 13, 2021 9:13 pm
by sacom01
I'm trying to trace respone time of my website with check_http plugins, but it did not work with the context root. "HTTP/1.1 302 Found" error
[root@dc-nagiosxi-uat01 libexec]# ./check_http -I 192.168.xxx.xx -p 443 -H 123.abc.com -S -w 2 -c 3
HTTP OK: HTTP/1.1 200 OK - 1388 bytes in 0.018 second response time |time=0.018339s;2.000000;3.000000;0.000000 size=1388B;;;0
[root@dc-nagiosxi-uat01 libexec]# ./check_http -I 192.168.xxx.xx -p 443 -H 123.abc.com -u /xyz -S -w 2 -c 3
HTTP OK: HTTP/1.1 302 Found - 226 bytes in 0.062 second response time |time=0.062104s;2.000000;3.000000;0.000000 size=226B;;;0
Re: check_http "HTTP/1.1 302 Found"
Posted: Thu Jan 14, 2021 4:39 pm
by benjaminsmith
HI
@sacom01,
Please try adding the following to your check command to follow the redirect and let me know if that works now.
Best Regards,
Benjamin
Re: check_http "HTTP/1.1 302 Found"
Posted: Thu Jan 14, 2021 8:23 pm
by sacom01
hi Ben,
thanks for support.
another error once adding -f follow
[root@dc-nagiosxi-uat01 libexec]# ./check_http -I 192.168.xxx.xx -p 443 -H 123.abc.com -u /xyz -S -w 2 -c 3 -f follow
check_http: Invalid hostname/address - 123.abc.com
Re: check_http "HTTP/1.1 302 Found"
Posted: Fri Jan 15, 2021 3:17 pm
by benjaminsmith
Hi
@sacom01,
That's odd, I tested that same command string (agianst) on another site, and that syntax is working. Are you able to resolve the IP address?
There maybe an error with the hostname or IP address.
Benjamin
Re: check_http "HTTP/1.1 302 Found"
Posted: Sun Jan 17, 2021 11:35 pm
by sacom01
hi Ben,
First,
I found the the problem,
I have proxy ip is 192.168.xxx.xx (which i traced like you saw) and 2 server https.
I just change 192.168.xxx.xx from IP of proxy to 1 one 2 ip https server --> it's ok.
Second,
I want add one more step to my trace command : user and password; to login to my website --> to know exact the url is too slow for end user or not.
I use -a "username:password" option, but when i input wrong pw it still respone OK.
Do you have any suggest for this?
Many thanks.
Re: check_http "HTTP/1.1 302 Found"
Posted: Mon Jan 18, 2021 2:22 am
by sacom01
And why i can use "-f follow" only, can not use -f critical, -f warning... --> "HTTP/1.1 302 Found" error
if do not specified -f follow, it will getting HTTP/1.1 302 Found error as well
i 'm confuse with this option

Re: check_http "HTTP/1.1 302 Found"
Posted: Tue Jan 19, 2021 11:12 am
by benjaminsmith
Hi
What status code are you getting when you choose -f critical or -f warning, can you post the full output of the check command with the --verbose option?
-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>
How to handle redirected pages. sticky is like follow but stick to the
specified IP address. stickyport also ensures port stays the same.
Regards,
Benjamin
Reference
Here's the man page for check_http
https://www.monitoring-plugins.org/doc/ ... _http.html
Re: check_http "HTTP/1.1 302 Found"
Posted: Tue Jan 19, 2021 8:39 pm
by sacom01
hi Ben,
my website redirect to servlet so i think we have to trace the redirect-url. But dont know why -f follow still work
Pls help me the above question about login -a "username:password".
Thanks Ben.
[root@dc-nagiosxi-uat01 libexec]# ./check_http -I 192.168.xxx.xx -p 443 -H 192.168.xxx.xx -u /xyz -S -w 2 -c 3 -f follow
HTTP OK: HTTP/1.1 200 OK - 439 bytes in 0.082 second response time |time=0.081541s;2.000000;3.000000;0.000000 size=439B;;;0
[root@dc-nagiosxi-uat01 libexec]# ./check_http -I 192.168.xxx.xx -p 443 -H 192.168.xxx.xx -u /xyz -S -w 2 -c 3 -f warning
HTTP WARNING: HTTP/1.1 302 Found - 216 bytes in 0.020 second response time |time=0.019866s;2.000000;3.000000;0.000000 size=216B;;;0
[root@dc-nagiosxi-uat01 libexec]# ./check_http -I 192.168.xxx.xx -p 443 -H 192.168.xxx.xx -u /xyz -S -w 2 -c 3 -f critical
HTTP CRITICAL: HTTP/1.1 302 Found - 216 bytes in 0.061 second response time |time=0.060633s;2.000000;3.000000;0.000000 size=216B;;;0
================================
[root@dc-nagiosxi-uat01 libexec]# ./check_http -I 192.168.xxx.xx -p 443 -H 123.abc.com -u /xyz/servlet/BrowserLoginServlet -S -w 2 -c 3 -f warning
HTTP OK: HTTP/1.1 200 OK - 1246 bytes in 0.023 second response time |time=0.022866s;2.000000;3.000000;0.000000 size=1246B;;;0
[root@dc-nagiosxi-uat01 libexec]# ./check_http -I 192.168.xxx.xx -p 443 -H 123.abc.com -u /xyz/servlet/BrowserLoginServlet -S -w 2 -c 3 -f critical
HTTP OK: HTTP/1.1 200 OK - 1246 bytes in 0.063 second response time |time=0.062866s;2.000000;3.000000;0.000000 size=1246B;;;0
Re: check_http "HTTP/1.1 302 Found"
Posted: Wed Jan 20, 2021 4:32 pm
by ssax
302 means there is a redirect in place on the webserver.
You want to use -f follow so the check follows the redirects to the final page just like the browser does (your browser follows the redirects), -f is only related to redirects.
Unless you intend on only checking the redirection or the page before the redirection (not many would want to do that), use -f follow.
For the authentication check, does your application support basic auth? (check_http doesn't allow form based authentication or NTML based authentication)
What is the output of the commands with -v added (do it with the actual password and a wrong password and send us the full output (you can PM me it if needed)):
Code: Select all
./check_http -I 192.168.xxx.xx -p 443 -H 192.168.xxx.xx -u /xyz -S -w 2 -c 3 -f follow -a 'username:password' -v
./check_http -I 192.168.xxx.xx -p 443 -H 192.168.xxx.xx -u /xyz -S -w 2 -c 3 -f follow -a 'username:wrongpassword' -v
You can see how it works on mine:
- You can just run these command from your XI server CLI and adjust the nagiosadmin password to validate it's working properly against an actual basic auth setup
Code: Select all
[root@xid ~]# /usr/local/nagios/libexec/check_http -I 127.0.0.1 -p 443 -H 127.0.0.1 -u /nagios -S -w 2 -c 3 -f follow -a 'nagiosadmin:rightpassword'
HTTP OK: HTTP/1.1 200 OK - 1283 bytes in 0.007 second response time |time=0.006674s;2.000000;3.000000;0.000000 size=1283B;;;0
And with the wrong password:
Code: Select all
[root@xid ~]# /usr/local/nagios/libexec/check_http -I 127.0.0.1 -p 443 -H 127.0.0.1 -u /nagios -S -w 2 -c 3 -f follow -a 'nagiosadmin:wrongpassword'
HTTP WARNING: HTTP/1.1 401 Unauthorized - 639 bytes in 0.004 second response time |time=0.004087s;2.000000;3.000000;0.000000 size=639B;;;0
Re: check_http "HTTP/1.1 302 Found"
Posted: Wed Jan 20, 2021 10:47 pm
by sacom01
hi ssax,
thanks for your respone.
My login is not basic authen. it is login to application so i guess can not use -a option in this plugin.
