[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Monitoring from one place on the globe



Since I've got lots of other things to do, the enclosed Perl script fell 
out of my keyboard today.
I've set it to run every hour at a machine in a remote machine room in 
Trondheim. It will be interesting to see if it records anything interesting.

Example output:

2000-08-14T12:05 SUCCESS 20 574.342 embratel-fapesp.NewYork.cw.net
^                ^       ^    ^     ^
timestamp        result  hops delay last router before aroot.psg.com

The result is SUCCESS if the last response came from aroot.psg.com, FAILURE 
otherwise (and the router name is then the last router on traceroute output).

Currently, the aroot closest to Norway seems to be in Brazil.

               Harald

#!/usr/bin/perl
# Ping the aroot nameserver, finding out where it is
$date = `date +%Y-%m-%dT%H:%M`;
chop $date;
$tracert = `/usr/sbin/traceroute -f 9 aroot.psg.com 2>/dev/null | tail -2`;
($prev, $last) = split(/\n/, $tracert);
($hopc, $hostp, $ip, $delay) = split(/\s+/, $prev);
($hopc, $host, $ip, $delay) = split(/\s+/, $last);
if ($host =~ /^aroot.psg.com/i) {
     print "$date SUCCESS $hopc $delay $hostp\n";
} else {
     print "$date FAILURE $hopc $delay $host\n";
}

--
Harald Tveit Alvestrand, alvestrand@cisco.com
+47 41 44 29 94
Personal email: Harald@Alvestrand.no