[rrd-users] apacha traffic -> my scenario

bart bartoszx at euro26.pl
Mon Jun 13 10:23:39 MEST 2005


I found rrdtool as perfect tool for measure traffic for my virtual hosts.
During whole week I was wondering how to collect data from apache
access_log and then collect these in rrd database.
Mod_log_mysql is very good piece of software. I've changed sql query
and now Apacha update (increase exisiting value) record in mysql database with vhost = virtual
host. It works great and show real numbers.
Then I created rrd database

rrdtool create ".$vhost." --step=300  \
DS:bin:COUNTER:600:0:U \
DS:bout:COUNTER:600:0:U \
RRA:AVERAGE:0.5:1:60 \
RRA:MAX:0.5:1:60 \
RRA:AVERAGE:0.5:12:24 \
RRA:MAX:0.5:12:24 \
RRA:AVERAGE:0.5:288:31 \
RRA:MAX:0.5:288:31

and rrdtool dump vhsot.rrd shows RRA for 5h 24h and 1 month

Now I want to graph monthly and daily traffic.
For monthly graph I use following command:

(11-06)- because my last atempt to create good rrd database was at
11th :)

$START=exec("perl -e 'use Date::Parse; print str2time(\"".$today_month."-11-".$year." 00:00\")'");
$END=exec("perl -e 'use Date::Parse; print str2time(\"0".$next_month."-11-".$year." 00:00\")'");


system("rrdtool graph ".$IMGpath."/".$vhost."monthly.png \
--start=".$START." --end=".$END." --step=86400 \
--x-grid HOUR:8:DAY:1:DAY:2:86400:'%b %d'  \
-h 200 -w 380 \
-a PNG -t \"Per month\" \
DEF:in=".$RRDpath."/".$vhost.".rrd:bin:AVERAGE \
DEF:out=".$RRDpath."/".$vhost.".rrd:bout:AVERAGE \
CDEF:in8=in,86400,* \
CDEF:out8=out,86400,* \
CDEF:total=in8,out8,+ \
AREA:total#00FF00:\"Total\" \
GPRINT:total:AVERAGE:\"%.2lf %sB \\n\" \
LINE1:in8#0000FF:\"In\" \
GPRINT:in8:AVERAGE:\"%.2lf %sB \\n\" \
LINE1:out8#FF0000:\"Out\" \
GPRINT:out8:AVERAGE:\"%.2lf %sB\" \
");

and this png show good numbers
but if I try to show 24h traffic I get very strange values
this is rrdtool command

system("rrdtool graph ".$IMGpath."/".$vhost."daily.png \
-s -24h  --step=3600 \
-h 200 -w 520 \
-a PNG -t \"Per day\" \
DEF:in=".$RRDpath."/".$vhost.".rrd:bin:AVERAGE \
DEF:out=".$RRDpath."/".$vhost.".rrd:bout:AVERAGE \
CDEF:bbbin=PREV,UN,0,PREV,IF,in,+ \
CDEF:bbbout=PREV,UN,0,PREV,IF,out,+ \
CDEF:byin=bbbin,bbbout,+ \
CDEF:bxin=byin,3600,* \
CDEF:bein=bbbin,3600,* \
CDEF:beout=bbbout,3600,* \
AREA:bxin#FF00AA:\"Total In/Out\\n\" \
LINE1:bein#00FF00:In: \
GPRINT:bein:AVERAGE:\"%7.2lf %sB\" \
LINE1:beout#0000FF:Out \
GPRINT:beout:AVERAGE:\"%7.2lf %sB \" \
GPRINT:bxin:AVERAGE:\"Total %7.2lf %sB \"
");

The best choice for that is VDEF but it doesnt show daily traffic on
monthly graph but only total so I cant check what traffic was at 1st
or 5th of month. I can only chcek total traffic till now.

Is there somthing wrong with my configuration or I need study doc one
again?


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list