initial upload of version 2.1.0 which uses the new plugin API
This commit is contained in:
93
mailcow/rulesets/rs_mailcow_domains.py
Normal file
93
mailcow/rulesets/rs_mailcow_domains.py
Normal file
@@ -0,0 +1,93 @@
|
||||
#!/user/bin/env python3
|
||||
"""parameter form ruleset for mailcow domains"""
|
||||
|
||||
from cmk.rulesets.v1 import Title
|
||||
from cmk.rulesets.v1.form_specs import (
|
||||
DefaultValue,
|
||||
DictElement,
|
||||
Dictionary,
|
||||
LevelDirection,
|
||||
SimpleLevels,
|
||||
Percentage,
|
||||
Integer,
|
||||
)
|
||||
from cmk.rulesets.v1.rule_specs import CheckParameters, HostAndItemCondition, Topic
|
||||
|
||||
|
||||
# function name should begin with an underscore to limit it's visibility
|
||||
def _parameter_form():
|
||||
return Dictionary(
|
||||
elements={
|
||||
"levels_mailcow_domains_quota_used": DictElement(
|
||||
parameter_form=SimpleLevels(
|
||||
title=Title("Mailcow domains quota usage for storage"),
|
||||
form_spec_template=Percentage(),
|
||||
level_direction=LevelDirection.UPPER,
|
||||
prefill_fixed_levels=DefaultValue(value=(65.0, 85.0)),
|
||||
),
|
||||
required=True,
|
||||
),
|
||||
"levels_mailcow_domains_mailboxes_used": DictElement(
|
||||
parameter_form=SimpleLevels(
|
||||
title=Title("Mailcow domains mailboxes usage"),
|
||||
form_spec_template=Percentage(),
|
||||
level_direction=LevelDirection.UPPER,
|
||||
prefill_fixed_levels=DefaultValue(value=(65.0, 85.0)),
|
||||
),
|
||||
required=True,
|
||||
),
|
||||
"levels_mailcow_domains_aliases_used": DictElement(
|
||||
parameter_form=SimpleLevels(
|
||||
title=Title("Mailcow domains aliases usage"),
|
||||
form_spec_template=Percentage(),
|
||||
level_direction=LevelDirection.UPPER,
|
||||
prefill_fixed_levels=DefaultValue(value=(65.0, 85.0)),
|
||||
),
|
||||
required=True,
|
||||
),
|
||||
"levels_mailcow_domains_num_messages": DictElement(
|
||||
parameter_form=SimpleLevels(
|
||||
title=Title("Number of messages"),
|
||||
form_spec_template=Integer(),
|
||||
level_direction=LevelDirection.UPPER,
|
||||
prefill_fixed_levels=DefaultValue(value=(10_000, 25_000)),
|
||||
),
|
||||
required=True,
|
||||
),
|
||||
"levels_mailcow_domains_num_aliases": DictElement(
|
||||
parameter_form=SimpleLevels(
|
||||
title=Title("Number of configured aliases"),
|
||||
form_spec_template=Integer(),
|
||||
level_direction=LevelDirection.UPPER,
|
||||
prefill_fixed_levels=DefaultValue(value=(100, 250)),
|
||||
),
|
||||
required=True,
|
||||
),
|
||||
"levels_mailcow_domains_num_mailboxes": DictElement(
|
||||
parameter_form=SimpleLevels(
|
||||
title=Title("Number of configured mailboxes"),
|
||||
form_spec_template=Integer(),
|
||||
level_direction=LevelDirection.UPPER,
|
||||
prefill_fixed_levels=DefaultValue(value=(100, 250)),
|
||||
),
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
# name must begin with "rule_spec_", should refer to the used check plugin
|
||||
# must be an instance of "CheckParameters"
|
||||
rule_spec_mailcow_domains = CheckParameters(
|
||||
# "name" should be the same as the check plugin
|
||||
name="mailcow_domains",
|
||||
# the title is shown in the GUI
|
||||
title=Title("Mailcow domain levels"),
|
||||
# this ruleset can be found under Setup|Service monitoring rules|Various
|
||||
topic=Topic.APPLICATIONS,
|
||||
# define the name of the function which creates the GUI elements
|
||||
parameter_form=_parameter_form,
|
||||
# define the label in the GUI where you can restrict the
|
||||
# settings to one or mor specific users (item)
|
||||
condition=HostAndItemCondition(item_title=Title("Domain")),
|
||||
)
|
||||
Reference in New Issue
Block a user