RRD::Simple - Simple interface to create and store data in RRD files
use strict; use RRD::Simple (); # Create an interface object my $rrd = RRD::Simple->new(); # Create a new RRD file with 3 data sources called # bytesIn, bytesOut and faultsPerSec. Data retention # of a year is specified. (The data retention parameter # is optional and not required). $rrd->create("myfile.rrd", "year", bytesIn => "GAUGE", bytesOut => "GAUGE", faultsPerSec => "COUNTER" ) || die "Failed to create RRD file: $!"; # Put some arbitary data values in the RRD file for same # 3 data sources called bytesIn, bytesOut and faultsPerSec. $rrd->update("myfile.rrd", bytesIn => 10039, bytesOut => 389, faultsPerSec => 0.4 ) || die "Failed to update RRD file: $!"; # Get unixtime of when RRD file was last updated my $lastUpdated = $rrd->last("myfile.rrd"); print "myfile.rrd was last updated at " . scalar(localtime($lastUpdated)) . "\n"; # Get list of data source names from an RRD file my @dsnames = $rrd->sources("myfile.rrd"); print "Available data sources: " . join(", ", @dsnames) . "\n"; # And for the ultimately lazy, you could create and update # an RRD in one go using a one-liner like this: perl -MRRD::Simple -e'RRD::Simple->update(@ARGV)' myfile.rrd bytesIn 99999
RRD::Simple provides a simple interface to RRDTool's RRDs module. This module does not currently offer the graph, fetch or info methods that are available in the RRDs module.
graph
fetch
info
It does howeve create RRD files with a sensible set of default RRA (Round Robin Archive) definitions, and can dynamically add new data source names to an existing RRD file.
This module is ideal for quick and simple storage of data within an RRD file if you do not need to, nor want to bother defining custom RRA definitions.
Finish POD.
Write the retention duration scheme handling code. (Currently defaults to one year retention only).
RRDTool::Managed, RRDTool::OO, RRD::Query, RRDs, http://www.rrdtool.org
$Id: Simple.pm,v 1.8 2005/12/08 15:08:25 nicolaw Exp $
Nicola Worthington <nicolaw@cpan.org>
http://perlgirl.org.uk
(c) Nicola Worthington 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL.
See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt
To install RRD::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RRD::Simple
CPAN shell
perl -MCPAN -e shell install RRD::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.