[rrd-users] Re: [mrtg] question

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Sat Feb 24 13:43:02 MET 2001


Edward Kuhner wrote:
> 
> Is it possible to have MRTG display the actual bytes transferred along with
> the graphs that it so nicely creates?
> 
> I am interested in seeing our actual transfer for our Internet connection...

If you mean: actual number of bytes transfered...
It is not possible with MRTG.  You can come close if you create
an MRTG process that works with GAUGE.  However, if your router
resets, or the counters get reset in another way, you loose.

The total number of bytes transfered equals the average rate in
bytes, times the number of seconds lapsed.  With RRDtool you can
put this little piece of math in the CDEFs and then you can print
it on the PNG using GPRINT.

It would be something like:
   rrdtool graph mygraph.png --start now-30days --width 360 \
   DEF:ds0=internet.rrd:ds0:AVERAGE \
   DEF:ds1=internet.rrd:ds1:AVERAGE \
   CDEF:bits0=ds0,8,* \
   CDEF:bits1=ds1,8,* \
   CDEF:average0=ds0,2592000,* \
   CDEF:average1=ds1,2592000,* \
   CDEF:average2=ds0,ds1,+ \
   COMMENT:"       max       avg       min\n" \
   AREA:bits0#00C000:"bps in " \
   GPRINT:bits0:MAX:"%6.2lf %sbps" \
   GPRINT:bits0:AVERAGE:"%6.2lf %sbps" \
   GPRINT:bits0:MIN:"%6.2lf %sbps\n" \
   LINE1:bits1#0000FF:"bps out" \
   GPRINT:bits1:MAX:"%6.2lf %sbps" \
   GPRINT:bits1:AVERAGE:"%6.2lf %sbps" \
   GPRINT:bits1:MIN:"%6.2lf %sbps\n" \
   COMMENT:"A fairly correct estimation of the total bytes transfered:\n" \
   GPRINT:average0:AVERAGE:"%10lf Bytes in" \
   GPRINT:average1:AVERAGE:"%10lf Bytes out" \
   GPRINT:average2:AVERAGE:"%10lf Bytes total"

I did not try this myself (yet) so there may be bugs in the script.
However, what I try to do is:
- get the byte counters from "internet.rrd" and store them into
  ds0 and ds1 (bytes in and bytes out)
- multiply by 8 to get bits, for graphing
- multiply by the number of seconds in 30 days. This results in a
  counter that, divided by the number of seconds in the graph,
  will return (bytecounter * x)/x equalling bytecounter.

For this to work flawlessly we need to be sure of the number of seconds
in the graph.  This is not always exactly what you specify.

I'm pretty sure that in the next major version of RRDtool we'll
have a way of determining this exactly.

For now, it is best to have a graph with a time range and a graph
size that are matched.  If you graph 30 days, you'll fetch from
the monthly RRA.  The step time in this RRA is 30 minutes.  Each
pixel should be a multiple of this step time. 2592000/1800 is 1440,
the number of pixels must therefore be 1440 or 720 or 360.
With a graph size of 360, each pixel represents 2592000/360 = 7200
seconds which is two hours.  The graph time will be exactly 30 days
and the specified graph interval will be exactly what we expect.

cheers,
-- 
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. | 
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
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://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list