HTTP check with different error code

Hi team,

I would like to understand how can i do the http checks with different codes & When any http says unauthorized it says the warning notification with 401 unauthorized. I want this to be ok instead of unauthorized warning. is there anyway i can do this?


apply Service for (http_vhost => config in host.vars.http_vhosts) {
import “generic-service”
display_name = "HTTP: " + http_vhost
check_command = “http”
notes = http_vhost
vars += config

In host i have mentioned these custom attributes:

vars.http_vhosts["ReportServer_SSRS"] = {
   http_uri = "/applicationA"

vars.http_vhosts[“Reports_SSRS”] = {
http_uri = “/applicaitonB”

with this metric, I am getting the below warning. I want this to be okay.

you can handle this e.g. with a bash script. I do a similar thing with a test web server for a collegue. If he is working on the server, the return Code check should never be criticial. Because it’s nothing important und a warning is enough in this situation for him.

So with this bash script I change the return Code for icinga:

/usr/lib64/nagios/plugins/check_http $*
if [ “$?” = “2” ]; then
exit 1;
exit $?

In your case you could grep in the output text for “HTTP/1.1 404 Unothorized” and change the return code.