I want to be able to see when the last value in an RRD was recorded.
I have the following to print the last recorded value, which works ok.
DEF:temp1=temperatures2.rrd:iliakos:AVERAGE
GPRINT:temp1:LAST:"Current\:%8.1lf %s"
I have found in the documentation :strftime and I tried:
GPRINT:temp1:LAST:"%H\:%M":strftime
but got:
graph.sh: line 21: GPRINT:temp1:LAST:%H\:%M:strftime: command not found
I read more carefully the docs and it mentions that strftime is applied on VDEF so I tried the following:
VDEF:vtemp1=temp1,AVERAGE
GPRINT:vtemp1:LAST:"%H\:%M":strftime
but again got:
ERROR: I don't understand ':%H\:%M:strftime' in command: 'GPRINT:vtemp1:LAST:%H\:%M:strftime'
I thought that values in an rrd have an associated recorded timestamp, as we can see from a dump. How can we access this access this timestamp and use it in a graph commmand?
Thanks
When rrdtool graph needs data from the rrd file, it simply states a time range and in response it gets the data delivered. Regardless if the rrd file actually holds has data for that time range or note. If no data is available the data handed to the graph component consists of NaNs.
So the question you can answer at best is, the last time 'known' data has been written into the rrd file.
You attempt using the
strftime
function is good, but you need to jump through another hoop. You need to prepare some data that grows over time, for all the points in time when data was available. This is what theCDEF
accomplishes. You can then useVDEF
to determine the maximumcount
value and retrieve the timestamp associated with that value.