Skip to content

Commit 20e0023

Browse files
committed
hp_proliant_da_cntlr: do not discover phantom controllers
The controller table (cpqDaCntlrTable) on HPE ProLiant Gen11 / iLO 6 contains a placeholder row -- typically index 0 -- whose condition, role, board status and board condition cells are all '0', a value the vendor MIB does not define. parse_hp_proliant_da_cntlr already parses such rows to None, but discovery iterated over all section keys and still created a service for the phantom row, which was then permanently UNKNOWN ('Controller not found in SNMP data'). Discovery now skips None entries.
1 parent ba70025 commit 20e0023

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

cmk/plugins/hp_proliant/agent_based/hp_proliant_da_cntlr.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,9 @@ def parse_hp_proliant_da_cntlr(string_table: StringTable) -> ParsedSection:
187187

188188

189189
def discovery_hp_proliant_da_cntlr(section: ParsedSection) -> DiscoveryResult:
190-
if section:
191-
yield from (Service(item=item) for item in section)
190+
# Skip phantom placeholder rows (all-zero cells, parsed to ``None``): they
191+
# are not real controllers and would produce a permanently UNKNOWN service.
192+
yield from (Service(item=item) for item, data in section.items() if data is not None)
192193

193194

194195
def check_hp_proliant_da_cntlr(item: ControllerID, section: ParsedSection) -> CheckResult:

tests/unit/cmk/plugins/hp_proliant/agent_based/test_hp_proliant_da_cntlr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121

2222

2323
def test_discovery() -> None:
24+
# The all-zero placeholder row ("9") is a phantom controller and must not be
25+
# discovered, otherwise its service is permanently UNKNOWN.
2426
assert list(
2527
discovery_hp_proliant_da_cntlr(section=parse_hp_proliant_da_cntlr(STRING_TABLE))
2628
) == [
2729
Service(item="0"),
2830
Service(item="3"),
2931
Service(item="6"),
30-
Service(item="9"),
3132
]
3233

3334

0 commit comments

Comments
 (0)