I have an old monitor which tested the proxy rather then the webserver...
The monitor lacks a little in documentation, but...
In mon.cf
monitor myhttp.monitor --all --proxy=http://your.proxy.com/
http://your.webserver.com/page1.html http://your.webserver.com/page2.html
http://your.webserver.com/page3.html
When using --all, the monitor will alert only if none of the webpages could be
retrieved...
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use LWP::Simple;
use Getopt::Long;
#
# Usage:
#
# --proxy= which proxy server to use
# --all= only return error if no web pages could be reached
#
#
my($proxy) = undef;
my($all) = undef;
GetOptions("proxy=s",\$proxy, "all",\$all);
my($ua);
$ua = new LWP::UserAgent;
$ua->agent("Mozilla/4.7 [en]C-EMW (WinNT; I)");
if ( $proxy) {
$ua->proxy(['http'], $proxy);
}
$ua->timeout(20);
my($err) = 0;
my($errstr) = "";
my($ok) = 0;
my(%all);
my($src);
foreach $src ( @ARGV ) {
my($res);
$res = $ua->get($src);
if ($res->is_success) {
$ok++;
}
else {
$err++;
$errstr .= "$src ";
}
$all{$src}=$res->status_line;
}
if ( ! $err ) {
# If no errors were found, dont report error..
exit(0);
}
if ( $all ) {
# Dont report error if we could get som pages...
if ( $ok ) {
exit(0);
}
}
my($maxlen) = 0;
foreach ( keys %all ) {
my($l) = length($_);
$maxlen = $l if ( $l > $maxlen );
}
$maxlen++;
print $errstr . "\n";
foreach ( sort keys %all ) {
printf("%-*.*s -> %s\n",$maxlen,$maxlen,$_,$all{$_});
}
print "\n$err errors found\n";
exit($err);
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of pingouin osmolateur
> Sent: den 8 februari 2006 11:18
> To: [email protected]
> Subject: Http and proxy
>
>
> Hi every body
>
> I want to monitor Http server but I have to access
> through a proxy. I saw the http_tp.monitor but It's
> not possible to specify the proxy port for me 8080.
>
> Can I use the variable $http_proxy from bash
> environement ?
>
> Do you have an idea
>
> Thanks for yours answers
> AC
>
>
>
>
>
>
>
> ______________________________________________________________
> _____________
> Nouveau : téléphonez moins cher avec Yahoo! Messenger !
> Découvez les tarifs exceptionnels pour appeler la France et
> l'international.
> Téléchargez sur http://fr.messenger.yahoo.com
>
> _______________________________________________
> mon mailing list
> [email protected]
> http://linux.kernel.org/mailman/listinfo/mon
>
_______________________________________________
mon mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/mon