Monitor Traffic - RX and TX

I am trying to write a plugin… i did it based on the check_traffic plugin but used vnstat to do it. I am getting the following error when checking
[blockquote]line 40: : 1.02: integer expression expected[/blockquote]
and it always comes back ok printing the ok line:
[blockquote]Traffc for eth0 is OK. Traffic: 3.24[/blockquote]

here is the code
[blockquote]
#!/bin/bash
#Check Interface Traffic Plugin for Linux: Version 0.1

#Revision:
#06/16 2008 > wrote intial program

VERSION=.1

function show_usage(){
echo “”
echo " Plugin for checking interface traffic based on vnstat"
echo " Please set up vnstat before using this plugin"
echo “”
echo “”
echo " Usage: $0 <— shows Traffic (compat-mode)"
echo " Usage: $0 checktx <— checks Daily TX Traffic"
echo " Usage: $0 checkrx <— checks Daily RX Traffic"
echo " Example: $0 maxtx 120000000 eth0 <----- critical when TX-Bytes greater than 12000000 Bytes"
echo “”
echo “”
echo “”
echo “”
echo " Version: $VERSION"
echo “”

}

function check_traffic_t:evil:) {
INT=$1

CHECKTX=$2

TX=`vnstat -s -i $INT | awk 'NR==4 {print $5}'`

if  $TX -lt $CHECKTX ]; then
	DIFF=`expr $TX - $CHECKTX`
	echo "CRITICAL: Traffic limit has exceeded by $DIFF MB!"
else
	echo "Traffc for $INT is OK. TX Traffic: $TX MB"
fi

}

function check_traffic_r:evil:) {
INT=$1

CHECKRX=$2

RX=`vnstat -s -i $INT | awk 'NR==4 {print $2}'`


if  $CHECKRX -lt $RX ]; then
	DIFF=`expr $RX - $CHECKRX`
	echo "CRITICAL: Traffic limit has exceeded by $DIFF MB!"
else
	echo "Traffc for $INT is OK. RX Traffic: $RX MB"
fi

}

function show_traffic() {

INT=$1

RX=`vnstat -s -i $INT | awk 'NR==4 {print $2}'`
TX=`vnstat -s -i $INT | awk 'NR==4 {print $5}'`


echo "TX: $TX MB    RX: $RX MB"
exit 0

}

if -z “$1” ]; then
show_usage
exit 2
fi

case $1 in
–help)
show_usage
exit 0
;;
int)
if -z $2 ];then
echo “Usage: $0 int ”
else
INT=$2
show_traffic $INT
fi
;;
eth*)
INT=$1
show_traffic $INT
;;
checkt:evil:
INT=$3
CHECKTX=$2
check_traffic_tx $INT $CHECKTX
;;
checkr:evil:
INT=$3
CHECKTX=$2
check_traffic_rx $INT $CHECKRX
;;
init)
INT=$2
init $INT
;;
*)
show_usage
exit 1
;;
esac
[/blockquote]

Thank you so much to anyone who can help!

Got it working, used this script:

[blockquote]
#!/bin/bash
#Check Interface Traffic Plugin for Linux: Version 0.1

#Revision:
#06/16 2008 > wrote intial program

VERSION=.1

function show_usage(){
echo “”
echo " Plugin for checking interface traffic based on vnstat"
echo " Please set up vnstat before using this plugin"
echo “”
echo “”
echo " Usage: $0 <— shows Traffic (compat-mode)"
echo " Usage: $0 checktx <— checks Daily TX Traffic"
echo " Usage: $0 checkrx <— checks Daily RX Traffic"
echo " Example: $0 maxtx 120000000 eth0 <----- critical when TX-Bytes greater than 12000000 Bytes"
echo “”
echo “”
echo “”
echo “”
echo " Version: $VERSION"
echo “”

}

function check_traffic_t:evil:) {
INT=$1

CHECKTX=$2

TX=vnstat -s -i $INT | awk 'NR==4 {print $5}'

if echo $CHECKTX $TX |awk '{print ($1 < $2) ? "true" : "false" }' = “true” ]; then
echo “CRITICAL: Traffic limit has exceeded $CHECKTX. TX Traffic is $TX MB!”
else
echo “Traffc for $INT is OK. TX Traffic: $TX MB”
fi

}

function check_traffic_r:evil:) {
INT=$1

CHECKRX=$2

RX=vnstat -s -i $INT | awk 'NR==4 {print $2}'

if echo $CHECKTX $TX |awk '{print ($1 < $2) ? "true" : "false" }' = “true” ]; then
echo “CRITICAL: Traffic limit has exceeded $CHECKRX. RX Traffic is $DIFF MB!”
else
echo “Traffc for $INT is OK. RX Traffic: $RX MB”
fi

}

function show_traffic() {

INT=$1

RX=vnstat -s -i $INT | awk 'NR==4 {print $2}'
TX=vnstat -s -i $INT | awk 'NR==4 {print $5}'

echo “TX: $TX MB RX: $RX MB”
exit 0
}

if -z “$1” ]; then
show_usage
exit 2
fi

case $1 in
–help)
show_usage
exit 0
;;
int)
if -z $2 ];then
echo “Usage: $0 int ”
else
INT=$2
show_traffic $INT
fi
;;
eth*)
INT=$1
show_traffic $INT
;;
checkt:evil:
INT=$3
CHECKTX=$2
check_traffic_tx $INT $CHECKTX
;;
checkr:evil:
INT=$3
CHECKTX=$2
check_traffic_rx $INT $CHECKRX
;;
init)
INT=$2
init $INT
;;
*)
show_usage
exit 1
;;
esac
[/blockquote]