GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Nagios::Plugin::Performance(3) User Contributed Perl Documentation Nagios::Plugin::Performance(3)

Nagios::Plugin::Performance - class for handling Nagios::Plugin performance data.

  use Nagios::Plugin::Performance use_die => 1;

  # Constructor (also accepts a 'threshold' obj instead of warning/critical)
  $p = Nagios::Plugin::Performance->new(
      label     => 'size',
      value     => $value,
      uom       => "kB",
      warning   => $warning,
      critical  => $critical,
      min       => $min,
      max       => $max,
  );

  # Parser
  @perf = Nagios::Plugin::Performance->parse_perfstring(
      "/=382MB;15264;15269;; /var=218MB;9443;9448"
  ) 
  or warn("Failed to parse perfstring");

  # Accessors
  for $p (@perf) {
    printf "label:    %s\n",   $p->label;
    printf "value:    %s\n",   $p->value;
    printf "uom:      %s\n",   $p->uom;
    printf "warning:  %s\n",   $p->warning;
    printf "critical: %s\n",   $p->critical;
    printf "min:      %s\n",   $p->min;
    printf "max:      %s\n",   $p->max;
    # Special accessor returning a threshold obj containing warning/critical
    $threshold = $p->threshold;
  }

  # Perfdata output format i.e. label=value[uom];[warn];[crit];[min];[max]
  print $p->perfoutput;

Nagios::Plugin class for handling performance data. This is a public interface because it could be used by performance graphing routines, such as nagiostat (http://nagiostat.sourceforge.net), perfparse (http://perfparse.sourceforge.net), nagiosgraph (http://nagiosgraph.sourceforge.net) or NagiosGrapher (http://www.nagiosexchange.org/NagiosGrapher.84.0.html).

Nagios::Plugin::Performance offers both a parsing interface (via parse_perfstring), for turning nagios performance output strings into their components, and a composition interface (via new), for turning components into perfdata strings.

If you are using this module for the purposes of parsing perf data, you will probably want to set use_die => 1 at use time. This forces &Nagios::Plugin::Functions::nagios_exit to call die() - rather than exit() - when an error occurs. This is then trappable by an eval. If you don't set use_die, then an error in these modules will cause your script to exit

Nagios::Plugin::Performance->new(%attributes)
Instantiates a new Nagios::Plugin::Performance object with the given attributes.
Nagios::Plugin::Performance->parse_perfstring($string)
Returns an array of Nagios::Plugin::Performance objects based on the string entered. If there is an error parsing the string - which may consists of several sets of data - will return an array with all the successfully parsed sets.

If values are input with commas instead of periods, due to different locale settings, then it will still be parsed, but the commas will be converted to periods.

label, value, uom, warning, critical, min, max
These all return scalars. min and max are not well supported yet.
threshold
Returns a Nagios::Plugin::Threshold object holding the warning and critical ranges for this performance data (if any).
rrdlabel
Returns a string based on 'label' that is suitable for use as dataset name of an RRD i.e. munges label to be 1-19 characters long with only characters [a-zA-Z0-9_].

This calls $self->clean_label and then truncates to 19 characters.

There is no guarantee that multiple N:P:Performance objects will have unique rrdlabels.

clean_label
Returns a "clean" label for use as a dataset name in RRD, ie, it converts characters that are not [a-zA-Z0-9_] to _.

It also converts "/" to "root" and "/{name}" to "{name}".

perfoutput
Outputs the data in Nagios::Plugin perfdata format i.e. label=value[uom];[warn];[crit];[min];[max].

Nagios::Plugin, Nagios::Plugin::Threshold, http://nagiosplug.sourceforge.net.

This code is maintained by the Nagios Plugin Development Team: see http://nagiosplug.sourceforge.net.

Copyright (C) 2006-2007 Nagios Plugin Development Team

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2010-12-03 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.