[rrd-users] A few questions

Simon Hobson linux at thehobsons.co.uk
Mon Nov 29 19:57:18 CET 2010

Henrik Hegardt wrote:

>When drawing a graph how do one make sure that each LINE/AREA legend 
>are printed on a separate line?

Embed a newline character in the string for each legend but the last 
- you use traditional escapes to do it, ie "\n" embeds a newline.

>And when using a COUNTER ds, if you reset the counter data input, 
>how do you prevent that huge spike (due to overflow) in your graph. 
>Is the best way to read the ds[<ds>].last_ds value and continue from 
>that value?

The most reliable way to do it is to read the data and update the 
database just before resetting the counters, then do an update with 
"unknown" (or "U") as the value, reset the counters, and then do an 
update with 0 as the value.
That gets you the latest up to date information so you don't lose 
anything, then makes the last value unknown, and then starts again 
from zero. Because you inserted the unknown value, the previous 
counter values aren't used when working out the rate and you can't 
get that spike.

You can also apply limits, or use the derive datatype.

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the rrd-users mailing list