[rrd-users] Question with 1-hour samples
Simon Hobson
linux at thehobsons.co.uk
Thu Jan 20 17:51:13 CET 2011
Jason wrote:
>So for the following data example:
>
>Let's say that I have created a brand new *.rrd and collected data for
>the first three hours using the 300 second step period, with 12 steps
>filling one CDP. The PDPs are filled into CDPs in the following way:
>
>PDP 1 values for first hour sampling:
>(10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20)
>CDP 1 AVERAGE consolidation: 15
>
>PDP 2 values for second hour sampling:
>(20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30)
>CDP 2 AVERAGE consolidation: 25
>
>PDP 3 values for third hour sampling:
>(10, 10, 10, 10, 10, 10, 30, 30, 30, 30, 30, 30)
>CDP 3 AVERAGE consolidation: 20
>
>Firstly, is this not correct?
Looks right to me
>Next question:
>Let's say there are two RRDs for my Data Source - the first one is to
>hold 14 days (336 rows) of CDPs and the second one holds 60 days (1440
>rows) of CDPs.
>
>When I graph the AVERAGE of these first three CDPs into two separate
>graphs (14 versus 60 day 1-hour average), shouldn't both of them show a
>maximum CDP of 25? My two graphs don't show this - they are different.
> In addition, when I GPRINT the maximum value, they are not the same
>either. The 60 day is about 1/3 of the 14 day, for some reason. For
>the first three hours, the MAXIMUM of the averages should be the same
>between 14 and 60 day. Right?
>
>This is how I am doing the graphing:
>
>DEF:myaverage=/alerts.rrd:alerts:AVERAGE
>CDEF:alerthouravg=myaverage,3600,*
>GPRINT:alerthouravg:MAX:Maximum alerts per hour\\: %6.2lf
>AREA:alerthouravg#1E90FF:Average per Hour
Bear in mind that your max is not the max during the hour, it's the
maximum of the hourly average.
As to why it's not working as expected, I dunno.
here's a quick bash script I've done - fill in the values, run it
against the two files, and see what happens. Doing it this way, it's
easy to see what went in and what came out.
#!/bin/bash
start_time=`date -d "01 Jan 2011 00:00 UTC" +%s`
step=300
values=( "10" "10" "20" "30" )
time=${start_time}
for value in ${values[@]}
do
time=$(( ${time} + ${step} ))
echo rrdtool update "${file}" ${time}:${value}
done
end_time=${time}
echo rrdtool fetch "${file}" AVERAGE -s ${start_time} -e ${end_time}
--
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