[TriLUG] OT: Amiable ping target
William Sutton
william at trilug.org
Fri Aug 26 10:11:38 EDT 2005
FYI, here is a little keep-alive script I use for my shells outside $WORK
(so the session doesn't time out). It should be a quick thing to modify
for your purpose:
#####
#!/usr/bin/perl
use strict;
my @hosts = (
"yahoo.com",
"google.com",
"newsobserver.com",
);
while()
{
my $items = scalar(@hosts);
my $item = int($items * rand());
`ping -c 1 $hosts[$item]`;
print ".";
`sleep 20`;
}
#####
the my @hosts ... portion could easily be modified to read from a file as
follows:
1. install File::Slurp
2. add 'use File::Slurp;' after 'use strict;'
4. replace 'my @hosts = ( ... );' with the following snippet:
my @hosts = map { chomp($_); $_; } read_file("your_host_file.txt");
best of luck...
On Fri, 26 Aug 2005, Brian Henning wrote:
> Hi Folks,
> Pardon my ignorance...but is there an IP somewhere out there that is
> specifically set up to be a ping target for checking connectivity?
> We're having some serious issues with our DSL here lately, and I want to
> set up a task to monitor it with pretty high resolution, say, around one
> ping per second (I have a feeling some of its frequent flakings are only
> seconds in length, but enough to interrupt our VPN).
>
> Obviously, doing this sort of thing would require a target (or more
> probably, list of targets) that are highly reliable themselves, to avoid
> false down indications. So I'd probably create a list of N targets, and
> each would only see a ping from me every N seconds unless one failed, in
> which case the process would ping the next target on the list immediately.
>
> My concern, of course, being a [hopefully] nice little Net citizen, is
> not wanting to irritate anyone by taking about 302kB out of their
> transfer quota every hour (3600 pings * 84 bytes each), unless they're
> intending to be so generous.
>
> In other words, I have a feeling I shouldn't just randomly choose some
> hosts (unless I choose a huge number of them...a possibility). Hence
> the question.
>
> And as a sideline question, if there's a nice utility out there already
> to do something like that (take a list of hosts and ping one every X
> seconds and report on the success), I'd love to know about it.
>
> Thanks a bunch as always!
> ~Brian
>
More information about the TriLUG
mailing list