Module: check_mk
Branch: master
Commit: 61f5e09a1f5e50bc5e394c42ffcf9e16d8c72af2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=61f5e09a1f5e50…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Apr 23 14:02:15 2015 +0200
#1242 enterasys_powersupply: It's now possible to choice which redundancy state
treated as OK
You will find a new Wato RUle: Enterasys Power Supply Settings
---
.werks/1242 | 10 +++++++++
ChangeLog | 1 +
checks/enterasys_powersupply | 39 ++++++++++++++++++++--------------
web/plugins/wato/check_parameters.py | 26 +++++++++++++++++++++++
4 files changed, 60 insertions(+), 16 deletions(-)
diff --git a/.werks/1242 b/.werks/1242
new file mode 100644
index 0000000..292daea
--- /dev/null
+++ b/.werks/1242
@@ -0,0 +1,10 @@
+Title: enterasys_powersupply: It's now possible to choice which redundancy state
treated as OK
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1429790441
+Class: feature
+
+You will find a new Wato RUle: Enterasys Power Supply Settings
+
diff --git a/ChangeLog b/ChangeLog
index e69a20c..d2c0133 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -168,6 +168,7 @@
* 2205 check_icmp: new option for pinging the host alias or an explicity address...
* 2210 check_bi_aggr: new option for honoring downtimes and acknowledgements...
* 2211 netapp_api_disk.summary: output physical size of broken disks as an additional
information
+ * 1242 enterasys_powersupply: It's now possible to choice which redundancy state
treated as OK...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checks/enterasys_powersupply b/checks/enterasys_powersupply
index 732723e..6f39260 100644
--- a/checks/enterasys_powersupply
+++ b/checks/enterasys_powersupply
@@ -30,6 +30,10 @@
# 1.3.6.1.4.1.52.4.3.1.2.1.1.3 ctChasPowerSupplyType
# 1.3.6.1.4.1.52.4.3.1.2.1.1.4 ctChasPowerSupplyRedundancy
+factory_settings['enterasys_powersupply_default'] = {
+ "redundancy_ok_states" : ( 1, ),
+}
+
def inventory_enterasys_powersupply(info):
inventory = []
for num, state, typ, redun in info:
@@ -37,34 +41,37 @@ def inventory_enterasys_powersupply(info):
inventory.append(( num, None ))
return inventory
-def check_enterasys_powersupply(item, _no_params, info):
+def check_enterasys_powersupply(item, params, info):
supply_types = {
- '1' : 'ac-dc',
- '2' : 'dc-dc',
- '3' : 'notSupported',
- '4' : 'highOutput',
+ 1 : 'ac-dc',
+ 2 : 'dc-dc',
+ 3 : 'notSupported',
+ 4 : 'highOutput',
}
redundancy_types = {
- '1' : 'redundant',
- '2' : 'notRedundant',
- '3' : 'notSupported',
+ 1 : 'redundant',
+ 2 : 'notRedundant',
+ 3 : 'notSupported',
}
for num, state, typ, redun in info:
if num == item:
- if state == '4':
+ state,redun,typ = map(int, (state, redun, typ))
+ if state == 4:
return 2, 'PSU installed and not operating'
- if redun != '1':
+ if redun not in params['redundancy_ok_states']:
return 1, 'PSU %s' % redundancy_types[redun]
- return 0, 'PSU working and redundant (%s)' % supply_types[typ]
+ return 0, 'PSU working and %s (%s)' % (redundancy_types[redun],
supply_types[typ])
check_info["enterasys_powersupply"] = {
- "check_function" : check_enterasys_powersupply,
- "inventory_function" : inventory_enterasys_powersupply,
- "service_description" : "PSU %s",
- "snmp_info" : ( ".1.3.6.1.4.1.52.4.3.1.2.1.1", [
OID_END, 2, 3, 4 ]),
- "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.5624.2.1") \
+ "check_function" : check_enterasys_powersupply,
+ "inventory_function" : inventory_enterasys_powersupply,
+ "service_description" : "PSU %s",
+ "default_levels_variable" : "enterasys_powersupply_default",
+ "snmp_info" : ( ".1.3.6.1.4.1.52.4.3.1.2.1.1", [
OID_END, 2, 3, 4 ]),
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.5624.2.1") \
or
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.5624.2.2"),
+ "group" : "enterasys_powersupply",
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index dd04f5c..7e674ac 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1762,6 +1762,32 @@ register_check_parameters(
"dict"
)
+register_check_parameters(
+ subgroup_networking,
+ "enterasys_powersupply",
+ _("Enterasys Power Supply Settings"),
+ Dictionary(
+ elements = [
+ ( "redundancy_ok_states",
+ ListChoice(
+ title = _("States treated as OK"),
+ choices = [
+ (1, 'redundant'),
+ (2, 'notRedundant'),
+ (3, 'notSupported'),
+ ],
+ default_value = [ 1 ],
+ )
+ ),
+ ],
+ optional_keys = False,
+ ),
+ TextAscii(
+ title = _("Number of Powersupply"),
+ ),
+ "dict"
+)
+
hivemanger_states = [
( "Critical" , "Critical" ),
( "Maybe" , "Maybe" ),