Changes

Jump to: navigation, search

Traffic accounting through proc

1,058 bytes added, 02:55, 19 April 2010
Script
# Send the data to the corresponding RRD time with (N)now as the update time
/usr/bin/rrdtool update $RRDFILE N:$CTIN:$CTOUT
done
</source>
 
 
the following script uses previously generated RRD's, you'll get nice PNG pictures and index.html file with them:
 
<source lang="bash">
#!/bin/sh
# Script Name: vz_direct_traffic_render
# Author: "Denis Titov, ISP Okeanika" <denis@okeanika.net.ua>
# Website: http://www.okeanika.net.ua
 
rrd_path=/var/lib/rrd
www_path=/var/www/html/traf
 
cd $rrd_path
for RRD in *.rrd
do
CTID=`echo $RRD|awk -F\. '{print $1}'`
 
# list of intervals, 1d = last day, 1w = last week and so..
for INT in 1h 1d 1w 1m 1y
do
/usr/bin/rrdtool graph $www_path/${CTID}-${INT}.png \
--start now-$INT --end now \
-w 1000 -h 500 \
--title "CTID $CTID - Interval $INT" \
DEF:in=$RRD:IN:AVERAGE AREA:in#aea:'IN' LINE1:in#0e0 \
DEF:out=$RRD:OUT:AVERAGE AREA:out#eaa:'OUT' LINE1:in#e00
echo "<p><img src=\"${CTID}-${INT}.png\"><br/><br/></p>" >> $www_path/index.html
done
done
</source>
5
edits

Navigation menu