Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUP-19768: Add Cisco UCS fault check #756

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cmk/plugins/cisco_ucs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# _____ __ __ _____
# / ____| \ \ / / | __ \
# | (___ \ \ /\ / / | |__) |
# \___ \ \ \/ \/ / | _ /
# ____) | \ /\ / | | \ \
# |_____/ \/ \/ |_| \_\
#
# (c) 2024 SWR
# @author Frank Baier <[email protected]>
#
44 changes: 44 additions & 0 deletions cmk/plugins/cisco_ucs/agent_based/cisco_ucs_faults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# _____ __ __ _____
# / ____| \ \ / / | __ \
# | (___ \ \ /\ / / | |__) |
# \___ \ \ \/ \/ / | _ /
# ____) | \ /\ / | | \ \
# |_____/ \/ \/ |_| \_\
#
# (c) 2024 SWR
# @author Frank Baier <[email protected]>
#
#
from cmk.agent_based.v2 import (
CheckPlugin,
Service,
Result,
State,
)
from collections.abc import Mapping, Sequence
from cmk.plugins.lib.cisco_ucs import check_cisco_fault, Fault
from cmk.agent_based.v1.type_defs import CheckResult, DiscoveryResult


def discover_cisco_ucs_faults(section: Mapping[str, Sequence[Fault]] | None,) -> DiscoveryResult:
yield Service()


def check_cisco_ucs_faults(section: Mapping[str, Sequence[Fault]] | None,) -> CheckResult:
if not section:
yield Result(state=State.OK, notice="No faults")
return

for id, fault in section.items():
yield from check_cisco_fault(fault)


check_plugin_cisco_ucs_faults = CheckPlugin(
name="cisco_ucs_faults",
sections=["cisco_ucs_fault"],
service_name="Cisco UCS Faults",
discovery_function=discover_cisco_ucs_faults,
check_function=check_cisco_ucs_faults,
)