2009年6月25日木曜日

Nagiosプラグイン、check_snmp で閾値に下限を設定する

メモエントリ。
Nagiosプラグインの check_snmp について。
 

check_snmp を使って性能監視をしたいと思ったが、警告(WARNING) オプションで閾値を指定すると、取得した値が閾値を上回ったらWARNING で返ってくる。
下回った時はどうやって設定するんだろう。
 

とりあえずヘルプを見る。

# ./check_snmp --help
check_snmp v2021 (nagios-plugins 1.4.13)
Copyright (c) 1999-2007 Nagios Plugin Development Team

 
Check status of remote machines and obtain sustem information via SNMP
 
 
Usage:check_snmp -H -o [-w warn_range] [-c crit_range]
[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]
[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]
[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]
[-A authpasswd] [-X privpasswd]
 
Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
-H, --hostname=ADDRESS
Host name, IP Address, or unix socket (must be an absolute path)
-p, --port=INTEGER
Port number (default: 161)
-n, --next
Use SNMP GETNEXT instead of SNMP GET
-P, --protocol=[1|2c|3]
SNMP protocol version
-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]
SNMPv3 securityLevel
-a, --authproto=[MD5|SHA]
SNMPv3 auth proto
-C, --community=STRING
Optional community string for SNMP communication (default is "public")
-U, --secname=USERNAME
SNMPv3 username
-A, --authpassword=PASSWORD
SNMPv3 authentication password
-X, --privpasswd=PASSWORD
SNMPv3 privacy password
-o, --oid=OID(s)
Object identifier(s) or SNMP variables whose value you wish to query
-m, --miblist=STRING
List of MIBS to be loaded (default = none if using numeric oids or 'ALL'
for symbolic oids.)
-d, --delimiter=STRING
Delimiter to use when parsing returned data. Default is "=" Any data on the right hand side of the delimiter is considered
to be the data that should be used in the evaluation.
-w, --warning=INTEGER_RANGE(s)
Range(s) which will not result in a WARNING status

-c, --critical=INTEGER_RANGE(s)
Range(s) which will not result in a CRITICAL status
-s, --string=STRING
Return OK state (for that OID) if STRING is an exact match
-r, --ereg=REGEX
Return OK state (for that OID) if extended regular expression REGEX matches
-R, --eregi=REGEX
Return OK state (for that OID) if case-insensitive extended REGEX matches
-l, --label=STRING
Prefix label for output from plugin (default -s 'SNMP')
-u, --units=STRING
Units label(s) for output data (e.g., 'sec.').
-D, --output-delimiter=STRING
Separates output on multiple OID requests
-t, --timeout=INTEGER
Seconds before connection times out (default: 10)
-v, --verbose
Show details for command-line debugging (Nagios may truncate output)
 
This plugin uses the 'snmpget' command included with the NET-SNMP package.
if you don't have the package installed, you will need to download it from
http://net-snmp.sourceforge.net before you can use this plugin.
 
Notes:
- Multiple OIDs may be indicated by a comma- or space-delimited list (lists with
internal spaces must be quoted) [max 8 OIDs]
- Ranges are inclusive and are indicated with colons. When specified as
'min:max' a STATE_OK will be returned if the result is within the indicated
range or is equal to the upper or lower bound. A non-OK state will be
returned if the result is outside the specified range.
- If specified in the order 'max:min' a non-OK state will be returned if the
result is within the (inclusive) range.
- Upper or lower bounds may be omitted to skip checking the respective limit.
- Bare integers are interpreted as upper limits.
- When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'
- Note that only one string and one regex may be checked at present
- All evaluation methods other than PR, STR, and SUBSTR expect that the value
returned from the SNMP query is an unsigned integer.
 
Send email to nagios-users@lists.sourceforge.net if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to nagiosplug-devel@lists.sourceforge.net

 

閾値はレンジだそうで、Note部分に色々書いてあるな、ちょっと試してみた。値はコロンで仕切ろう。
    設定例
  1. "-w 100" ⇒ 100を超えたら警告

  2. "-w :100" ⇒ 100を超えたら警告

  3. "-w 100:500" ⇒ 100から500の範囲からはみ出したら警告

  4. "-w 100:" ⇒ 100未満なら警告


 

という感じになる模様。