[rrd-users] rrdgraph: Negative values with --logarithmic

Christian Garbs mitch at cgarbs.de
Mon Oct 17 20:25:37 CEST 2016


On Mon, Oct 17, 2016 at 03:01:11AM +0200, Alex van den Bogaerdt wrote:
> > What I want to achieve (and what I think those other proponents also
> > had in mind) is that I essentially have some of my data mirrored at
> > the x-axis for better readability (don't draw two values on top of
> > each other).
> >
> > For example I plot outgoing packets on my network as a positive values
> > while I plot the incoming packets via CDEF:output=0,outputx,- as
> > negative values.  So the outgoing rate is shown above the x-axis and
> > the incoming rate below the x-axis.
> 
> So, what you want to show is the outcome of a normal logaritmic function,
> but mirrored. Instead of a new function...

Basically, yes, but because of the y axis I think I need some special
logic in rrdgraph (see below).

> > To tame network spikes somewhat I want to change the graph mode to
> > logarithmic.  This works for the positive values, but the negative
> > values simply vanish.  I just want the same transormation that happens
> > to the positive values applied 'mirrored' the the negative values.
> >
> > Think of something like a "display-logarithm" function defined like
> > this:
> >
> >
> > double disp_log(double y)
> > {
> > 	if (y == 0) {
> > 		return 0;
> > 	} else if (y > 0) {
> > 		return log(y);
> > 	} else {
> > 		return -log(-y);
> > 	}
> > }
> >
> >
> > While "-log(-y)" might look weird in a mathematical context I think that
> > it makes sense in describing "do the same as for positive values, only
> > in the other direction".
> 
> ... can't you just use CDEF:mirrored=logresult,-1,* ?
> Or am I missing something ?

This would indeed give me the correct results and would draw a correct
graph, but the y axis grid would not be logarithmic:

If I put the values "1000" and "-1000" into a CDEF using normal and
'mirrored' LOG, I'll graph the values "3" and "-3".  The y grid will
propably autoscale to "-10 … 10" and show my values as "3" and "-3"
instead of "1000" and "-1000".

When I use --logarithmic, the positive values are also LOGed, but the y
axis will be scaled logarithmic as well, so the y axis will show
"1000" (or "10e3" or "1k") next to the graph value.

If I could get a logarithmic y axis without using --logarithmic (for
both positive and negative values), using LOG in a CDEF would indeed
be a solution.

Regards
Christian
-- 
....Christian.Garbs....................................https://www.cgarbs.de

"Die Berühmtheit mancher Zeitgenossen hängt mit der Blödheit
 der Bewunderer zusammen."                -- Heiner Geissler



More information about the rrd-users mailing list