File: ping.pl

package info (click to toggle)
cacti 0.6.7-2.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,000 kB
  • ctags: 1,120
  • sloc: php: 5,059; sql: 922; sh: 302; perl: 81; makefile: 56
file content (11 lines) | stat: -rwxr-xr-x 270 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/perl

if ($ARGV[0]=="x") {
	$db = ":0";
	$ARGV[0] = 2;
}

$response = `ping $ARGV[1] -c $ARGV[0] |grep round-trip| awk '\{print \$4 \}' | awk -F / '\{print \$1 \}' | grep -v "Warning"`;
chomp $response;
$response = $response;
print "$response$db";