[Nagiosplug-devel] check_http responce code control
ravenmaster at users.sourceforge.net
ravenmaster at users.sourceforge.net
Fri Dec 14 21:26:30 CET 2007
Mike Lykov wrote:
> I have a site with basic authentication which reply 401 code
> HTTP WARNING: HTTP/1.1 401 Authorization Required
>
> but if site responded like this for my request i think it's live and i
> want to return OK status from the plugin.
Hi Mike,
I struggled with this for a while but ended using the following and it
works well. Note the message returned in the 401 might vary based on
the webserver software. I've included a couple of examples for Apache2
and Sun ONE 6.1. I believe I used curl to determine the exact string
returned by the 401.
In commands.cfg:
# check Apache https website that requires a login
# returns message: "HTTP WARNING: HTTP/1.1 401 Authorization Required"
define command {
command_name check_apache_ssl_auth
command_line $USER1$/check_http -L -w 5 -c 10 -S -e "Authorization Required" -H $ARG1$ -f follow
}
# check Sun ONE webserver https website that requires a login
# returns message: "HTTP WARNING: HTTP/1.1 401 Unauthorized"
define command {
command_name check_sunone_ssl_auth
command_line $USER1$/check_http -L -w 5 -c 10 -S -e "Unauthorized" -H $ARG1$ -f follow
}
Then in services.cfg:
define service {
use generic-service
host_name host.domain.com
service_description HTTPS:securesite.domain.com
check_command check_apache_ssl_auth!securesite.domain.com
...
}
I'm running a later version but I think the "-e" option was included in
previous versions:
$ check_http -V
check_http v1759 (nagios-plugins 1.4.10)
This should be a FAQ.
--
scot
More information about the Devel
mailing list