|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Imprecise total?Hi,
I was trying to extract the sums (sent&received per day) from mailgraph's monthly RRD archives, and I got different results. I think there's a mistake in the graph's CDEF, more exactly when values are multiplied by $step (CDEF:drecv=recv,UN,0,recv,IF,$step,*). Step is computed on the assumption that 180 averages are used for the graph. 180 is defined in mailgraph.cgi as $xpoints(540)/$points_per_sample(3), that is, a graph of width 540 pixels where each value (RRA row) is 3 pixels wide. Unfortunately the archive uses 180 averages for 35 days (not 31), as it's created with a multiple of weekly rows: $month_steps = $week_steps*5 (cf. /usr/sbin/mailgraph). So the CDEF is using a $step computed with 3600*24*31/180=14880s, while a point in the archive is really rrd.step * rra[2].pdp_per_row = 60*280 = 16800s. So monthly displayed values are about 10% less than the actual values from the RRA. This is confirmed by the value shown in rrdtool xport's <step>. An xport for 31 days will also show 160 rows instead of 180. Note that this problem does not occur for daily sums, because 180 rows at 8 points/row are exactly 1 day (180*8*60 = 86400 = 60*60*24). If you want to check/confirm, here's the xport command I used: # Use multiples to select the right RRA (see rrdfetch(1)) TIME=$(date +%s) #RRDRES=$((60*8)) # dayly = rrd.step * rra[0].pdp_per_row RRDRES=$((60*280)) # monthly = rrd.step * rra[2].pdp_per_row # DEF and CDEF are from mailgraph.cgi rrdtool xport \ -e $(($TIME/$RRDRES*$RRDRES)) -s e-31d \ "DEF:sent=mailgraph.rrd:sent:AVERAGE" \ "CDEF:dsent=sent,UN,0,sent,IF,$RRDRES,*" \ "CDEF:ssent=PREV,UN,dsent,PREV,IF,dsent,+" \ "DEF:recv=mailgraph.rrd:recv:AVERAGE" \ "CDEF:rrecv=recv,60,*" \ "CDEF:drecv=recv,UN,0,recv,IF,$RRDRES,*" \ "CDEF:srecv=PREV,UN,drecv,PREV,IF,drecv,+" \ "DEF:spam=mailgraph_virus.rrd:spam:AVERAGE" \ "CDEF:dspam=spam,UN,0,spam,IF,$RRDRES,*" \ "CDEF:sspam=PREV,UN,dspam,PREV,IF,dspam,+" \ "DEF:virus=mailgraph_virus.rrd:virus:AVERAGE" \ "CDEF:rvirus=virus,60,*" \ "CDEF:dvirus=virus,UN,0,virus,IF,$RRDRES,*" \ "CDEF:svirus=PREV,UN,dvirus,PREV,IF,dvirus,+" \ "CDEF:recvlegit=srecv,svirus,sspam,+,-" \ XPORT:recvlegit:"total_received" \ XPORT:ssent:"total_sent" \ XPORT:dsent:"sent" I had a look at Cacti, and it appears the sum is pre-computed before graphing, and included in the graph as a comment (see "summation" in http://docs.cacti.net/node/50). Maybe mailgraph could use that technique as well? Cheers, -- Sylvain -- Unsubscribe mailto:mailgraph-request@...?subject=unsubscribe Help mailto:mailgraph-request@...?subject=help Archive http://lists.ee.ethz.ch/mailgraph WebAdmin http://lists.ee.ethz.ch/lsg2.cgi |
|
|
Re: Imprecise total?Hi Sylvain,
On Mon, May 26, 2008 at 20:17:48 +0200, Sylvain Beucler wrote: > I think there's a mistake in the graph's CDEF, more exactly when > values are multiplied by $step (CDEF:drecv=recv,UN,0,recv,IF,$step,*). > ... > Unfortunately the archive uses 180 averages for 35 days (not 31), as > it's created with a multiple of weekly rows: > $month_steps = $week_steps*5 (cf. /usr/sbin/mailgraph). You are right! Thanks for the bug report. I will fix it in the next mailgraph.cgi in the same way as you propose it: A straightforwarded "fix" is to change the graphs ranges: my @graphs = ( { title => 'Last Day', seconds => 3600*24, }, { title => 'Last Week', seconds => 3600*24*7, }, # { title => 'Last Month', seconds => 3600*24*31, }, # { title => 'Last Year', seconds => 3600*24*365, }, { title => 'Last Month', seconds => 3600*24*7*5, }, { title => 'Last Year', seconds => 3600*24*7*5*12, }, ); Cheers David -- Unsubscribe mailto:mailgraph-request@...?subject=unsubscribe Help mailto:mailgraph-request@...?subject=help Archive http://lists.ee.ethz.ch/mailgraph WebAdmin http://lists.ee.ethz.ch/lsg2.cgi |
| Free embeddable forum powered by Nabble | Forum Help |