The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

RRD::Threshold - Check for thresholds exceeding values in RRD files data

DESCRIPTION

This Perl module is capable of extracting some RRD information and to detect if the current value of a datasource is exeeding some thresholds using different algorithms and the help of past values of the same or other datasource.

CONSTRUCTOR

The constructor takes no arguments.

METHODS

boundaries

    ($value, $bool) = boundaries($rrdfile, $ds, min => $min, max => $max)

This threshold takes too optional values, a minimum and a maximum value. If the data source strays outside of this interval, it returns false.

Options

rrdfile

The path to the RRD file

ds

The name of the datasource. 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.

Some valide examples of datasource would be: ifError, high_mem,low_mem,+.

min

If current value is lower than this argument, the function returns false.

max

If current value is greater than this argument, the function returns false.

Throws

Error::InvalidArgument

If min is greater than max

Error::RRDs

on RRDs library error

Error::RRD::isNaN

if fetched value is Not a Number

Error::RRD::NoSuchDS

if the given datasource can't be found in the RRD file

exact

    ($value, $bool) = exact($rrdfile, $ds, $exact)

This threshold allows you to monitor a datasource for an exact match. This is useful in cases where an enumerated (or boolean) SNMP object instruments a condition where a transition to a specific state requires attention. For example, a datasource might return either true(1) or false(2), depending on whether or not a power supply has failed.

Options

rrdfile

The path to the RRD file

ds

The name of the datasource. 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.

Some valide examples of datasource would be: ifError, high_mem,low_mem,+.

exact

If the current value is different than this argument, the function will return false.

Throws

Error::InvalidArgument

if exact argument isn't given

Error::RRDs

on RRDs library error

Error::RRD::isNaN

if fetched value is Not a Number

Error::RRD::NoSuchDS

if the given datasource can't be found in the RRD file

relation

    ($value, $bool) = relation($rrdfile, $ds, $threshold, %args,
                               cmp_rrdfile => $cmp_rrdfile,
                               cmp_ds      => $cmp_ds,
                               cmp_timp    => $cmp_time);

A relation threshold considers the difference between two data sources (possibly from different RRD files), or alternatively, the difference between two temporally distinct values for the same data source. The difference can be expressed as absolute value, or as a percentage of the second data source (comparison) value. This difference is compared to a threshold argument with either the greater than (>) or lesser than (<) operator. The criteria fails when the expression (<absolute or relative difference> <either greater-than or less-than> <threshold>) evaluates to false.

Options

rrdfile

The path of the base RRD file.

ds

The name of the base datasource. The data source must belong to the $rrdfile. 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.

Some valide examples of datasource would be: ifError, high_mem,low_mem,+.

threadhold

The threshold number, optionally preceded by the greater than (>) or less than (<) symbol, and optionally followed by the symbol percent (%). If omitted, greater than is used by default and the expression, difference > threshold, is evaluated. "<10%", ">1000", "50%", and "500" are all examples of valid thresholds.

cmp_rrdfile

The path of the comparison RRD file. This argument is optional and if omitted the first RRD file is also taken as the comparison target.

cmp_ds

The name of the comparison data source. This data source must belong to the comparison RRD file. This argument is optional and if omitted the first data source name is also taken as the comparison data source name. If the value is a number, the value is considered as a fix value and is taked for the comparison.

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.

Some valide examples of datasource would be: ifError, high_mem,low_mem,+, 10023, -243.23.

cmp_time

The temporal offset to go back in the RRD file that is being fetched from for comparison from the current value. Note that a data source value must exist in the RRD file for that exact offset. If This argument is optional and if omitted, it is set to 0.

Throws

Error::InvalidArgument

on argument error

Error::RRDs

on RRDs library error

Error::RRD::isNaN

if fetched value is Not a Number

Error::RRD::NoSuchDS

if the given datasource can't be found in the RRD file

quotient

    ($value, $bool) = quotient($rrdfile, $ds, $threshold, %args,
                               cmp_rrdfile => $cmp_rrdfile,
                               cmp_ds      => $cmp_ds,
                               cmp_timp    => $cmp_time);

