check_http "HTTP/1.1 302 Found"

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

check_http "HTTP/1.1 302 Found"

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: check_http "HTTP/1.1 302 Found"

Post 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.

Code: Select all

-f follow
Best Regards,
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: check_http "HTTP/1.1 302 Found"

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: check_http "HTTP/1.1 302 Found"

Post 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?

Code: Select all

nslookup 123.abc.com
There maybe an error with the hostname or IP address.

Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: check_http "HTTP/1.1 302 Found"

Post 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.
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: check_http "HTTP/1.1 302 Found"

Post 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 :(
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: check_http "HTTP/1.1 302 Found"

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: check_http "HTTP/1.1 302 Found"

Post 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 :lol:
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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: check_http "HTTP/1.1 302 Found"

Post 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
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: check_http "HTTP/1.1 302 Found"

Post 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. :(
Locked