in reply to Need help writing a basic network monitor.
#!/usr/bin/perl -w use strict; use Net::Ping; my $test_host = 'www.google.com'; my $sleepy_time = 30; print "Network Monitor started at ", scalar localtime, ". (Testing $test_host every $sleepy_time seconds)\n"; my $p = Net::Ping->new(); while (1) { sleep $sleepy_time; next if $p->ping($test_host); print "$test_host appears to be down at ", scalar localtime, "\n"; }
If you wanted to do this properly, then there are plenty of (open source) off-the-shelf Network Monitoring Systems available. Big Brother is one that I have used and would recommend.
Cheers,
Darren :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need help writing a basic network monitor.
by svenXY (Deacon) on Sep 16, 2006 at 08:14 UTC | |
by McDarren (Abbot) on Sep 16, 2006 at 10:36 UTC | |
by fmerges (Chaplain) on Sep 16, 2006 at 11:18 UTC | |
by svenXY (Deacon) on Sep 21, 2006 at 16:18 UTC |