Skip to content

Commit

Permalink
Revert "17036 FIX heartbeat_crm: Handle cases when pacemaker service …
Browse files Browse the repository at this point in the history
…is not running"

This reverts commit e4751a4.

Reason for revert: It causes a new service to appear on non-clustered setups

Change-Id: I56e1522224dd153eedf495343c546894eb8aa7de
  • Loading branch information
racicLuka authored and TimotheusBachinger committed Oct 9, 2024
1 parent 48fae37 commit ef9f4eb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 75 deletions.
17 changes: 0 additions & 17 deletions .werks/17036.md

This file was deleted.

12 changes: 3 additions & 9 deletions agents/check_mk_agent.linux
Original file line number Diff line number Diff line change
Expand Up @@ -1040,15 +1040,9 @@ section_drbd() {
}

section_heartbeat() {
if command -v crm_mon >/dev/null 2>&1 || [ -S /var/run/heartbeat/crm/cib_ro ] || [ -S /var/run/crm/cib_ro ] || pgrep "^(crmd|pacemaker-contr)$" >/dev/null 2>&1; then
crm_output=$(TZ=UTC crm_mon -1 -r | grep -v ^$ | sed 's/^ //; /^\sResource Group:/,$ s/^\s//; s/^\s/_/g')
if [ -n "$crm_output" ]; then
echo '<<<heartbeat_crm>>>'
echo "$crm_output"
else
echo '<<<heartbeat_crm>>>'
crm_mon -1 -r 2>&1
fi
if [ -S /var/run/heartbeat/crm/cib_ro ] || [ -S /var/run/crm/cib_ro ] || pgrep "^(crmd|pacemaker-contr)$" >/dev/null 2>&1; then
echo '<<<heartbeat_crm>>>'
TZ=UTC crm_mon -1 -r | grep -v ^$ | sed 's/^ //; /^\sResource Group:/,$ s/^\s//; s/^\s/_/g'
fi

if inpath cl_status; then
Expand Down
49 changes: 0 additions & 49 deletions tests/unit/cmk/base/plugins/agent_based/test_heartbeat_crm.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,26 +217,6 @@ def _get_section_3() -> Section:
return section


@pytest.fixture(name="section_no_cluster", scope="module")
def _get_section_no_cluster() -> Section:
section = parse_heartbeat_crm([["Error: cluster is not available on this node"]])
assert section
return section


@pytest.fixture(name="section_connection_refused", scope="module")
def _get_section_connection_refused() -> Section:
section = parse_heartbeat_crm(
[
[
"error: Could not connect to launcher: Connection refused crm_mon: Connection to cluster failed: Connection refused"
]
]
)
assert section
return section


def test_discover_heartbeat_crm(section_1: Section) -> None:
assert list(discover_heartbeat_crm({"naildown_dc": False}, section_1)) == [
Service(parameters={"num_nodes": 2, "num_resources": 3}),
Expand Down Expand Up @@ -308,35 +288,6 @@ def test_check_heartbeat_crm_crit(section_2: Section) -> None:
]


def test_check_heartbeat_crm_no_cluster_crit(section_no_cluster: Section) -> None:
assert list(
_check_heartbeat_crm(
{"dc": "hasi", "max_age": 60, "num_nodes": 1, "num_resources": 4},
section_no_cluster,
1559939704.5458105,
)
) == [
Result(state=State.CRIT, summary="Error: cluster is not available on this node"),
]


def test_check_heartbeat_crm_failed_connection_crit(
section_connection_refused: Section,
) -> None:
assert list(
_check_heartbeat_crm(
{"dc": "hasi", "max_age": 60, "num_nodes": 1, "num_resources": 4},
section_connection_refused,
1559939704.5458105,
)
) == [
Result(
state=State.CRIT,
summary="error: Could not connect to launcher: Connection refused crm_mon: Connection to cluster failed: Connection refused",
),
]


def test_check_heartbeat_crm_resources_promotable_clone(section_3: Section) -> None:
assert list(
check_heartbeat_crm_resources(
Expand Down

0 comments on commit ef9f4eb

Please sign in to comment.