I had created a rrd file with a specific time. But when i convert it into xml, i find the start time is inconsitent with the specified time.
The version of rrdtool is 1.5.5.
And the code is
> rrdtool create abc.rrd \
> step 15 --start 1554122342 \ DS:sum:GAUGE:120:U:U \ RRA:AVERAGE:0.5:1:5856 \ RRA:AVERAGE:0.5:4:20160 \
> RRA:AVERAGE:0.5:40:52704
The first few lines is like
> <!-- 2019-03-31 20:15:15 CST / 1554034515 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:15:30 CST / 1554034530 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:15:45 CST / 1554034545 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:16:00 CST / 1554034560 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:16:15 CST / 1554034575 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:16:30 CST / 1554034590 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:16:45 CST / 1554034605 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:17:00 CST / 1554034620 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:17:15 CST / 1554034635 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:17:30 CST / 1554034650 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:17:45 CST / 1554034665 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:18:00 CST / 1554034680 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:18:15 CST / 1554034695 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:18:30 CST / 1554034710 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:18:45 CST / 1554034725 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:19:00 CST / 1554034740 --> <row><v>NaN</v></row>
> <!-- 2019-03-31 20:19:15 CST / 1554034755 --> <row><v>NaN</v></row>
I tried other parameters such as the default(now-10s), but the interval is about one day.
(My example below tested with RRDTool 1.5.5)
Your RRA is approximately 1 year long, in 10min intervals; with a 15s set up the RRD.
When you create an RRD, the start
time is the time of the most recent data point or last update; in other words, you cannot add any data for a time earlier than this. The RRA will be initialised with unknown
throughout.
So, when you create your RRD with:
rrdtool create abc.rrd --step 15 --start 1554122342 \
DS:sum:GAUGE:120:U:U RRA:AVERAGE:0.5:40:52704`
you can see this using rrdtool info
(output trimmed for clarity):
$ rrdtool info abc.rrd
filename = "abc.rrd"
...
last_update = 1554122342
When you then use rrdtool dump
to immediately view the content of the RRA, you can see that it starts about a year earlier:
$ rrdtool dump abc.rrd
...
<lastupdate>1554122342</lastupdate> <!-- 2019-04-02 01:39:02 NZDT -->
...
<database>
<!-- 2018-04-01 01:40:00 NZDT / 1522500000 --> <row><v>NaN</v></row>
<!-- 2018-04-01 01:50:00 NZDT / 1522500600 --> <row><v>NaN</v></row>
...
<!-- 2019-04-02 01:20:00 NZDT / 1554121200 --> <row><v>NaN</v></row>
<!-- 2019-04-02 01:30:00 NZDT / 1554121800 --> <row><v>NaN</v></row>
</database>
But wait a minute! This ends on 1554121800, but our last update (start time) was 1554122342! This is a difference of 542. Why would this be?
The reason is that although your step is 15s, the RRA interval is 40 steps, IE 600s. The next entry cannot be added until there is 600s of data, and we only have 542. Therefore, the last entry in the RRA is as shown. Note that all intervals are normalised relative to UCT, and so your RRA cdp (consolodated data points) will always be a multiple of the interval size - in this case, 600 - regardless of when you set 'start' to be. RRDTool will simply pick the closest. This behaviour becomes much more obvious when you are rolling up to a large time period - e.g. 1 day - and you live in a more extreme timezone - e.g. Auckland with UCT+13.
Of course, once you write anything to the RRD, then lastupdate will change, and the RRA will add however many new points are required (and drop the old ones of course).