ifconfig 에서 트래픽 잡기

페이지 정보

작성자 조희승 댓글 0건 조회 5,707회 작성일 12-08-17 15:14

본문

ifconfig eth0 | grep bytes | awk -F: '{print $3}' | awk '{print $1}'
ifconfig eth0 | grep bytes | awk -F: '{print $2, $3}' | awk '{print $1, $6}'
자동으로 찍는 php
#!/usr/bin/php
<?
$cmd="ifconfig eth0 | grep bytes | awk -F: '{print $2, $3}' | awk '{print $1, $6}'";
$a=system($cmd);
echo $a ."\n";
$stxrx=explode(" ", $a);
for ($i=0; $i<30; $i++)
{
$a=system($cmd);
$txrx=explode(" ", $a);
$rx=$txrx[0]-$stxrx[0];
$tx=$txrx[1]-$stxrx[1];
echo "$i $rx $tx \n";
sleep(1);
}
?>

댓글목록

등록된 댓글이 없습니다.