Skip to content

[PVE] Monitor node status when using QDevice. #813

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
24 changes: 24 additions & 0 deletions cmk/base/legacy_checks/pvecm_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
# 3 1 hp3
# 4 1 hp4

# Version >2 with QDevcie
# <<<pvecm_nodes>>>
#
# Membership information
# ~~~~~~~~~~~~~~~~~~~~~~
# Nodeid Votes Qdevice Name
# 1 1 A,V,NMW hp1 (local)
# 2 1 A,V,NMW hp2
# 0 1 QDevice
#


# mypy: disable-error-code="var-annotated"

Expand All @@ -68,6 +79,11 @@ def parse_pvecm_nodes(string_table):
parse_func = _parse_version_gt_2
continue

if line == ["Nodeid", "Votes", "Qdevice", "Name"]:
header = ["node_id", "votes", "qdevice" "name"]
parse_func = _parse_version_gt_2_with_qdevice
continue

if header is None:
continue

Expand All @@ -88,6 +104,14 @@ def _parse_version_gt_2(line, header):
return " ".join(line[2:]), dict(zip(header[:2], line[:2]))


def _parse_version_gt_2_with_qdevice(line, header):
if len(line) > 3:
name = " ".join(line[3:])
else:
name = line[2] # QDevice
return name, dict(zip(header[:3], line[:3]))


def inventory_pvecm_nodes(parsed):
for name in parsed:
yield name, None
Expand Down