Skip to content

Commit

Permalink
redfish: drop 'check_mk' section
Browse files Browse the repository at this point in the history
This removes the 'check_mk' section from the
agent in compliance to Werk #13705.

Change-Id: Ib3b72f27067c0c265b12803235aa6295f60786d5
  • Loading branch information
mo-ki committed Dec 17, 2024
1 parent bf6ea18 commit e86ce0b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 8 additions & 7 deletions cmk/plugins/redfish/special_agents/agent_redfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,14 @@ def get_information(redfishobj: RedfishData) -> Literal[0]: # pylint: disable=t
if not vendor_data.firmware_version:
vendor_data.firmware_version = element.get("FirmwareVersion", "")

with SectionWriter("check_mk", " ") as w:
w.append("Version: 2.3.0")
w.append("AgentOS: redfish")
w.append("OSType: redfish")
w.append(f"OSName: {vendor_data.version}")
w.append(f"OSVersion: {vendor_data.firmware_version}")
w.append(f"OSPlatform: {vendor_data.name}")
labels = {
"cmk/os_family": "redfish",
"cmk/os_name": vendor_data.version,
"cmk/os_platform": vendor_data.name,
"cmk/os_type": "redfish",
"cmk/os_version": vendor_data.firmware_version,
}
sys.stdout.write("<<<labels:sep(0)>>>\n" f"{json.dumps(labels)}\n")

# fetch systems
systems_col = fetch_data(redfishobj.redfish_connection, systems_url, "System")
Expand Down
12 changes: 9 additions & 3 deletions cmk/plugins/redfish/special_agents/agent_redfish_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# conditions defined in the file COPYING, which is part of this source code package.
"""Special Agent to fetch Redfish data from management interfaces"""

import json
import logging
import sys
from collections.abc import Iterable, Mapping, Sequence
Expand Down Expand Up @@ -275,9 +276,14 @@ def get_information(redfishobj):
for element in manager_data:
fw_version = fw_version or element.get("FirmwareVersion")

with SectionWriter("check_mk", " ") as w:
w.append("Version: 2.0") # TODO: is this still relevant?
w.append(f"AgentOS: {vendor_data.version} - {vendor_data.firmware_version}")
labels: Mapping[str, str] = {
"cmk/os_family": "redfish",
**({"cmk/os_name": v} if (v := vendor_data.version) else {}),
"cmk/os_platform": vendor_data.name,
"cmk/os_type": "redfish",
**({"cmk/os_version": fw_version} if fw_version else {}),
}
sys.stdout.write("<<<labels:sep(0)>>>\n" f"{json.dumps(labels)}\n")

# fetch systems
systems_data = list([fetch_data(redfishobj, systems_url, "PowerEquipment")])
Expand Down

0 comments on commit e86ce0b

Please sign in to comment.