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