[rrd-users] Re: Export help
Todd Caine
tcaine at eli.net
Thu Aug 12 00:12:23 MEST 2004
I'm not sure what the easiest way to do this is but I've been using "rrdtool xport" with a short Perl script to transform the XML data into a CSV file. The Perl script uses the XML::Simple CPAN module so you would need to install both Perl and XML::Simple before giving this a try.
Here's an example of usage:
$ rrdtool xport \
DEF:in_bytes=interface.rrd:ds0:MAX \
DEF:in_bytes=interface.rrd:ds1:MAX \
CDEF:in_bits=in,8,* \
CDEF:out_bits=out,8,* \
XPORT:in_bits:ingress \
XPORT:out_bits:egress | xport_to_csv.pl > output.csv
Here's the contents of the xport_to_csv.pl script:
#!/usr/local/bin/perl
use strict;
use warnings;
use XML::Simple;
my $xml_doc;
{
local $/;
$xml_doc = <STDIN>;
}
my $xml = XMLin( $xml_doc );
print join(",", 'timestamp', @{ $xml->{meta}{legend}{entry} } ), "\n";
foreach my $row ( @{ $xml->{data}{row} } ) {
print join(",", $row->{t}, @{$row->{v}}), "\n";
}
exit(0);
The output.csv file can be opened with Excel.
HTH,
Todd
On (Wed, Aug 11 13:09), Pedram Fard wrote:
> I am trying to export the data to excel spread sheet. Is there a way to do
> that?
> Thanks,
> Pedram
>
>
> --
> Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
> Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
> Archive http://www.ee.ethz.ch/~slist/rrd-users
> WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-users
mailing list