Module: check_mk
Branch: master
Commit: a04bee7734dbed6888cb6bf6d2a5d3d78af44ef9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a04bee7734dbed…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Wed Jun 4 10:30:28 2014 +0200
apc_symmetra: check now also monitors the battery replacement status
---
.werks/615 | 8 ++++++++
ChangeLog | 1 +
checkman/apc_symmetra | 31 +++++++++++++++++++------------
checks/apc_symmetra | 39 ++++++++++++++++++++++++++++-----------
4 files changed, 56 insertions(+), 23 deletions(-)
diff --git a/.werks/615 b/.werks/615
new file mode 100644
index 0000000..86cc707
--- /dev/null
+++ b/.werks/615
@@ -0,0 +1,8 @@
+Title: apc_symmetra: check now also monitors the battery replacement status
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1401870579
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 8e4e1b2..4fc1d94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -64,6 +64,7 @@
* 0926 windows agent: local / plugin scripts now get the REMOTE_HOST as environment
variable
* 0163 kaspersky_av_quarantine,kaspersky_av_tasks,kaspersky_av_updates: New checks
for kaspersky anti virus on linux
* 0164 symantec_av_progstate,symantec_av_quarantine, symantec_av_updates: New checks
for Symantec Anti Virus on Linux
+ * 0615 apc_symmetra: check now also monitors the battery replacement status
* 0777 FIX: special agent emcvnx: did not work with security file authentication...
* 0786 FIX: zfsget: fixed compatibility with older Solaris agents...
* 0809 FIX: brocade_fcport: Fixed recently introduced problem with port speed
detection
diff --git a/checkman/apc_symmetra b/checkman/apc_symmetra
index a04a997..a05c1d6 100644
--- a/checkman/apc_symmetra
+++ b/checkman/apc_symmetra
@@ -4,20 +4,27 @@ catalog: hw/power/apc
license: GPL
distribution: check_mk
description:
- This check monitors eight aspects of an APC Symmetra UPS: {(1)} the battery status,
- {(2)} the output status, {(3)} the battery capacity, {(4)} the battery
- temperature, {(5)} the battery current, {(6)} the output voltage and
- {(7)} the output current, {(8)} the remaing run time. The output current and
- remaining run time are not checked against a level but are just displayed, {(9)} the
current
- load in percent.
+
+ This check monitors ten aspects of an APC Symmetra UPS: {(1)} the
+ battery status, {(2)} the battery replacement status including the number
+ of batteries to be replaced, {(3)} the output status, {(4)} the battery
+ capacity, {(5)} the battery temperature, {(6)} the battery current, {(7)}
+ the output voltage, {(8)} the output current, {(9)} the remaing run time,
+ and {(10)} the current load in percent.
+
+ The output current and remaining run time are not checked against a level,
+ but just displayed. {(2)} is only displayed if a problem is found, the level
+ is {WARN} if one battery needs to be replaced and {CRIT} if more than one
+ battery needs to be replaced. {(1)} is not displayed if the state is normal
+ but a problem in {(2)} was found.
The check output includes the calibration status of the UPS. During a
- calibration the check result in section {(2)} is OK even though the UPS is running
- on battery.
- The check reads the date of the last calibration and optionally applies an alternative
- level for the battery capacity on the day of the calibration. This is because the
battery
- capacity is reduced after calibration and may cause an unwanted critical condition
- with the standard level. In addition a time span after the day of the calibration
+ calibration the check result in section {(2)} is OK even though the UPS is
+ running on battery. The check reads the date of the last calibration and
+ optionally applies an alternative level for the battery capacity on the
+ day of the calibration. This is because the battery capacity is reduced
+ after calibration and may cause an unwanted critical condition with the
+ standard level. In addition a time span after the day of the calibration
can be configured during which the post-calibration phase still persists.
examples:
diff --git a/checks/apc_symmetra b/checks/apc_symmetra
index f7a32d3..dda0fcd 100644
--- a/checks/apc_symmetra
+++ b/checks/apc_symmetra
@@ -29,6 +29,8 @@
# PowerNet-MIB::upsBasicOutputStatus.0 .1.3.6.1.4.1.318.1.1.1.4.1.1.0
# PowerNet-MIB::upsAdvBatteryCapacity.0 .1.3.6.1.4.1.318.1.1.1.2.2.1.0
# PowerNet-MIB::upsAdvBatteryTemperature.0 .1.3.6.1.4.1.318.1.1.1.2.2.2.0
+# PowerNet-MIB::upsAdvBatteryReplaceIndicator.0 .1.3.6.1.4.1.318.1.1.1.2.2.4.0
+# PowerNet-MIB::upsAdvBatteryNumOfBadBattPacks.0 .1.3.6.1.4.1.318.1.1.1.2.2.6.0
# 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
@@ -78,9 +80,10 @@ factory_settings["apc_default_levels"] = {
def check_apc(item, params, info):
BasicBatteryStatus, BasicOutputStatus, AdvBatteryCapacity, \
- AdvBatteryTemperature, AdvBatteryCurrent, AdvInputVoltage, AdvOutputVoltage, \
+ AdvBatteryTemperature, AdvBatteryReplaceIndicator, AdvBatteryNumOfBadBattPacks, \
+ AdvBatteryCurrent, AdvInputVoltage, AdvOutputVoltage, \
AdvOutputCurrent, AdvBatteryRunTimeRemaining, AdvTestCalibrationResults,
AdvOutputLoad \
- = [ saveint(x) for x in info[0][:11] ]
+ = [ saveint(x) for x in info[0][:13] ]
LastDiagnosticsDate = info[0][-1]
RunTimeRemaining = AdvBatteryRunTimeRemaining / 100
@@ -110,11 +113,23 @@ def check_apc(item, params, info):
if BasicBatteryStatus != 2:
state = 2
infotxt += "(!!)"
+ single_states.append( (state, infotxt, None) )
else:
state = 0
- single_states.append( (state, infotxt, None) )
- # 2. Check basic output status
+ # 2. Check battery replacement status
+ if AdvBatteryReplaceIndicator == 2:
+ if AdvBatteryNumOfBadBattPacks == 1:
+ infotxt = "one battery needs replacement(!)"
+ state = 1
+ else:
+ infotxt = "%i batteries need replacement(!!)" %
AdvBatteryNumOfBadBattPacks
+ state = 2
+ single_states.append( (state, infotxt, None) )
+ elif state == 0: # if normal only print when replacement status is also OK, to save
on service output text
+ single_states.append( (state, infotxt, None) )
+
+ # 3. Check basic output status
status_text = { 1:"unknown", 2:"online", 3:"on
battery", 4:"on smart boost", 5:"timed sleeping",
6:"software bypass", 7:"off",
8:"rebooting", 9:"switched bypass",
10:"hardware failure bypass", 11:"sleeping until power
return",
@@ -129,7 +144,7 @@ def check_apc(item, params, info):
state = 0
single_states.append( (state, infotxt, None) )
- # 3. Check battery capacity
+ # 4. Check battery capacity
state = 0
infotxt = "capacity %d%% (crit at " % AdvBatteryCapacity
@@ -146,7 +161,7 @@ def check_apc(item, params, info):
single_states.append( (state, infotxt, ("capacity", AdvBatteryCapacity,
"", crit_capacity, 0, 100)) )
- # 4. Check System temperature
+ # 5. Check System temperature
# The Name AdvBatteryTemperature is a wrong naming in the vendor mib.
infotxt = "sys. temp. %dC" % AdvBatteryTemperature
if AdvBatteryTemperature >= crit_sys_temp:
@@ -156,7 +171,7 @@ def check_apc(item, params, info):
state = 0
single_states.append( (state, infotxt, ("systemp", AdvBatteryTemperature,
"", crit_sys_temp) ) )
- # 5. Check battery current
+ # 6. Check battery current
infotxt = "bat. curr. %dA" % AdvBatteryCurrent
if AdvBatteryCurrent >= crit_batt_curr:
state = 2
@@ -168,7 +183,7 @@ def check_apc(item, params, info):
# 6a. Simply show input voltage (no performance data)
single_states.append( (0, "input voltage %dV" % AdvInputVoltage, None) )
- # 6. Check output voltage
+ # 7. Check output voltage
infotxt = "output voltage %dV" % AdvOutputVoltage
if AdvOutputVoltage <= crit_voltage:
state = 2
@@ -177,17 +192,17 @@ def check_apc(item, params, info):
state = 0
single_states.append( (state, infotxt, ("voltage", AdvOutputVoltage,
"", crit_voltage, 0) ) )
- # 7. Simply add output current as perfdata
+ # 8. Simply add output current as perfdata
single_states.append( (0, "output current %dA" % AdvOutputCurrent,
("current", AdvOutputCurrent)) )
- # 8. run time remaining
+ # 9. run time remaining
# RunTimeRemaining formatiert == "26:00.00"
hrs = int(RunTimeRemaining) / 3600
mins, secs = divmod(int(RunTimeRemaining) % 3600, 60)
single_states.append( (0, "run time remaining: %02d:%02d:%02d" % (hrs,
mins, secs),
("runtime", RunTimeRemaining/60)) )
- # 9. Adv Output load (load in percent)
+ # 10. Adv Output load (load in percent)
load_state = 0
loadwarn, loadcrit = None, None
label = ""
@@ -227,6 +242,8 @@ check_info['apc_symmetra'] = {
"4.1.1.0", # BasicOutputStatus,
"2.2.1.0", # AdvBatteryCapacity,
"2.2.2.0", # AdvBatteryTemperature,
+ "2.2.4.0", # AdvBatteryReplaceIndicator,
+ "2.2.6.0", # AdvBatteryNumOfBadBattPacks,
"2.2.9.0", # AdvBatteryCurrent,
"3.2.1.0", # AdvInputVoltage,
"4.2.1.0", # AdvOutputVoltage,