Skip to content

Commit 11dd825

Browse files
18342 FIX apc_symmetra: Always show battery replace state
If no batteries required replacement, the check plugin did not add the string "No battery needs replacing" to the results. Contrary to the description in the man page. This is now fixed. SUP-24584 Change-Id: I6061a3b870a62a4acee0c1d87cb9a92955fc5eb2
1 parent 6d12ec3 commit 11dd825

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

.werks/18342.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[//]: # (werk v2)
2+
# apc_symmetra: Always show battery replace state
3+
4+
key | value
5+
---------- | ---
6+
date | 2025-07-22T14:54:26+00:00
7+
version | 2.4.0p9
8+
class | fix
9+
edition | cre
10+
component | checks
11+
level | 1
12+
compatible | yes
13+
14+
If no batteries required replacement, the check plugin did not add the string "No battery needs replacing" to the results.
15+
Contrary to the description in the man page.
16+
17+
This is now fixed.

cmk/base/legacy_checks/apc_symmetra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def check_apc_symmetra(_no_item, params, parsed): # pylint: disable=too-many-br
177177
}.get(battery_replace, (3, "Battery needs replacing: unknown"))
178178
if battery_num_batt_packs and int(battery_num_batt_packs) > 1:
179179
yield 2, "%i batteries need replacing" % int(battery_num_batt_packs)
180-
elif state:
180+
else:
181181
yield state, state_readable
182182

183183
if output_status:
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env python3
2+
# Copyright (C) 2015 Checkmk GmbH - License: GNU General Public License v2
3+
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
4+
# conditions defined in the file COPYING, which is part of this source code package.
5+
6+
# fmt: off
7+
# mypy: disable-error-code=var-annotated
8+
9+
checkname = "apc_symmetra"
10+
11+
info = [
12+
[],
13+
[
14+
[
15+
"1",
16+
"2",
17+
"2",
18+
"100",
19+
"1",
20+
"0",
21+
"366000",
22+
"2",
23+
"06/20/2012",
24+
"18",
25+
"0",
26+
"0001010000000000001000000000000000000000000000000000000000000000",
27+
]
28+
],
29+
]
30+
31+
discovery = {"": [(None, {})], "elphase": [("Battery", {})], "temp": [("Battery", {})]}
32+
33+
checks = {
34+
"": [
35+
(
36+
None,
37+
{"capacity": (95, 80), "calibration_state": 0, "battery_replace_state": 0},
38+
[
39+
(0, "Battery status: normal", []),
40+
(0, "No battery needs replacing", []),
41+
(0, "Output status: on line (calibration invalid)", []),
42+
(0, "Capacity: 100%", [("capacity", 100, 95, 80, 0, 100)]),
43+
(0, "Time remaining: 1 hour 1 minute", [("runtime", 61.0, None, None, None, None)]),
44+
],
45+
),
46+
],
47+
"elphase": [
48+
(
49+
"Battery",
50+
{"current": (1, 1)},
51+
[(0, "Current: 0.0 A", [("current", 0.0, 1, 1, None, None)])],
52+
)
53+
],
54+
"temp": [
55+
("Battery", {"levels": (50, 60)}, [(0, "18.0 \xb0C", [("temp", 18.0, 50, 60, None, None)])])
56+
],
57+
}

0 commit comments

Comments
 (0)