I use the Net::Ping in NT everyday. I wrote a small system monitoring package that checks hosts via ping, telnet, http, and dbi. The script just runs a loop and checks different hosts with different methods, logs any failures, and pages me if it's down more than once.
Here is the relevant ping code. This works on NT with the activestate perl and the Net::Ping package installed with the ppm tool. I had no problems with alarm. The only problem I've had with Net::Ping is that it requires root when running in unix...
#!/usr/bin/perl @pinglist=("www.yahoo.com", "www.thisisntreal.com", "wlindsey.bbcg.com +"); use Net::Ping; sub test_ping; foreach $h (@pinglist) { if (test_ping($h)) { print "[p (ok) $h]"; } else { print "[p <NO> +$h]"; } print "\n"; } sub test_ping { # test_ping($hostname) my $hostname=shift; my $p=Net::Ping->new(icmp,5); return $p->ping($h,5); $p->close; } # end test_ping
In reply to Re: Alarm Implemented in Win32?
by elwarren
in thread Alarm Implemented in Win32?
by buzzcutbuddha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |