트래픽 체크 하기
[root@localhost /]# vi trapic.sh
------------------------------------------------
#!/bin/sh
if [ "$1" != "" ]; then
# ethnet device
ETH="$1:"
CHECK=/proc/net/dev
CAT=/bin/cat
GREP="/bin/grep ${ETH}"
SED="sed -e s/${ETH}//"
UPTIME=/usr/bin/uptime
# parcket user check
set `${CAT} ${CHECK} | ${GREP} | ${SED}`
# Transmit packet
let "in1 = $1"
let "out1 = $9"
echo "측정중입니다. 기다려주세요"
sleep 1
set `${CAT} ${CHECK} | ${GREP} | ${SED}`
let "in0 = $1"
let "out0 = $9"
let " in = ($in0 - $in1)/(10*1024)"
let " out = ($out0 - $out1)/(10*1024)"
echo "수신(in) $in kbyte/s"
echo "송신(out) $out kbyte/s"
else
echo "USAGE: $0 [ethernet device no]"
echo "ex) ./$0 eth0"
fi
exit 0
------------------------------------------------
[root@localhost /]# ./trapic.sh
USAGE: ./trapic.sh [ethernet device no]
ex) ././trapic.sh eth0
[root@localhost /]# ./trapic.sh eth0
측정중입니다. 기다려주세요
수신(in) 0 kbyte/s
송신(out) 0 kbyte/s
위와 같이 체크하면 된다.
2009. 3. 30.
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기