Module: check_mk
Branch: master
Commit: b5f16ff6be7987dbbf7e71795fb1903e698c3e5f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b5f16ff6be7987…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Aug 14 16:22:29 2013 +0200
apc symmetra checks extended with calibration and an extra check for diagnostic test
---
checks/apc_symmetra | 23 +++++++++++++++--------
checks/ups_test | 2 +-
web/plugins/wato/check_parameters.py | 32 +++++++++++++++++++++++++++-----
3 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/checks/apc_symmetra b/checks/apc_symmetra
index a4b0a1c..7c2ee3e 100644
--- a/checks/apc_symmetra
+++ b/checks/apc_symmetra
@@ -32,27 +32,34 @@
# PowerNet-MIB::upsAdvBatteryCurrent.0 .1.3.6.1.4.1.318.1.1.1.2.2.9.0
# PowerNet-MIB::upsAdvOutputVoltage.0 .1.3.6.1.4.1.318.1.1.1.4.2.1.0
# PowerNet-MIB::upsAdvOutputCurrent.0 .1.3.6.1.4.1.318.1.1.1.4.2.4.0
+# PowerNet-MIB::upsAdvBatteryRunTimeRemaining.0 .1.3.6.1.4.1.318.1.1.1.2.2.3.0
+# PowerNet-MIB::upsAdvTestCalibrationResults .1.3.6.1.4.1.318.1.1.1.7.2.6
# upsBasicBatteryStatus: unknown(1), batteryNormal(2), batteryLow(3)
# upsBasicOutputStatus: unknown(1), onLine(2), onBattery(3), onSmartBoost(4),
# timedSleeping(5), softwareBypass(6), off(7), rebooting(8), switchedBypass(9),
# hardwareFailureBypass(10), sleepingUntilPowerReturn(11), onSmartTrim(12)
+# upsAdvTestCalibrationResults: ok(1), invalidTest(2), calibrationInProgress(3)
-apc_default_levels = ( 95, 40, 1, 220 )
+# levels refer to the apc_symentra group which has 6 values,
+# only the first four are needed in this test
+# the others belong to the apc_symmetra_test check
+apc_default_levels = ( 95, 40, 1, 220, 0, 0 )
def check_apc(item, params, info):
BasicBatteryStatus, BasicOutputStatus, AdvBatteryCapacity, \
AdvBatteryTemperature, AdvBatteryCurrent, AdvOutputVoltage, \
- AdvOutputCurrent = [ saveint(x) for x in info[0][:7] ]
- RunTimeRemaining = int(info[0][7]) / 100
+ AdvOutputCurrent, AdvBatteryRunTimeRemaining, AdvTestCalibrationResults \
+ = [ saveint(x) for x in info[0][:9] ]
+ RunTimeRemaining = AdvBatteryRunTimeRemaining / 100
- crit_capacity, crit_batt_temp, crit_batt_curr, crit_voltage = params
+ crit_capacity, crit_batt_temp, crit_batt_curr, crit_voltage = params[0:4]
single_states = []
# 1. Check battery status
status_text = { 1:"unknown", 2:"normal", 3:"low" }
- infotxt = "Battery status %s" % (status_text.get(BasicBatteryStatus))
+ infotxt = "Battery status: %s" % (status_text.get(BasicBatteryStatus))
if BasicBatteryStatus != 2:
state = 2
infotxt += "(!!)"
@@ -65,8 +72,8 @@ def check_apc(item, params, info):
6:"software bypass", 7:"off",
8:"rebooting", 9:"switched bypass",
10:"hardware failure bypass", 11:"sleeping until power
return",
12:"on smart trim" }
- infotxt = "output status %s" % (status_text.get(BasicOutputStatus))
- if BasicOutputStatus not in [2, 4, 12]:
+ infotxt = "output status: %s" % (status_text.get(BasicOutputStatus))
+ if BasicOutputStatus not in [2, 4, 12] and AdvTestCalibrationResults != 3:
state = 2
infotxt += "(!!)"
else:
@@ -138,5 +145,5 @@ check_info['apc_symmetra'] = {
"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"),
"snmp_info" : (".1.3.6.1.4.1.318.1.1.1",
[ "2.1.1.0", "4.1.1.0",
"2.2.1.0", "2.2.2.0",
- "2.2.9.0", "4.2.1.0",
"4.2.4.0", "2.2.3.0" ] )
+ "2.2.9.0", "4.2.1.0",
"4.2.4.0", "2.2.3.0", "7.2.6.0" ] )
}
diff --git a/checks/ups_test b/checks/ups_test
index d5d0497..677aef8 100644
--- a/checks/ups_test
+++ b/checks/ups_test
@@ -118,7 +118,7 @@ def check_ups_test(item, params, info):
elif warn and ElapsedTime >= warn:
state = max(state, 1)
time_label = "(!)"
-
+
ResultsDetail = "%s%s Time elapsed since test: %s%s" % (line[-1],
state_label, etime, time_label)
perf = [ ( "ElapsedTime", ElapsedTime, warn, crit) ]
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 212c77b..fe107ca 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2880,24 +2880,46 @@ register_check_parameters(
register_check_parameters(
subgroup_os,
"apc_symentra",
- _("APC Symentra Checks"),
+ _("APC Symmetra Checks"),
Tuple(
elements = [
Integer(
- title = _("Max. Crit Capacity"),
+ title = _("Critical Battery Capacity"),
help = _("The battery capacity in percent at and below which a
critical state is be triggered"),
+ unit = _("%"),
+ default_value = 95,
),
Integer(
- title = _("Max. Battery Temperature"),
+ title = _("Critical Battery Temperature"),
help = _("The critical temperature of the battery"),
+ unit = _("C"),
+ default_value = 40,
),
Integer(
- title = _("Max. Current Power"),
+ title = _("Critical Battery Current"),
help = _("The critical battery current in Ampere"),
+ unit = _("A"),
+ default_value = 1,
),
Integer(
- title = _("Min. Voltage"),
+ title = _("Critical Battery Voltage"),
help = _("The output voltage at and below which a critical state is
triggered."),
+ unit = _("V"),
+ default_value = 220,
+ ),
+ Integer(
+ title = _("Warning Level for time since last diagnostic
test"),
+ help = _("Warning Level for time since last diagnostic test of the
device. "
+ "For a value of 0 the warning level will not be
used"),
+ unit = _("days"),
+ default_value = 0,
+ ),
+ Integer(
+ title = _("Critical Level for time since last diagnostic
test"),
+ help = _("Critical Level for time since last diagnostic test of the
device. "
+ "For a value of 0 the critical level will not be
used"),
+ unit = _("days"),
+ default_value = 0,
),
]
),