Module: check_mk
Branch: master
Commit: 2f50b4a83690a00cc3299f37ce85a13c85349c43
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2f50b4a83690a0…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Nov 10 14:54:51 2011 +0100
FIX: blade_bays: fix naming of item and man page
---
ChangeLog | 1 +
checkman/blade_bays | 9 +++------
checks/blade_bays | 26 ++++++++++++++++++++++----
3 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5c35025..08b2f3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,7 @@
Checks & Agents:
* FIX: mem.win: Default levels now works, check not always OK
* FIX: blade_health: fix OID specification
+ * FIX: blade_bays: fix naming of item and man page
Multisite:
* FIX: Fixed encoding problem when opening dashboard
diff --git a/checkman/blade_bays b/checkman/blade_bays
index 28c5996..ccb66ee 100644
--- a/checkman/blade_bays
+++ b/checkman/blade_bays
@@ -10,12 +10,9 @@ description:
in a critical check result.
item:
- Number of the bay (as string, not int).
-
-examples:
- checks += [
- ( "hostabc", "blade_bays", "8", None)
- ]
+ A string with the format "PD{A} {B}" where {A} is the number
+ of the power domain (1 or 2) and {B} is the name of the bay
+ (e.g. {Midplane}).
inventory:
All bays with the state 1 (present and OK) are automatically
diff --git a/checks/blade_bays b/checks/blade_bays
index 0be3318..e7cf0f1 100644
--- a/checks/blade_bays
+++ b/checks/blade_bays
@@ -31,13 +31,27 @@ blade_bays_module_state = {
255: 'notApplicable',
}
+def blade_bays_make_item(line):
+ # "3.IO Module 5"
+ pd, name = line[0].split(".", 1)
+ if pd == '2':
+ power_domain = 1
+ else:
+ power_domain = 2
+ return "PD%d %s" % (power_domain, name)
+
def inventory_blade_bays(info):
# 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' ] ]
+ inventory = []
+ for line in info:
+ if line[1] in [ '0', '1' ]:
+ item = blade_bays_make_item(line)
+ inventory.append((item, None))
+ return inventory
-def check_blade_bays(item, params, info):
+def check_blade_bays(item, _no_params, info):
for line in info:
- if line[0] == item:
+ if item == blade_bays_make_item(line):
state = saveint(line[1])
type = line[2].split('(')[0]
if state == 1:
@@ -52,7 +66,11 @@ def check_blade_bays(item, params, info):
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", "3.1.1"], [ 5, 6, 2, 1 ] ) # BLADE-MIB
+snmp_info['blade_bays'] = (
+ ".1.3.6.1.4.1.2.3.51.2.2.10", [
+ "2", # powerDomain1
+ "3", # powerDomain2
+ ], [ "1.1.5", "1.1.6", "1.1.2", "1.1.1" ] ) #
BLADE-MIB
snmp_scan_functions['blade_bays'] = \
lambda oid: re.match('BladeCenter( Advanced)* Management Module',
oid(".1.3.6.1.2.1.1.1.0"))