Nagios::Plugin::OverHTTP::PerformanceData - Represents performance data of a Nagios plugin
This documentation refers to Nagios::Plugin::OverHTTP::PerformanceData version 0.16
use Nagios::Plugin::OverHTTP::PerformanceData; # New from many options my $data = Nagios::Plugin::OverHTTP::PerformanceData->new( label => q{time}, value => 5, units => q{s}, # Seconds ); # New from a performance string my $data = Nagios::Plugin::OverHTTP::PerformanceData->new('time=5s'); # Set a new critical threshold $data->critical_threshold('@10:20'); # Check if matches the critical threshold say $data->is_critical ? 'CRITICAL' : 'NOT CRITICAL'; # Print out plugin information with performance data printf q{%s - %s | %s}, $status, $message, $data->to_string;
This module represents performance data from plugins.
This is fully object-oriented, and as such before any method can be used, the constructor needs to be called to create an object to work with.
This will construct a new plugin object.
%attributes is a HASH where the keys are attributes (specified in the "ATTRIBUTES" section).
%attributes
$attributes is a HASHREF where the keys are attributes (specified in the "ATTRIBUTES" section).
$attributes
This will construct a new object directly from a performance string by parsing it.
# Set an attribute $object->attribute_name($new_value); # Get an attribute my $value = $object->attribute_name;
This is the threshold for when a critical status will be issued based on the performance.
Required. This is the label for the performance data.
This is the maximum value for the performance data.
This is the minimum value for the performance data.
This is a string representing the units of measurement that the values are in.
Required. This is the performance value.
This is the threshold for when a warning status will be issued based on the performance.
This will clear the value in "critical_threshold".
This will clear the value in "warning_threshold".
This will return a true value if "critical_threshold" is set.
This will return a true value if "maximum_value" is set.
This will return a true value if "minimum_value" is set.
This will return a true value if "units" is set.
This will return a true value if "warning_threshold" is set.
This will return a true value if the value falls in the range specified by "critical_threshold".
This will return a true value if the value does not fall within the critical or warning ranges.
This will return a true value if the value falls in the range specified by "warning_threshold".
This will return a true value if the value falls within the range given as the first argument.
say $data->is_within_range('10:20') ? 'Outsite range of 10-20' : 'Inside range of 10-20, inclusive' ;
This will take a list of performance strings and split them at the white space while keeping intact quoted whitespace in the labels. Note that this is a static method and thus can be called as Nagios::Plugin::OverHTTP::PerformanceData->split_performance_string().
Nagios::Plugin::OverHTTP::PerformanceData->split_performance_string()
# Example use to get a long string of different data into objects my @data = map { Nagios::Plugin::OverHTTP::PerformanceData->new($_) } Nagios::Plugin::OverHTTP::PerformanceData->split_performance_string($string_of_many);
This returns a string-representation of the object. The string representation of the performance data is as a preformance string in the format specified by the Nagios plugin documentation 'label'=value[UOM];[warn];[crit];[min];[max].
'label'=value[UOM];[warn];[crit];[min];[max]
This module is dependent on the following modules:
Carp
Const::Fast
Moose 0.74
MooseX::StrictConstructor 0.08
MooseX::Types::Moose
Regexp::Common 2.119
namespace::clean 0.04
Douglas Christopher Wilson, <doug at somethingdoug.com>
<doug at somethingdoug.com>
Please report any bugs or feature requests to bug-nagios-plugin-overhttp at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Nagios-Plugin-OverHTTP. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-nagios-plugin-overhttp at rt.cpan.org
Copyright 2010-2012 Douglas Christopher Wilson, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of either:
the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or
the Artistic License version 2.0.
To install Nagios::Plugin::OverHTTP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nagios::Plugin::OverHTTP
CPAN shell
perl -MCPAN -e shell install Nagios::Plugin::OverHTTP
For more information on module installation, please visit the detailed CPAN module installation guide.