check_http - ok status for http errors

Matthieu Parisot mat at avedya.com
Thu Mar 13 12:21:57 CET 2003


Xfer wrote:

>Hi,
>
>I want to be able to use the plugin check_http to return an ok status if the http server returns error status like 404 or 401,
>
>Does anyone know if there are some weard switches that can be used?
>
>Or has anyone developed a script to do this?
>
>Cheers
>
>Ed
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by:Crypto Challenge is now open! 
>Get cracking and register here for some mind boggling fun and 
>the chance of winning an Apple iPod:
>http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
>_______________________________________________
>Nagios-users mailing list
>Nagios-users at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/nagios-users
>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
>::: Messages without supporting info will risk being sent to /dev/null
>  
>
I suggest that you write a shell plugin using curl, which allows you to 
display only the http_code that you want:
#! /bin/bash
HTTPCODE=$(curl -o /dev/null -s -w "%{http_code}\n" http://www.example.com/)
err=$?
if ! [ $err -eq 0 ]
then
     echo "Sorry, curl failed : $err code returned"
fi
case $HTTPCODE in
200)
echo "Http code 200 was returned"
;;
401)
echo "Http code 401 was returned"
;;
*)
echo "Httpcode $HTTPCODE was returned"
;;
esac

Regards,
Matthieu



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list