Module: check_mk
Branch: master
Commit: 44005536a6073c841e5c6557c695ab01e28a2b6f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=44005536a6073c…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Mon Feb 10 18:34:47 2014 +0100
cisco_fru_power: minor code cleanup and check man page added
---
checkman/cisco_fru_power | 20 ++++++++++++++++++++
checks/cisco_fru_power | 21 +++++++++++----------
2 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/checkman/cisco_fru_power b/checkman/cisco_fru_power
new file mode 100644
index 0000000..6218210
--- /dev/null
+++ b/checkman/cisco_fru_power
@@ -0,0 +1,20 @@
+title: Cisco Nexus Switches: State of FRU Power Supplies
+agents: snmp
+catalog: hw/network/cisco
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the administrative and operational status of field
+ replaceable unit (FRU) power supplies of Cisco switches. The check is
+ {OK} when the administrative and operational state is {on}. The check is
+ {CRIT} when the administrative state is {off} or the operational state
+ is {offDenied}, {offEnvPower}, {offEnvTemp}, {offEnvFan}. {failed},
+ {onButInlinePowerFail}. The check is {WARN} otherwise.
+
+item:
+ The index of the power supply from the list of OIDs for the device.
+
+inventory:
+ One check is created for each FRU power supply unit. Units are only included
+ if they are not in the operational state {offEnvOther} and {offEnvPower}
+
diff --git a/checks/cisco_fru_power b/checks/cisco_fru_power
index 37cdc3d..5b66152 100644
--- a/checks/cisco_fru_power
+++ b/checks/cisco_fru_power
@@ -57,12 +57,6 @@
# 5:powerCycle
#
-power_oper_type = ('', 'offEnvOther', 'on', 'offAdmin',
'offDenied',
- 'offEnvPower', 'offEnvTemp', 'offEnvFan',
'failed',
- 'onButFanFail', 'offCooling',
'offConnectorRating',
- 'onButInlinePowerFail' )
-
-power_admin_type = ( '', 'on', 'off', 'inlineAuto',
'inlineOn', 'powercycle')
def inventory_cisco_fru_power(info):
return [ (line[0], None ) for line in info if saveint(line[2]) not in [ 1, 5 ] ]
@@ -70,9 +64,15 @@ def inventory_cisco_fru_power(info):
def check_cisco_fru_power(item, params, info):
for line in info:
if line[0] == item:
+ power_oper_type = ('', 'offEnvOther', 'on',
'offAdmin', 'offDenied',
+ 'offEnvPower', 'offEnvTemp',
'offEnvFan', 'failed',
+ 'onButFanFail', 'offCooling',
'offConnectorRating',
+ 'onButInlinePowerFail' )
+ power_admin_type = ( '', 'on', 'off',
'inlineAuto', 'inlineOn', 'powercycle')
+
admin_state, oper_state = map(saveint, line[1:3])
- output = 'Admin-State: %s, Oper-State: %s' %
(power_admin_type[admin_state],
- power_oper_type[oper_state])
+ admin_state_txt = power_admin_type[admin_state]
+ oper_state_txt = power_oper_type[oper_state]
admin_sym = ""
oper_sym = ""
if admin_state == 1 and oper_state == 2:
@@ -89,8 +89,9 @@ def check_cisco_fru_power(item, params, info):
admin_sym = "(!)"
if oper_state not in (2,4,5,6,7,8,12):
oper_sym = "(!)"
- return (state, "Admin-State: %s%s, Oper-State: %s%s" % \
-
(power_admin_type[admin_state],admin_sym,power_oper_type[oper_state],oper_sym))
+ infotext = "Admin-State: %s%s, Oper-State: %s%s" % \
+ (admin_state_txt, admin_sym, oper_state_txt, oper_sym))
+ return (state, infotext)
return (3, "item not found in snmp data")