[rrd-users] Time Shift on Trend Graph

Karl Fischer rrd-users at ficos.de
Tue Jul 2 16:18:14 CEST 2013

Am 02.07.2013 14:26, schrieb Chris Mason:
> So, if no one has an obvious easy solution to this

Hi Chris,

while this is not cheap, it's fairly easy. I've used it a
couple of times since I needed the first valid entry as well.
It takes a few seconds - depending on the size of the rrd -
and spits out the timestamp of the first non-NaN entry.

cd /tmp
rrdtool dump yourfile.rrd | csplit - '%<database>%+1' '/<database>/+1' '{*}'
grep -Ehivm 1 '<row>(<v> *NaN *</v>)+</row>' xx?? | sed 's:^.* / \([0-9]\{10\}\) .*:\1:' | sort -n | head -1
rm -f xx??

The same logic can be applied with perl, without having to use
csplit/grep/sed/sort/head, but then it doesn't fit in 2 lines.

- Karl

More information about the rrd-users mailing list