Skip to content

Commit

Permalink
17516 FIX Stormshield: Cluster Member: add missing ruleset
Browse files Browse the repository at this point in the history
SUP-21754

Change-Id: I774c2057063c6c88b1d3f14d57652f55aec30daa
  • Loading branch information
mo-ki committed Jan 8, 2025
1 parent b32f019 commit 282725d
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 9 deletions.
14 changes: 14 additions & 0 deletions .werks/17516.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[//]: # (werk v2)
# Stormshield: Cluster Member: add missing ruleset

key | value
---------- | ---
date | 2025-01-07T15:44:30+00:00
version | 2.3.0p25
class | fix
edition | cre
component | checks
level | 1
compatible | yes

The plugin _"Stormshield: Cluster Member"_ referred to a ruleset that did not exist.
17 changes: 9 additions & 8 deletions cmk/base/legacy_checks/stormshield_cluster_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
from cmk.agent_based.v2 import (
all_of,
any_of,
check_levels,
equals,
exists,
render,
SNMPTree,
startswith,
StringTable,
Expand Down Expand Up @@ -56,7 +58,6 @@ def check_stormshield_cluster_node(item, params, info):
_uptime,
) in info:
if item == index:
warn, crit = params["quality"]
if online == "0":
yield 2, "Member is %s" % online_mapping[online]
else:
Expand All @@ -77,12 +78,12 @@ def check_stormshield_cluster_node(item, params, info):
forced_mapping[statusforced],
),
)
if int(quality) < crit:
yield 2, "Quality: %s" % quality
elif int(quality) < warn:
yield 1, "Quality: %s" % quality
else:
yield 0, "Quality: %s" % quality
yield from check_levels(
float(quality),
levels_lower=params["quality"],
label="Quality",
render_func=render.percent,
)

infotext = "Model: {}, Version: {}, Role: {}, Priority: {}, Serial: {}".format(
model,
Expand Down Expand Up @@ -116,6 +117,6 @@ def parse_stormshield_cluster_node(string_table: StringTable) -> StringTable:
check_function=check_stormshield_cluster_node,
check_ruleset_name="stormshield_quality",
check_default_parameters={
"quality": (80, 50),
"quality": ("fixed", (80.0, 50.0)),
},
)
40 changes: 40 additions & 0 deletions cmk/plugins/stormshield/rulesets/stormshield_quality.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
# Copyright (C) 2025 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

from cmk.rulesets.v1 import Title
from cmk.rulesets.v1.form_specs import (
DefaultValue,
DictElement,
Dictionary,
LevelDirection,
Percentage,
SimpleLevels,
)
from cmk.rulesets.v1.rule_specs import CheckParameters, HostAndItemCondition, Topic


def _parameter_form_quality() -> Dictionary:
return Dictionary(
elements={
"quality": DictElement(
required=True,
parameter_form=SimpleLevels(
title=Title("Lower levels on quality"),
level_direction=LevelDirection.LOWER,
form_spec_template=Percentage(),
prefill_fixed_levels=DefaultValue(value=(80.0, 50.0)),
),
)
},
)


rule_spec_stormshield_quality = CheckParameters(
name="stormshield_quality",
topic=Topic.APPLICATIONS,
parameter_form=_parameter_form_quality,
title=Title("Stormshield quality"),
condition=HostAndItemCondition(item_title=Title("Node index")),
)
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ class ErrorReporter:
("check", "nvidia_errors", "hw_errors"),
("check", "qlogic_fcport", "qlogic_fcport"),
("check", "sap_hana_proc", "sap_hana_proc"),
("check", "stormshield_cluster_node", "stormshield_quality"),
("check", "stormshield_policy", "stormshield"),
("check", "stormshield_updates", "stormshield_updates"),
("check", "tsm_stagingpools", "tsm_stagingspools"),
Expand Down

0 comments on commit 282725d

Please sign in to comment.