#!/usr/bin/perl $host = $ARGV[0]; open(FD, "ping -c 3 $host -W 1|"); $i = 0; $is_reply = 0; $avail = 0; while($line = <FD>) { if ($line =~ m/^rtt/) { @_ = split /\//, $line; $is_reply = 1; break; } if ($line =~ m/transmitted/) { @_ = split /, +/, $line; @_ = split /%/, $_[2]; $avail = 100 - $_[0]; } } if ($is_reply == 0) { print "ICMP CHECK FAILURE | avail=$avail"; } else { print "ICMP CHECK OK | avail=$avail time=$_[5]\n"; }
Copyrights © - Joinc, All Rights Reserved. Inherited From - Yundream Rebranded By - Joonphil
Recent Posts
Archive Posts
Tags