> I've got a perl script using rrd::simple that queries a list of hosts and > grabs several values. I want to take that array and dice it up to populate > the "rrd->update ( )" structure, but I can't seem to get it right.
This is just off the top of my head, but this should do what you're after,
provided the RRD file actually has the specified datasource names in it.
# using RRDs
%values = { ds0=>$value0, ds1=>$value1, ds2=>$value2 };
$timestamp = 'N'; # or use a specific time
$rrdfilename = 'filename.rrd'; # must be already created
RRDs::update( $rrdfilename, '--template', (join ':',(keys %values)),
"$timestamp:".(join ':',(map {$values{$_}?},(keys %values)))
);
# Or, using RRD::Simple
@values = ( "ds0:$value0","ds1:$value1","ds2:$value2");
%values = ();
foreach ( @values ) { $values{$1}=$2 if(/(\S+):(\S+)/); }
$rrd->update( %values );
Steve
Steve Shipway
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: [email protected]
Please consider the environment before printing this e-mail
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ rrd-users mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
