#!/usr/bin/perl $iname = $ARGV[0]; if ($#ARGV != 0) { printf("Usage : ./interface.pl [ifname]\n"); exit(1); } open(FD, "/proc/net/dev") || die "Error"; $isok = 0; $data; while($line = <FD>) { if ( $line =~ m/$iname/) { @_ = split /:| +/,$line; $data= "inbps=$_[2] inpps=$_[3] inerrs=$_[4] outbps=$_[10] outpps=$_[11] outerrss=$_[12]"; $isok = 1; break; } } if ($isok == 1) { print "InterFace Status OK | $data"; } else { print "InterFace Status FAILURE |"; }
# ifinfo eth0
Copyrights © - Joinc, All Rights Reserved. Inherited From - Yundream Rebranded By - Joonphil
소개
코드
사용법
Recent Posts
Archive Posts
Tags