Hi Bradley.
On Thu, Mar 09, 2006 at 03:27:34PM +0000, Bradley Kite wrote:
> Thanks Andreas,
> Thats one step closer than I was, however I'm writing my reporting software
> in perl
So did I ;)
> and was hoping there would be a nice interface to this kind of data (use
> RRDs; RRDs::fetch() etc.)
> without having to parse the output from an XML file.
So do I ;)
Calling RRDs::xport returns with an array containing:
my ($start,$end,$step,$columcnt,$legend,$data)=RRDs::xport(@cmd);
With this information you can loop over the the data like this:
foreach my $row (@$data)
{
(undef,my $min,my $hour,my $mday,my $mon,my
$year,undef,undef,undef)=localtime($start);
$line.=sprintf("%u\t%02u-%s-%04u
%02u:%02u",$start,$mday,$Months[$mon],$year+1900,$hour,$min);
$start+=$step;
foreach my $val (@$row)
{
if ($val ne '')
{
$line.=sprintf("\t%.2f",$val);
} else
{
$line.=sprintf("\tNaN\n",$val);
}
}
}
See ... No need to call a XML parser ;)
You can take a look in the file shared-demo.pl bundled with rrdtool in the
examples
directory.
HTH,
Andreas.
--
Dipl.-Ing. Andreas Maus science+computing ag
System Administration Hagellocher Weg 71-75
mail: [EMAIL PROTECTED] 72070 Tuebingen, Germany
tel.: +49 7071 9457 456 www.science-computing.de
-- Binary/unsupported file stripped by Ecartis --
-- Err : No filename to use for decode, file stripped.
-- Type: application/pgp-signature
--
Unsubscribe mailto:[EMAIL PROTECTED]
Help mailto:[EMAIL PROTECTED]
Archive http://lists.ee.ethz.ch/rrd-users
WebAdmin http://lists.ee.ethz.ch/lsg2.cgi