[mrtg] Help with Mrtg -newbie
Peter Langberg
langberg at senet.com.au
Thu Apr 17 11:24:51 MEST 2003
G'day,
I've just recently set-up a Linux gateway using ADSL and are using MRTG to monitor the network usage,
When I open the page on my server, no graphs show only the title bar with two email addresses on it and the coloured
writing. I have set the files to run mrtg.conf in the crontab file every 10mins and are using a script made by atomic
(magazine)
#!/bin/sh
#
# Monthlystats script version 1.1.
#
# This is a simple script to tally the input/output totals of a
# network card in megabytes, resetting on monthly boundaries, to
# be passed onto MRTG for total throughput history graphing.
#
# Useful for keeping track of current and past broadband usage to
# help stay under the ISP's cap.
#
# This script takes the card to monitor as argument and returns
# the current total values. It keeps one non-growing log file in
# order to build ongoing totals, and another to list completed
# months. The script has reset protection in that if the server is
# reset, or the /proc stats reset, it will simply pick up where it
# left off. Free free to upgade kernels without resetting your stats!
#
# Should be used in conjuction with the Atomic MRTG configuration
# file to graph total throughput statistics over time.
#
# Ashton Mills
# Written for the Atomic Uber-Linux box guide,
# Issue 21 of Atomic, Oct 2002.
#
NIC=$1
LOG="/var/log/$NIC-totals.log"
TOTALS_LOG="/var/log/$NIC-Monthly-Totals.log"
IN_ETH=`echo $(cat /proc/net/dev |grep $NIC |cut -d : -f2 |awk '{print $1}') / 1048576 |bc`
OUT_ETH=`echo $(cat /proc/net/dev |grep $NIC |cut -d : -f2 |awk '{print $9}') / 1048576 |bc`
RESET=`date |awk '{print $2}'`
if [ -s $LOG ]; then
IN_LOG=`cat $LOG |awk '{print $1}'`
OUT_LOG=`cat $LOG |awk '{print $2}'`
RESET_IN_LOG=`cat $LOG |awk '{print $3}'`
RESET_OUT_LOG=`cat $LOG |awk '{print $4}'`
MONTH_LOG=`cat $LOG |awk '{print $5}'`
else
RESET_IN_LOG=0; RESET_OUT_LOG=0; IN_LOG=0
MONTH_LOG=$RESET
fi
if [ `expr $IN_ETH + $RESET_IN_LOG` -lt $IN_LOG ]; then RESET_IN_LOG=$IN_LOG; fi
if [ `expr $OUT_ETH + $RESET_OUT_LOG` -lt $OUT_LOG ]; then RESET_OUT_LOG=$OUT_LOG; fi
IN_ETH=`expr $IN_ETH + $RESET_IN_LOG`
OUT_ETH=`expr $OUT_ETH + $RESET_OUT_LOG`
echo $IN_ETH
echo $OUT_ETH
if [ $RESET != $MONTH_LOG ]; then
echo "$(date |awk '{print $6}') $MONTH_LOG -- IN: $IN_ETH MBs OUT: $OUT_ETH MBs" >> $TOTALS_LOG
RESET_IN_LOG=$RESET_IN_LOG - $IN_ETH
RESET_OUT_LOG=$RESET_OUT_LOG - $OUT_ETH
IN_ETH="0"
OUT_ETH="0"
fi
echo $IN_ETH $OUT_ETH $RESET_IN_LOG $RESET_OUT_LOG $RESET > $LOG
Sorry if its long,
I'm using MRTG - mrtg-2.9.22-1mdk.i586.rpm
and it is all installed in /var/www/html/mrtg and running on the apache websever, but no graphs show, I know that there is defiantly traffic going through,
your help is greatly appreciated
Ben Langberg
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list