Module: check_mk
Branch: master
Commit: f105dea29fa9132bd7f91b7f566762d034722dab
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f105dea29fa913…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Mar 2 14:22:41 2015 +0100
hp_procurve_mem: minor code cleanup
---
checks/hp_procurve_mem | 34 +++++++++++-----------------------
1 file changed, 11 insertions(+), 23 deletions(-)
diff --git a/checks/hp_procurve_mem b/checks/hp_procurve_mem
index 47db1fd..0ea0aeb 100644
--- a/checks/hp_procurve_mem
+++ b/checks/hp_procurve_mem
@@ -33,38 +33,26 @@
factory_settings["hp_procurve_mem_default_levels"] = { "levels" :
("perc_used", (80, 90)) }
+
def inventory_hp_procurve_mem(info):
if len(info) == 1 and int(info[0][0]) >= 0:
return [ ("", 'hp_procurve_mem_default_levels') ]
+
def check_hp_procurve_mem(item, params, info):
if len(info) == 1:
mem_total, mem_used = [ int(mem) for mem in info[0] ]
return check_memory(mem_used, mem_total, params)
-# if mem_total > 0:
-# perc = mem_used * 100 / float(mem_total)
-# status = 0
-# output = ''
-# if perc >= params[1]:
-# status = 2
-# output = ' (Above %d%%)' % params[1]
-# elif perc >= params[0]:
-# status = 1
-# output = ' (Above %d%%)' % params[0]
-#
-# return (status, 'Memory usage is %d%% %s' % (perc, output),
-# [('bytes_used', '%db' % mem_used, params[0],
params[1], 0, mem_total)])
check_info["hp_procurve_mem"] = {
- 'check_function': check_hp_procurve_mem,
- 'inventory_function': inventory_hp_procurve_mem,
- 'service_description': 'Memory',
- 'group': 'memory_simple',
- 'default_levels_variable': 'hp_procurve_mem_default_levels',
- 'has_perfdata': True,
- 'snmp_info': ('.1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1',
['5', '7']),
- 'snmp_scan_function': \
- lambda oid: ".11.2.3.7.11" in oid(".1.3.6.1.2.1.1.2.0"),
- 'includes': [ "memory.include" ],
+ 'check_function' : check_hp_procurve_mem,
+ 'inventory_function' : inventory_hp_procurve_mem,
+ 'service_description' : 'Memory',
+ 'group' : 'memory_simple',
+ 'default_levels_variable' : 'hp_procurve_mem_default_levels',
+ 'has_perfdata' : True,
+ 'snmp_info' :
('.1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1', ['5', '7']),
+ 'snmp_scan_function' : lambda oid: ".11.2.3.7.11" in
oid(".1.3.6.1.2.1.1.2.0"),
+ 'includes' : [ "memory.include" ],
}