ef; # Warning levels for Linux Load or Cisco CPU $ o_crit=undef; # Critical level @ o_critL=undef; # Critical level for Linux Load or Cisco CPU $ o_timeout=undef; # Timeout (Default 5) $ o_perf=undef; # Output performance data $ o_version2=undef; # Use snmp v2c
# SNMPv3 specific $ o_login=undef; # Login for snmpv3 $ o_passwd=undef; # Pass for snmpv3 $ v3protocols=undef; # V3 protocol list. $ O_authproto= md5 raquo ;; # Auth protocol $ o_privproto= des raquo ;; # Priv protocol $ o_privpass=undef; # Priv password
# functions
p_version {print check_snmp_load version: $ Version n raquo ;; }
print_usage { Usage: $ 0 [-v] -H lt; host gt;-C Lt; snmp_community gt; [- 2] | (-l login -x passwd [-X pass -L lt; authp gt;, lt; privp gt;]) [-p lt; port gt;] -w lt; warn level gt;-c lt; crit level gt;-T=[Stand | netsl | netsc | as400 | cisco | cata | nsc | fg | bc | nokia | hp | lp | hpux] [-f] [-t lt; timeout gt;] [-V] n raquo ;;
}
isnnum {# Return true if arg is not a number $ num=shift; ($ num=~ /^(d+.?d*)|(^.d+)$/) {return 0;} 1;
}
help { nSNMP Load amp; CPU Monitor for Nagios version , $ Version, n raquo ;; GPL licence, (c) 2004-2007 Patrick Proy n n raquo ;; _ usage (); lt; lt; EOT;
v, --verboseextra debugging information
h, --helpthis help message
H, --hostname=HOSTor IP address of host to check
C, --community=COMMUNITY NAMEname for the host's SNMP agent (implies v1 protocol)
, --v2csnmp v2c
l, --login=LOGIN;-x, --passwd=PASSWDand auth password for snmpv3 authenticationno priv password exists, implies AuthNoPriv
X, --privpass=PASSWDpassword for snmpv3 (AuthPriv protocol)
L, --protocols= lt; authproto gt;, lt; privproto gt;
lt; authproto gt;:Authentication protocol (md5 | sha: default md5)
lt; privproto gt;:Priv protocole (des | aes: default des)
P, --port=PORTport (Default 161)
w, --warn=INTEGER | INT, INT, INT
value check: warning level for cpu in percent (on one minute)
value check: comma separated level for load or cpu for 1min, 5min, 15min
c, --crit=INTEGER | INT, INT, INTlevel for cpu in percent (on one minute)
value check: critical level for cpu in percent (on one minute)
value check: comma separated level for load or cpu for 1min, 5min, 15min
T, --type=stand | netsl | netsc | as400 | cisco | bc | nokia | hp | lpcheck :: standard MIBII (works with Windows), handle multiple CPU .: linux load provided by Net SNMP (1,5 amp; 15 minutes values): cpu usage given by net-snmp (100-idle): as400 CPU usage: Cisco CPU usage: Cisco catalyst CPU usage: NetScreen CPU usage: Fortigate CPU usage: Bluecoat CPU usage:Nokia CPU usage: HP procurve switch CPU usage: Linkproof CPU usage: HP-UX load (1,5 amp; 15 minutes values)
f, --perfparsecompatible output
t, --timeout=INTEGERfor SNMP in seconds (Default: 5)
V, --versionversion number
}
# For verbose outputverb {my $ t=shift; print $ t, n if defined ($ o_verb); }
check_options {:: Long :: Configure ( bundling ); (
v = gt; $ o_verb, verbose = gt; $ o_verb,
h = gt; $ o_help, help = gt; $ o_help,
H: s = gt; $ o_host, hostname: s = gt; $ o_host,
p: i = gt; $ o_port, port: i = gt; $ o_port,
C: s = gt; $ o_community, community: s = gt; $ o_community,
l: s = gt; $ o_login, login: s = gt; $ o_login,
x: s = gt; $ o_passwd, passwd: s = gt; $ o_passwd,
X: s = gt; $ o_privpass, privpass: s = gt; $ o_privpass,
L: s = gt; $ v3protocols, protocols: s = gt; $ v3protocols,
t: i = gt; $ o_timeout, timeout: i = gt; $ o_timeout,
V = gt; $ o_version, version = gt; $ o_version,
2 = gt; $ o_version2, v2c = gt; $ o_version2,
c: s = gt; $ o_crit, critical: s = gt; $ o_crit,
w: s = gt; $ o_warn, warn: s = gt; ...