[Nagiosplug-devel] check_http + proxy

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Sat Jan 1 01:14:08 CET 2005


Dear Sir,

I am writing to thank you for your letter and say,

On Fri, Dec 31, 2004 at 06:49:46PM +0100, Julien TOUCHE wrote:

> >tsitc> ./check_http -H a.b.c.d -u http://cisco.com/ -v |& more
> thanks a lot, it works good, but ...
> 
> it does not seem to work with https://host
> 

Oh. I guess that it is unlikely to (the check needs to invoke the 
CONNECT method on the proxy not a GET or POST) without significant 
hacking.

> note: i try also the check_wget but
> #  /export/tmp/check_wget -p proxy:port www
> http://www - Object not found WARNING
> 

I am sorry about that (not familiar with wget although it is popular).

Stand alone tools include :- lynx (it comes in a plain and SSL vers)

Libraries include (Perl only) :


CURL: very popular Perl extension. 
      To my mind, interface is not as flexible as LWP (and I
don't know if it does SSL although I would be suprised if it
didn't)

LWP: very popular and proven. Requires Crypt::SSLeay for
     near transparent (to client code) SSL access - by setting
     env var.

eg Here's part of a plugin based on Nagios::WebTransact (a LWP wrapper 
that is deprecated except for me)

my $QwebPrd_viewer     = 
'https://qwebprd.questel.fr/imag2000/en/logon.html' ;
my $QwebPrd_viewer_exp = 'Welcome to Questel-Orbit - Your guide to 
Intellectual Property' ;

my $SquidFault          = 'X-Squid-Error: ERR' ;

my $Proxy              = { server       => 'http://a.b.c.d:80' } ;

# Crypt::SSLeay support for proxys

$ENV{HTTPS_PROXY} = 'http://a.b.c.d:80' ;

# Crypt::SSLeay support for proxys


my $URLS               = [
  {Method => 'GET',     Url => $QwebPrd_viewer, Qs_var => [],   Qs_fixed 
=> [], Exp => $QwebPrd_viewer_exp, Exp_Fault => $SquidFault},
        ] ;

my $x = Nagios::WebTransact->new( $URLS ) ;
my ($rc, $message) =  $x->check( {}, timeout => $timeout || $TIMEOUT, 
debug => $debug, proxy => $Proxy ) ;

print "QwebPrd start page. $message\n" ;
exit($rc ? $ERRORS{'OK'} : $ERRORS{'CRITICAL'}) ;


You may even be able to get away with LWP::Simple for one-shot
https URLs.

It's an easy library to live with (written by a cast of thousands 
including Gisle Aas).

Other LWP based classes: eg WWW::Automate 

These provide a simplified API to LWP for the common cases of 
GET|POSTing URLs and matching the HTML against regexps (used for web 
transaction health checks, in which a transaction consists of a 
sequence of web pages [register, search, examine details, clean-up]).

WWW::Automate is actively developed by a known good developer (Andy 
Lester). It would prob do what you want in 1 line of client code.

All but CURL on a CPAN near you.

BTW, thanks very much for your contributions to Ntop and other good 
things.

Yours sincerely.

-- 
Stanley Hopcroft

IP Australia
Ph: (02) 6283 3189  Fax: (02) 6281 1353
PO Box 200 Woden  ACT 2606
http://www.ipaustralia.gov.au
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: disclaimer.txt
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20050101/c5ff3ea0/attachment.txt>


More information about the Devel mailing list