/
check_plugin_advanced_myhostgroups_parameters.py
61 lines (53 loc) · 1.76 KB
/
check_plugin_advanced_myhostgroups_parameters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
# This file is explained in the Checkmk User Guide:
# https://docs.checkmk.com/2.2.0/en/devel_check_plugins.html#rule_set
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
Dictionary,
Percentage,
TextInput,
Tuple,
)
from cmk.gui.plugins.wato.utils import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersApplications,
)
def _item_valuespec_myhostgroups_advanced():
return TextInput(
title="Host group name",
help="You can restrict this rule to certain services of the specified hosts.",
)
def _parameter_valuespec_myhostgroups_advanced():
return Dictionary(
elements = [
("hosts_up_lower",
Tuple(
title = _("Lower percentage threshold for host in UP status"),
elements = [
Percentage(title=_("Warning")),
Percentage(title=_("Critical")),
],
)
),
("services_ok_lower",
Tuple(
title = _("Lower percentage threshold for services in OK status"),
elements = [
Percentage(title=_("Warning")),
Percentage(title=_("Critical")),
],
)
),
],
)
rulespec_registry.register(
CheckParameterRulespecWithItem(
check_group_name = "myhostgroups_advanced",
group = RulespecGroupCheckParametersApplications,
match_type = "dict",
item_spec = _item_valuespec_myhostgroups_advanced,
parameter_valuespec = _parameter_valuespec_myhostgroups_advanced,
title = lambda: _("Host group status"),
)
)