Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Net::Ping;
- use Time::HiRes;
- my $host = shift;
- my $p = Net::Ping->new("icmp");
- $p->hires();
- my ($ret, $duration, $ip) = $p->ping($host, 5.5);
- if ( $ret ) {
- printf "%.0f\n", 1000 * $duration;
- } else {
- print "0\n";
- }
- # Value "in" for mrtg
- print "0\n";
- # Value "out" for mrtg
- print "\n";
- # A comment for mrt
- print "$host\n";
- $p->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement