migrate rrd files data to tsdb

439 kali dilihat
Langsung ke pesan pertama yang belum dibaca

oc tsdb

belum dibaca,
20 Jan 2014, 03.50.1220/01/14
kepadaopen...@googlegroups.com
Hi all,

Is there a way(e.g. collector) to migrate data from rrd file to opentsdb?

Thanks
-OC

Filippo Giunchedi

belum dibaca,
20 Jan 2014, 04.48.0320/01/14
kepadaOpenTSDB
On Mon, Jan 20, 2014 at 8:50 AM, oc tsdb <oc....@gmail.com> wrote:
> Hi all,
>
> Is there a way(e.g. collector) to migrate data from rrd file to opentsdb?

by migrate do you mean only once? if that is the case the easiest I
can think of is to use rrddump, get an xml dump and transform that
into the telnet interface format to be imported. Bear in mind of
course that the various RRAs inside will have done downsampling over
time and you'll have to figure out the metric/tags yourself. I guess a
sample script in contrib/ will be helpful if you get around to do it

HTH,
filippo

oc....@gmail.com

belum dibaca,
22 Jan 2014, 11.57.5522/01/14
kepadaopen...@googlegroups.com
Hi Filippo,

Thanks for your quick response.

Can we also use rrdtool fetch instead of rrdtool dump?
Can you please share any reference on rrdtool dump vs fetch.

Thanks
-OC

Filippo Giunchedi

belum dibaca,
23 Jan 2014, 08.31.2923/01/14
kepadaOpenTSDB
On Wed, Jan 22, 2014 at 4:57 PM, <oc....@gmail.com> wrote:
> Hi Filippo,
>
> Thanks for your quick response.
>
> Can we also use rrdtool fetch instead of rrdtool dump?
> Can you please share any reference on rrdtool dump vs fetch.

sure you could also use rrdtool fetch, dump will just give you the raw
rrd contents with timestamp + value in xml

http://oss.oetiker.ch/rrdtool/doc/rrddump.en.html
http://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html

pla...@acipia.com

belum dibaca,
30 Jan 2014, 05.24.0530/01/14
kepadaopen...@googlegroups.com
hi,

i've just been in the same issue !
this is some bash code i used to convert rrd to a flat file which can be import using "tsdb import".

my files are arranged like hostname/target.rrd, the DS names are not used (i only have 1 metric here). you should be able to adapt it to suit your needs.
note that it create a timeserie for each DS * each RRA * each CF function

#!/bin/bash

FILE
=$1

if [ -f $FILE ] ; then

LC_ALL
=C \
    rrdtool
dump $FILE | \
    egrep
"\<row\>|\<cf\>" | grep -v NaN |
    awk
-v tmp=$FILE \
   
'BEGIN { rra=0 ; match(tmp, /\//) ; host=substr(tmp, 0, RSTART) ; target=substr(tmp, RSTART+1) ; } { if ($1=="<cf>") { rra++ ; cf=tolower($2) ; } else { for (i = 9; i < NF; i+=2) { printf "metric %s %.4s host=%s target=%s step=%s rra=%s%s\n", $6, $i, host, target, ((i-9)/2)+1, cf, rra } } }'

else
    echo
"no such file $FILE"
   
exit 1
fi


have fun !

P
Balas ke semua
Balas ke penulis
Teruskan
0 pesan baru