If you have a webserver that you want to check, but it requires authentication, you can still perform a check without seeing an error code. So for example, if you had a webserver where you wanted to check that the web server was responding on port 80, but didn’t want to have the plugin login to the server you can use the -e (expected argument) in the check_http command. This argument tells the plugin to expect a different code from 200 (OK) if that is the normal response.
In this environment there was a web server (SharePoint) where it was wanted to be checked if the web service was there or not. Because it required authentication, the normal state returned would be 401, which normally would be a warning, but using the -e argument this can be set to be the normal response and therefore returning an OK. Only if the plugin returns anything else does a warning or critical get generated.
So for example, i’ve created a specific service check command, but you could just use it as an argument to be passed on a normal check_http command if you want.
define command{
command_name check_http_401
command_line $USER1$/check_http -H $HOSTADDRESS$ -e 401
}
So now you get a response such as:
![](https://www.geekmungus.co.uk/wp-content/uploads/2021/08/image.png)