• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

Squid alive ping script

I'm running a squid proxy server and I need a script or tool which can ping a website through the proxy to see if the proxy is running right. When the ping fails it should send an email to a specific address. I wrote already one but it only can ping ips and DNS. I already tried web-o-ping but it won't run on my redhat box.
0
timan72
Asked:
timan72
1 Solution
 
stefan73Commented:
Hi timan72,
You could use a Perl script:

use LWP;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new();
$ua->proxy(http  => 'http://your_squid:8080');
$ua->timeout(15); # Set it to appropriate value

my $res=$ua->request(HTTP::Request->new(GET => ($url)));

unless ($res->is_success) {
    print STDERR "Site is dead\n";
    return;
}

Make sure squid does not cache the page you retrieve.


Cheers,

Stefan
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now