[rrd-users] Re: Gauge understanding problem or error ?

Christian Volkmann CVolkmann at orga-systems.com
Fri Aug 19 15:43:42 MEST 2005


Hi Alex,

first of all _thank you very much_ that you take care of questions in such
a patient way !

So the following works like expected. May be it can be "prepared" in a proper
way and added to the samples after a review and correction ?

Best regards,

Christian

PS: Solved for me. But not complete "satisfied" by the design.
    May be I need to redesign my mind a little to understand ;-)

==========================================================
Situation:
You want to record and view a graph about maximum  temperature.
You get samples in the rate of 60 seconds.

See also the warnings what settings might give different results due
consolidation of the data. These different results might confuse a
beginners expectation. See at the tutorial the section "Data Resampling".


The following should work:
#########################
# sample
# creation of the database

STEP=1           # record one second steps
STEPSFORCDP=60   # use 60 steps to build a consolidated data point
let DURATION="24*60*60"  # one day with 24 hours which have 60 minutes which have 60 seconds
let TORECORD="$DURATION/STEPSFORCDP/STEP"
MINTEMP=0
MAXTEMP=100
MINDATARATE=60
START=`date -d "now -24hour" +%s`  # start database for now-24 hours

rrdtool create test.rrd --start $START -s $STEP \
        DS:TEMPERATUR:GAUGE:$MINDATARATE:$MINTEMP:$MAXTEMP \
        RRA:LAST:0:$STEPSFORCDP:$TORECORD

# record your values every 60 seconds:
# endless loop...
while true
do
	TEMP="<read temperature>"
	rrdtool update test.rrd N:$TEMP
	sleep 60
done

# use the following command to show the graph of the last 24 hours:
SHOWSTART=`date -d "now -24hour" +%s`
SHOWEND=`date +%s`

rrdtool graph test.gif -t "Temperature of the last 24 hours" --start $SHOWSTART --end $SHOWEND \
        DEF:value=test.rrd:TEMPERATUR:LAST \
        LINE1:value#00FF00:Temperatur

################################
# end of sample
################################


Warnings:
Consolidation "MAX" instead "LAST": might give a different length of the blocks due to consolidation.
STEP=60 instead STEP=1: might give an consolidated maximum and not the absolute maximum of temperature.

You might play with the following script to see the differences in graphs:
The times and temperatures of the samples are: date: 2004-11-09
12:34:20  20 degrees
12:35:20  30 degrees
12:36:20  40 degrees
12:37:20  30 degrees
12:38:20  20 degrees
12:39:20   0 degrees
12:40:20   0 degrees
12:41:20  80 degrees
12:42:20   0 degrees
12:43:20  20 degrees

#######################################################
# sample script for temperature with some fixed values
#######################################################
CONSOLIDATION=LAST

STEP=1           # record one second steps
STEPSFORCDP=60   # use 60 steps to build a consolidated data point
let DURATION="24*60*60"  # one day with 24 hours which have 60 minutes which have 60 seconds
let TORECORD="$DURATION/STEPSFORCDP/STEP"
MINTEMP=0
MAXTEMP=100
MINDATARATE=60
START=`date +%s`  # start database from now
START=1100000040
rrdtool create test.rrd --start $START -s $STEP \
        DS:TEMPERATUR:GAUGE:$MINDATARATE:$MINTEMP:$MAXTEMP \
        RRA:$CONSOLIDATION:0:$STEPSFORCDP:$TORECORD

# record your values every 60 seconds:
# endlessloop...
        cat <<EOP | while read line
        1100000060:20
        1100000120:30
        1100000180:40
        1100000240:30
        1100000300:20
        1100000360:0
        1100000420:0
        1100000480:80
        1100000540:0
        1100000600:20
EOP
        do
        rrdtool update test.rrd $line
done

# use the following command to show the graph of the last 24 hours:
SHOWSTART=`date -d "now -24hour" +%s`
SHOWEND=`date +%s`
SHOWSTART=1100000000
SHOWEND=1100000660

rrdtool graph test.gif -t "Temperature of the last 24 hours" --start $SHOWSTART --end $SHOWEND \
        DEF:value=test.rrd:TEMPERATUR:$CONSOLIDATION \
        LINE1:value#00FF00:Temperatur

display test.gif
######################################################


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



More information about the rrd-users mailing list