[rrd-users] Time Shift on Trend Graph

Yannick Marquet itcsoft54 at yahoo.fr
Tue Jul 2 16:52:36 CEST 2013


Hello,

To graph all data you collect, you need three things :
- max range for data
- first time with data for series (need the first things).
- last time with data for series.

you can have the first one with this command line :

rrdtool first /path/to/your.rra --rraindex x
with "x" is the index of your rra with maximum range.

you can have the second one with this command line :

rrdtool graph png.png --imgformat=PNG --start=`rrdtool first 
/path/to/your.rra --rraindex x` --end='now' 
'DEF:in0=/path/to/your.rra:ifino:MAX' 'CDEF:txp0=ifino,UN,UNKN,TIME,IF'  
'PRINT:txp0:MIN:%.0lf' | tail -n 1

you can have the last one with this command line :

  rrdtool last /path/to/your.rra

if you use all previous command result together, i believe you can make 
what you want.

dears,

Yannick

Le 02/07/2013 16:18, Karl Fischer a écrit :
> 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.
>
> hth
> - Karl
>
>
>
>
>
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>



More information about the rrd-users mailing list