Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] rrd to CSV
Date: Sun, 05 Jul 2009 22:07:47
Message-Id: 200907052307.33628.michaelkintzios@gmail.com
In Reply to: Re: [gentoo-user] [OT] rrd to CSV by Mark Shields
1 On Saturday 04 July 2009, Mark Shields wrote:
2 > On Sat, Jul 4, 2009 at 11:36 AM, Mick <michaelkintzios@×××××.com> wrote:
3 > > Hi All,
4 > >
5 > > I know that rrdtool dump will export the rrd data into XML, but is there
6 > > something to either directly or via rrdtool create a CSV file for me?
7 > > Will probably want to run this on a cron job and email/save it.
8 > > --
9 > > Regards,
10 > > Mick
11 >
12 > Judging from a few cursory google searches, it won't output to CSV, but you
13 > can easily convert it. Try piping the file/output to these commands
14 > (yanked
15 >
16 > from Cacti forums):
17 > | grep -v NaN | grep '<row>' | tr e ' ' \
18 > | awk {'print "Q"$2"qcq"$3"qcq"$9"Q"'} \
19 > | tr Q '"' | tr c ',' | tr q '"'"
20 >
21 > Haven't tested it, but looks like it should work.
22
23 Hmm, I don't think it gets anywhere:
24 =======================================
25 cat test.xml | grep -v NaN | grep '<row>' | tr e ' ' | awk
26 {'print "Q"$2"qcq"$3"qcq"$9"Q"'} | tr Q '"' | tr c ',' | tr q '"'" > test.csv
27 >
28 =======================================
29
30 It just sits there at the > cursor. I think it needs something more to it, or
31 I am not feeding the XML file to it correctly?
32
33 --
34 Regards,
35 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] [OT] rrd to CSV Willie Wong <wwong@××××××××××××××.edu>