Page 1 of 1

URL Status Code

Posted: Wed Sep 15, 2021 9:06 am
by btayl
I have User that want us to monitor URL for a Status Code 500 not sure how to do this.

Re: URL Status Code

Posted: Wed Sep 15, 2021 1:11 pm
by btayl
I meant to say only to 500-level errors

Re: URL Status Code

Posted: Wed Sep 15, 2021 3:21 pm
by gsmith
Hi

There's a few ways you could go here, so please answer the following:
1. Do you have access to the webserver(s)?
a. how many webservers are there?
b. what is the Operating System of the webserver(s)?

2. If you don't have access to the webserver(s) we can try using client (browser)

3. Do you want all the 4XX errors? all the 5XX errors? both?

Thanks

Re: URL Status Code

Posted: Thu Sep 16, 2021 6:17 am
by btayl
2 web servers only 5XX errors?
Linux servers but do not have access to the os

Re: URL Status Code

Posted: Thu Sep 16, 2021 4:30 pm
by gsmith
Hi

Go to Configure, Core Config Mananger and create a new service, and set it up as:
Image7.jpg
where $ARG1$ is:
http://www.wa4e.com --invert-regex -r "500 Internal Server Error" -f ok -I 104.21.90.164 -S --sni -p 443

replace http://www.wa4e.com with the website you want to check
replace 104.21.90.164 with the IP of the website you want to check

and $ARG2$ is the URI

You will need to create 10 more of these commands, replacing "500 Internal Server Error" with:
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported
506 Variant Also Negotiates
507 Insufficient Storage
508 Loop Detected
510 Not Extended
511 Network Authentication Required

to see full details of the check_http plugin please see https://nagios-plugins.org/doc/man/check_http.html

Thanks

Re: URL Status Code

Posted: Thu Sep 16, 2021 9:56 pm
by btayl
Thanks for the Help
would this work as well ?

check_http -H httpstat.us -f ok -I 104.21.25.187 -u '/503' -p 80 --invert-regex -r "5.."

since we can use wild cards in regex

Re: URL Status Code

Posted: Fri Sep 17, 2021 6:29 am
by btayl
Is their a way not to show warnings ? because even if I d it the way you showed if I have like a error code 404 it shows a warning ?

Re: URL Status Code

Posted: Fri Sep 17, 2021 10:53 am
by gsmith
Hi

check_http -H httpstat.us -f ok -I 104.21.25.187 -u '/503' -p 80 --invert-regex -r "5.." would only work if
the URL was https://webserver.com/503. So if the error page for a 503 error shows up at that url you would
catch it but not any other 5XX errors because you are limiting the check by the uri
Is their a way not to show warnings ? because even if I d it the way you showed if I have like a error code 404 it shows a warning ?
Wow - didn't notice this....I wonder why it shows as a warning. I am going to have dive into the plugin and see why it
is reporting a warning, especially since we don't have -w or -c options in use. Will let you know once I find out

Thanks