Module: check_mk
Branch: master
Commit: a8961d6ea239af5fa7b1ed785b6edd09a191cc5a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a8961d6ea239af…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Dec 10 13:58:51 2013 +0100
apc_powerswitch: Cleanup in Inventory and Scan function. Thanks to Raphael Mazelier
---
checks/apc_powerswitch | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/checks/apc_powerswitch b/checks/apc_powerswitch
index 40f78db..e651331 100644
--- a/checks/apc_powerswitch
+++ b/checks/apc_powerswitch
@@ -29,7 +29,7 @@ apc_powerswitch_critical_states = ()
def inventory_apc_powerswitch(info):
- return [(x[0],saveint(x[2])) for x in info]
+ return [ (x[0],saveint(x[2])) for x in info if x[1] == "1" ]
def check_apc_powerswitch(item, params, info):
state_name = {
@@ -46,12 +46,12 @@ def check_apc_powerswitch(item, params, info):
r_state = 2
return(r_state, 'Port %s has status %s' % (line[1],
state_name[state]))
- return False
+ return 3, "Port not found"
check_info['apc_powerswitch'] = {
'check_function' : check_apc_powerswitch,
'inventory_function' : inventory_apc_powerswitch,
- 'snmp_scan_function' : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.318.1.3.4.5"),
+ 'snmp_scan_function' : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.318.1.3.4"),
'service_description' : 'Power Outlet Port %s',
'snmp_info' : ( '.1.3.6.1.4.1.318.1.1.12.3.5.1.1', [1, 2, 4] ),
}