Changeset eb4ac990d1c5ec58d6843a8b629dd7637295c789

Show
Ignore:
Timestamp:
03/24/10 18:46:44 (4 years ago)
Author:
Mark Harrison <mark@omniti.com>
git-committer:
Mark Harrison <mark@omniti.com> 1269456404 +0000
git-parent:

[d5d274d63e8181bd8caa0ead9af08222e01edd87]

git-author:
Mark Harrison <mark@omniti.com> 1269456404 +0000
Message:

Documentation for check_resmon_metric

git-svn-id: https://labs.omniti.com/resmon/branches/resmon2@285 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • resources/check_resmon_metric

    rd5d274d reb4ac99  
    11#!/usr/bin/perl -w 
    2 # Nagios script to check a resmon monitor's metrics and trigger alerts based 
    3 # on various rules 
    4  
    52# Remove the following line to disable embedded perl 
    63# nagios: +epn 
     4 
     5=pod 
     6 
     7=head1 NAME 
     8 
     9check_resmon_metric - Nagios check to monitor a resmon metric 
     10 
     11=head1 SYNOPSIS 
     12 
     13check_resmon_metric -H hostname [-P port] -M module_name -C check_name 
     14                    -m metric_name [ -r regex | [-w warning_threshold] 
     15                    [-c critical_threshold] ] 
     16 
     17=head1 DESCRIPTION 
     18 
     19This is a nagios check script that will connect to a running resmon instance, 
     20fetch information for a single check, and compare a metric against rules 
     21provided on the command line, returning the status to nagios based on the 
     22result. 
     23 
     24For numeric metrics, there are options for warning/critical thresholds, and 
     25for string metrics, there is an option to match against a regular expression. 
     26 
     27=head1 OPTIONS 
     28 
     29=over 
     30 
     31=item -H hostname 
     32 
     33The hostname of the resmon instance to connect to. Required. 
     34 
     35=item -P port 
     36 
     37The port that resmon is listening on. Defaults to 81. 
     38 
     39=item -M module_name 
     40 
     41The module name of the check you wish to fetch. Required. 
     42 
     43=item -C check_name 
     44 
     45The check name you wish to fetch. Required. 
     46 
     47=item -m metric_name 
     48 
     49The name of the metric you wish to evaluate rules against. Required. 
     50 
     51=item -w warning_threshold 
     52 
     53A numeric threshold (see below) to test the metric against. Will return a 
     54warning status if the threshold matches. This is only applicable for numeric 
     55metrics. An error will be returned for string metrics. Optional. 
     56 
     57=item -c critical_threshold 
     58 
     59A numeric threshold (see below) to test the metric against. Will return a 
     60critical status if the threshold matches. This is only applicable for numeric 
     61metrics. An error will be returned for string metrics. If both the critical 
     62and warning thresholds match a given metric, then the status returned is 
     63critical.  Optional. 
     64 
     65=item -r regex 
     66 
     67A regular expression to match the metric against. This is most useful for 
     68string based metrics. If the regular expression matches, then an ok status 
     69will be returned, otherwise the status will be critical. This cannot be used 
     70in conjunction with the warning/critical thresholds. Optional. 
     71 
     72=item -A age 
     73 
     74This option will cause a check to be critical if it was updated more than age 
     75seconds ago. 
     76 
     77=back 
     78 
     79=head1 THRESHOLDS 
     80 
     81The warning and critical thresholds are specified in the same way as for other 
     82nagios plugins, as desribed at 
     83http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT 
     84 
     85Most of the time, you just want to put a number for the threshold. For 
     86example, '-w 10 -c 20' would go warning if the value is over 10, and critical 
     87if it is over 20. 
     88 
     89For more complex ranges, use the more generalized format of: [@]start:end 
     90 
     91=over 
     92 
     93=item * 
     94 
     95Start and end are both numbers, and either can be negative 
     96 
     97=item * 
     98 
     99If start is missing, then the colon isn't required, and the range is from 0 to 
     100end. In other words, if you specify a single number, the range is from 0 to 
     101the number you specified. 
     102 
     103=item * 
     104 
     105If end is missing (E.g. 10:), then the range is from start to infinity. 
     106 
     107=item * 
     108 
     109If start is '~', then the range is from minus infinity to end (as opposed to 
     1100-end if start is omitted) 
     111 
     112=item * 
     113 
     114An alert is generated if the test value lies outside the specified range. 
     115 
     116=item * 
     117 
     118If @ is specified at the beginning, the alerting behavior is flipped. In other 
     119words, an alert is generated if the value lies within the range. 
     120 
     121=back 
     122 
     123=head2 EXAMPLES 
     124 
     125The following lists example thresholds, and the conditions under which an 
     126alert is generated. 
     127 
     128=over 
     129 
     130=item '10' 
     131 
     132Ok if: 0 <= X <= 10, Alert if: X < 0 or X > 10 
     133 
     134=item '10:' 
     135 
     136Ok if: X >= 10, Alert if: X < 10 
     137 
     138=item '~:10' 
     139 
     140Ok if: X <= 10, Alert if: X > 10 
     141 
     142=item '10:20' 
     143 
     144Ok if: 10 <= X <= 20, Alert if: X < 10 or X > 20 
     145 
     146=item '@10:20' 
     147 
     148Ok if: X < 10 or X > 20, Alert if: 10 <= X <= 20 
     149 
     150=back 
     151 
     152=cut 
    7153 
    8154use vars qw($PROGNAME);