[Nagiosplug-devel] check_http responce code control
Thomas Guyot-Sionnest
thomas at zango.com
Fri Dec 14 23:58:26 CET 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
ravenmaster at users.sourceforge.net wrote:
> 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.
Actually there's another way too (I was probably still sleeping while
writing the email this morning...). You can use check_tcp with send and
expect strings to test it.
Just use telnet and send something like this (two CRs after the "Host:"
line; change the hostname to the one associated to your server.):
- --
GET / HTTP/1.1
Host: www.example.com
- --
Look at the reply, then use this send string in check_tcp:
"GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n"
And the expect string should match whatever you got in reply in telnet
(I guess something like "HTTP/1.1 401 Authorization Required").
- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHYwqR6dZ+Kt5BchYRAoBOAKCmywp8jNStwSigevr3qbuaoZMJQwCgtWWF
FF1RIDcpJgmf83fzWHHidMc=
=zz0r
-----END PGP SIGNATURE-----
More information about the Devel
mailing list