[rrd-users] How to get calculated values in legend section

Simon Hobson linux at thehobsons.co.uk
Tue Jan 10 11:29:00 CET 2012


Giese, Edgar wrote:

>i use nagios to collect data from a printer with 
>smnp. I get the printed pages as gauge 
>(10,15,25,30,80Š) and with the pnp I get a graph 
>for the printed pages.

Does the snmp server reset the page count each 
time you read this value ? If not, then you want 
data type COUNTER.

Remember that no matter what you feed in, 
internally RRD only deals in rates - ie 
<things>/second. Also, RRD normalises and 
consolidates the data - so the values you get out 
will not generally match what you put in.
See http://www.vandenbogaerdt.nl/rrdtool/ and 
look at the tutorial on Rates, normalizing and 
consolidating

>Changing to this ( wrong "Anzahl")
>
>$opt[1] = "--vertical-label Anzahl -l 0 --title 
>\"Gedruckte Seiten auf $hostname \" ";
>
>$def[1] =  "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
>$def[1] .=  "DEF:var1min=$rrdfile:$DS[1]:MIN " ;
>$def[1] .=  "DEF:var1max=$rrdfile:$DS[1]:MAX " ;
>$def[1] .=  "CDEF:var1act=var1max,var1min,- " ;
>$def[1] .=  "VDEF:varact=var1act,MAXIMUM " ;

This won't do what you want.

var1act will contain the difference between min 
and max for each consolidated time point - not 
the difference between the highest and lowest 
over the whole time series. So lets say you 
printed 15 pages for each consolidated time 
period, max-min would be 15 for each data point, 
and over 10 time periods you'd still only get a 
max of 15 - not the 150 you might be looking for.


If you use a counter data type, then you can plot 
pages/second - or multiply by 60 for pages/min, 
or multiply by 3600 to get pages/hour. You can 
get total pages printed by taking the average 
over the period and multiplying by the period. 
Eg, for total pages in a day, get the average 
over the previous day (pages/second) and multiply 
by 86400 (seconds/day) to get the total. Current 
versions of RRD have a TOTAL function that does 
this for you.

-- 
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