Module: check_mk
Branch: master
Commit: 238926ae190e33e30b3d866326f3f5e7aaaf5208
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=238926ae190e33…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 25 16:10:12 2010 +0200
ChangeLog
Enhanced blade_bays check
---
checks/blade_bays | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/checks/blade_bays b/checks/blade_bays
index 1bd0b2e..c4c5714 100644
--- a/checks/blade_bays
+++ b/checks/blade_bays
@@ -24,23 +24,32 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+blade_bay_module_state = {
+ 0: 'standby',
+ 1: 'on',
+ 2: 'notPresent',
+ 255: 'notApplicable',
+}
def inventory_blade_bays(checkname, info):
- # find only modules that are present and switched on
- return [ (line[0], '', line[1]) for line in info if line[1] == "1"
]
+ # find only modules that are present and switched on or standby
+ return [ (line[0], '', line[1]) for line in info if line[1] in [ '0',
'1' ] ]
def check_blade_bays(item, params, info):
for line in info:
if line[0] == item:
- state = int(line[1])
+ state = saveint(line[1])
+ type = line[2]
if state == 1:
- return (0, "OK - State OK")
+ return (0, "OK - State %s (Type: %s, ID: %s)" %
+ (blade_bay_module_state.get(state, 'Unhandled'), type,
line[3]))
elif state == 2:
return (1, "WARNING - Not present")
+ elif state == 0:
+ return (1, "WARNING - Device is in standby")
else:
return (2, "CRIT - invalid state %d" % state)
return (3, "UNKNOWN - no data for '%s' in SNMP info" % item)
-
check_info['blade_bays'] = (check_blade_bays, "BAY %s", 0,
inventory_blade_bays)
snmp_info['blade_bays'] = ( "1.3.6.1.4.1.2.3.51.2.2.10.2.1.1", [ 5, 6 ]
) # BLADE-MIB