Quotient thresholds are similar to relation thresholds, except that they consider the quotient of two data sources, or alternatively, the same data source at two different time points. For a quotient monitor threshold, the value of the first data source is computed as a percentage of the second data source value (such as 10 (first datasource) is 50% of 20 (second datasource)). This percentage is then compared to a threshold argument with either the greater than (>) or less than (<) operator. The criteria fails when the expression (<percentage> <either greater-than or less-than> <threshold>) evaluates to false.

Options

rrdfile

The path of the base RRD file.

ds

The name of the base datasource. The data source must belong to the $rrdfile. 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.

Some valide examples of datasource would be: ifError, high_mem,low_mem,+.

threadhold

The threshold number, optionally preceded by the greater than (>) or less than (<) symbol and followed by the symbol percent (%). If omitted, greater than is used by default and the expression, difference > threshold, is evaluated. "<10%" and "50%" are examples of valid thresholds.

cmp_rrdfile

The path of the comparison RRD file. This argument is optional and if omitted the first RRD file is also taken as the comparison target.

cmp_ds

The name of the comparison data source. This data source must belong to the comparison RRD file. This argument is optional and if omitted the first data source name is also taken as the comparison data source name. If the value is a number, the value is considered as a fix value and is taked for the comparison.

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.

Some valide examples of datasource would be: ifError, high_mem,low_mem,+, 10023, -243.23.

cmp_time

The temporal offset to go back in the RRD file that is being fetched from for comparison from the current value. Note that a data source value must exist in the RRD file for that exact offset. If This argument is optional and if omitted, it is set to 0.

Throws

Error::InvalidArgument

on argument error

Error::RRDs

on RRDs library error

Error::RRD::isNaN

if fetched value is Not a Number

Error::RRD::NoSuchDS

if the given datasource can't be found in the RRD file

hunt

    ($value, $bool) = hunt($rrdfile, $ds, $roll,
                           cmp_rrdfile => $cmp_rrdfile,
                           cmp_ds      => $cmp_ds)

The hunt threshold is designed for the situation where the data source serves as an overflow for another data source; that is, if one data source (the parent) is at or near capacity, then traffic will begin to appear on this (the monitored) data source. One application of hunt monitor thresholds is to identify premature rollover in a set of modem banks configured to hunt from one to the next. Specifically, the criteria of the hunt monitor threshold fails if the value of the monitored data source is non-zero and the current value of the parent data source falls below a specified capacity threshold.

Option

rrdfile

The path of the base RRD file.

ds

The name of the base datasource. The data source must belong to the $rrdfile. 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.

Some valide examples of datasource would be: ifError, high_mem,low_mem,+.

roll

The threshold of the parent data source. Generally this should be slightly less than the maximum capacity of the target.

cmp_rrdfile

The path of the parent RRD file. This argument is optional and if omitted the base RRD file is also taken as the parent.

cmp_ds

The name of the comparison data source. This data source must belong to the parent RRD file. This argument is optional and if omitted the first data source name is also taken as the comparison data source name.

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.

Some valide examples of datasource would be: ifError, high_mem,low_mem,+.

Throws

Error::InvalidArgument

if roll argument isn't given

Error::RRDs

on RRDs library error

Error::RRD::isNaN

if fetched value is Not a Number

Error::RRD::NoSuchDS

if the given datasource can't be found in the RRD file

failure

Aberrant Behavior Detection failure detection.

not yet implemented

EXCEPTIONS CLASSES

Error::InvalidArgument

AUTHOR

Olivier Poitrey <rs@rhapsodyk.net>

LICENCE

RRD::Threshold, checks for thresholds exceeding values in RRD files data. 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

SEE ALSO

RRDs, rrdgraph, RRD::Query, Error

1 POD Error

The following errors were encountered while parsing the POD:

Around line 530:

Non-ASCII character seen before =encoding in 'source. One'. Assuming CP1252