[rrd-users] What's the best way?

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Mon Mar 14 22:12:17 CET 2016

> Hi all,
> I have a data source that gives me "number of requests" and "total bytes
> transferred".

Just to make sure I understand it:
You are talking about ever increasing counters, which only reset to/go
through zero in case of device resets and counter overflows?

If not, stop reading as the rest would make no sense.

> I would like to be able to monitor the bytes transferred per request over
> time.
> I can pre-process the data to calculate (delta bytes) / (delta requests).

You can, but do you need to?

> Obviously I would have to skip over any periods where there are no new
> requests.

That depends. The CDEF would result in INF or NaN (not sure which, it
should be in the docs) resulting in a gap in your graph. If that is a
problem, you can put the CDEF equivalent of "if (Drequests==0)
Drequests=1" in your CDEF as Dbytes should also be zero at such time.

> In that case I should probably use an "ABSOLUTE" DS definition, right?

Nope. Counter should be what you need.

> I thought initially that since the number of requests and the number of
> bytes are both converted to rates, I could simply graph a CDEF of
> (bytes/requests).
> I tried that and it doesn't look good.

And what exactly looks wrong?
You have bytes per second: B/s and requests per second: R/s.  When you
divide those, the math should look like: B/s / R/s = B/s * s/R = B/R.

To get you started, doing this from memory without any checking:

DEF:bps {get your bytes per second from total bytes transfered}
DEF:rps {get your requests per second from total number of requests}

That CDEF can be read as:  if (rps==0) bpr=bps/1 else bpr=bps/rps.

or simply: CDEF:bpr=bps,rps,/
if you don't mind the gap in the graph.

Hope this helps

More information about the rrd-users mailing list