Here a short example (taken from a article in the linux magazin) TRAFLOG=/var/log/iptraf/tcp_udp_services-eth1.log WDIR=/usr/local/iptraf-stats TODAY=$(/bin/date +%s) UDATE=$(/bin/date +%Y%m%d) echo -n "Extracting Data from Logfile $TRAFLOG... " SMTP=$(grep "TCP/25" $TRAFLOG|tail -n1| cut -f2 -d"," | cut -f2 -d" ") HTTP=$(grep "TCP/80" $TRAFLOG|tail -n1| cut -f2 -d"," | cut -f2 -d" ") POP3=$(grep "TCP/110" $TRAFLOG|tail -n1| cut -f2 -d"," | cut -f2 -d" ") IMAP=$(grep "TCP/143" $TRAFLOG|tail -n1| cut -f2 -d"," | cut -f2 -d" ") echo "Values smtp: $SMTP" echo "Values pop3: $POP3" echo "Values imap: $IMAP" echo "Values http: $HTTP" # archieve results echo -n "Archieving results...$WDIR/data/*... " echo $SMTP >> $WDIR/data/smtp-history.$UDATE echo $POP3 >> $WDIR/data/pop3-history.$UDATE echo $IMAP >> $WDIR/data/imap-history.$UDATE echo $HTTP >> $WDIR/data/http-history.$UDATE echo -n "Updating RRD-Graphics and generate GIF... " rrdtool update $WDIR/rrd/mailserver.rrd $TODAY:$SMTP:$POP3:$IMAP rrdtool graph /var/www/portstats/mailserver.gif \ --start -86400 \ --vertical-label="bytes per second" \ -w 600 -h 200 \ DEF:smtp=$WDIR/rrd/mailserver.rrd:smtp:AVERAGE \ DEF:pop3=$WDIR/rrd/mailserver.rrd:pop3:AVERAGE \ DEF:imap=$WDIR/rrd/mailserver.rrd:imap:AVERAGE \ AREA:smtp#00ff00:"SMTP traffic" \ LINE1:pop3#0000ff:"POP3 traffic" \ LINE2:imap#ff0000:"IMAP traffic" > /dev/null rrdtool update $WDIR/rrd/webserver.rrd $TODAY:$HTTP:$HTTPS rrdtool graph /var/www/portstats/webserver.gif \ --start -86400 \ --vertical-label="bytes per second" \ -w 600 -h 200 \ DEF:http=$WDIR/rrd/webserver.rrd:http:AVERAGE \ DEF:https=$WDIR/rrd/webserver.rrd:https:AVERAGE \ AREA:http#00ff00:"HTTP traffic" > /dev/null echo "Done" Cheers, Andreas hareram (hareram@xxxxxxxxxx) schrieb: > > Hi > > do you have any example to parse the graph with rrd tools > > hare > ----- Original Message ----- > From: "Andreas Unterkircher" <unki@xxxxxxxxxxxx> > To: <lartc@xxxxxxxxxxxxxxx> > Sent: Friday, June 17, 2005 11:49 AM > Subject: Re: Bandwidth monitoring tool > > > > You can do this with iptraf. You can call it with > > > > iptraf -s{yourinterface} -t1 -B > > > > and it will output per port statistics in it's logfile for 1 minute (-t1) > > that > > looks like this: > > > > > > TCP/22: 564 packets, 101772 bytes total, 13.57 kbits/s; 341 packets, 24968 > > bytes incoming, 3.32 kbits/s; 223 packets, 76804 bytes outgoing, 10.23 > > kbits/s > > > > TCP/80: 727 packets, 469337 bytes total, 62.57 kbits/s; 329 packets, 29763 > > bytes incoming, 3.97 kbits/s; 398 packets, 439574 bytes outgoing, 58.60 > > kbits/s > > > > UDP/53: 176 packets, 22362 bytes total, 2.97 kbits/s; 88 packets, 11181 > > bytes > > incoming, 1.48 kbits/s; 88 packets, 11181 bytes outgoing, 1.48 kbits/s > > > > TCP/25: 20 packets, 5768 bytes total, 2.71 kbits/s; 11 packets, 4675 bytes > > incoming, 2.18 kbits/s; 9 packets, 1093 bytes outgoing, 0.47 kbits/s > > > > You can parse this and create some graphs for example with rrdtool. > > > > Cheers, > > Andreas > > > > Omry Yadan (omry_y@xxxxxxxxxxxx) schrieb: > >> > >> Hi. > >> > >> I am trying to shape my upstream bandwidth, mostly per port. and I am > >> having some problems getting things to work the way I want them to. > >> > >> before I throw my configuration at you guys ;), I`d like to debug it by > >> myself - but I was not able to find a tool that allow me to > >> > >> monitor current bandwidth usage per port (and preferably even per > >> port+ip). > >> > >> I want to know what is the current bandwidth passing through port 80 > >> (all connections), and in port 80, I`d like to > >> > >> know what is the badnwidth usage per IP (regardless of the number of > >> sockets that are opened from that IP). > >> > >> anyone? > >> > >> > >> thanks. > >> > >> Omry. > >> > >> _______________________________________________ > >> LARTC mailing list > >> LARTC@xxxxxxxxxxxxxxx > >> http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc > >> > >> > > > > _______________________________________________ > > LARTC mailing list > > LARTC@xxxxxxxxxxxxxxx > > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc > > > > > > > _______________________________________________ LARTC mailing list LARTC@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc