mainarea
08-27-2004, 11:45 AM
I'm using cacti & their ping script. The problem is, if one of the hosts is down, it just lingers for a long time. Here's the script:
#!/usr/bin/perl
$ping = `ping -c 1 $ARGV[0] | grep icmp_seq`;
$ping =~ m/(.*time=)(.*) (ms|usec)/;
print $2;
How can I add an argument so that if the script doesn't return a result within 5 seconds, it displays the result "0" and kills the ping process?
- Matt
#!/usr/bin/perl
$ping = `ping -c 1 $ARGV[0] | grep icmp_seq`;
$ping =~ m/(.*time=)(.*) (ms|usec)/;
print $2;
How can I add an argument so that if the script doesn't return a result within 5 seconds, it displays the result "0" and kills the ping process?
- Matt
