Skip to content
Open
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
9 changes: 9 additions & 0 deletions cmk/plugins/checkmk/agent_based/check_mk.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# conditions defined in the file COPYING, which is part of this source code package.


import re

from cmk.agent_based.v2 import (
AgentSection,
Attributes,
Expand Down Expand Up @@ -84,6 +86,13 @@ def host_label_function_labels(section: CheckmkSection) -> HostLabelGenerator:
if (osversion := section.get("osversion")) is not None:
yield HostLabel("cmk/os_version", osversion)

if (agent_version := section.get("version")) is not None:
yield HostLabel("cmk/agent_version", agent_version)
agent_major = re.match(r"[0-9.]+", agent_version)
yield HostLabel(
"cmk/agent_version_major", agent_major.group(0) if agent_major else agent_version
)


agent_section_check_mk = AgentSection(
name="check_mk",
Expand Down
Loading