RRD::Query - Perform queries on RRD file
Simple wrapper around RRDs library to do some simple queries. It implemented more advanced error handling by using the Error module.
my $rq = new RRD::Query("/path/to/file.rrd");
@datasources = list();
Return the list of all datasource of the given file
Throws:
Error::RRDs - on RRDs library error
($value) = fetch($ds, cf => $cf, offset => $offset)
Fetch a single value from the datasource $ds of RRD file. If $offset is omitted, the last inserted value is returned, otherwise the last value - $offset is returned. If $cf (consolidation function) is omited, AVERAGE is used.
Datasource you want to fetch. If the datasource contains comat (,), your datasource will be interpreted as an RPN (Reverse Polish Notation) expression (see Math::RPN). If the Math::RPN module isn't loadable, an Error::RRD::Feature exception is thrown.
Math::RPN
Error::RRD::Feature
Some valide examples of datasource would be: ifError, high_mem,low_mem,+.
ifError
high_mem,low_mem,+
Consolidation function name you want to fetch. If omited, the AVERAGE consolidation function is used.
Time offset to go back in the past from the last inserted value time.
on RRDs library error
if datasource can't be found in RRD file
if you try to use an RPN DS without Math::RPN installed
$timestamp = get_last()
Returns the timestamp of the inserted value of the RRD file.
$bool = isNaN($value);
Returns true if the value is Not a Number.
Olivier Poitrey <rs@rhapsodyk.net>
RRD::Query, performs queries on RRD files. Copyright (C) 2004 Olivier Poitrey
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
RRDs, Error
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install RRD::Query, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RRD::Query
CPAN shell
perl -MCPAN -e shell install RRD::Query
For more information on module installation, please visit the detailed CPAN module installation guide.