Module: check_mk
Branch: master
Commit: ca6bfcd5f9e37ca92cc0eacb84f9530c13c136e8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ca6bfcd5f9e37c…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Apr 22 13:19:06 2015 +0200
ups_socomec_capacity: Move default value for dict parameters to factory settings
---
checks/ups_socomec_capacity | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/checks/ups_socomec_capacity b/checks/ups_socomec_capacity
index 3897008..acfc4e1 100644
--- a/checks/ups_socomec_capacity
+++ b/checks/ups_socomec_capacity
@@ -32,15 +32,16 @@
# upsBatteryTemperature 1.3.6.1.4.1.4555.1.1.1.1.2.6
-ups_capacity_default_levels = { 'battime': (0, 0), 'capacity': (95, 90)
}
+factory_settings["ups_capacity_default_levels"] = { 'battime': (0, 0),
'capacity': (95, 90) }
def inventory_ups_socomec_capacity(info):
if len(info) > 0:
- return [(None, 'ups_capacity_default_levels')]
+ return [(None,{})]
def check_ups_socomec_capacity(item, params, info):
# To support inventories with the old version
+ # TODO This needs to be reworked. Defaults should not be coded into a check in such a
fashion.
if type(params) is tuple: # old format with 2 params in tuple
warn, crit = params
cap_warn, cap_crit = (95, 90)
@@ -84,11 +85,12 @@ def check_ups_socomec_capacity(item, params, info):
check_info["ups_socomec_capacity"] = {
- "check_function" : check_ups_socomec_capacity,
- "inventory_function" : inventory_ups_socomec_capacity,
- "service_description" : "Battery capacity",
- "has_perfdata" : True,
- "group" : "ups_capacity",
- "snmp_info" : (".1.3.6.1.4.1.4555.1.1.1.1.2" , [ 2,
3, 4 ] ) ,
- "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.4555.1.1.1",
+ "check_function" : check_ups_socomec_capacity,
+ "inventory_function" : inventory_ups_socomec_capacity,
+ "default_levels_variable" : 'ups_capacity_default_levels',
+ "service_description" : "Battery capacity",
+ "has_perfdata" : True,
+ "group" : "ups_capacity",
+ "snmp_info" : (".1.3.6.1.4.1.4555.1.1.1.1.2" , [
2, 3, 4 ] ) ,
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.4555.1.1.1",
}