initial upload of version 2.1.0 which uses the new plugin API
This commit is contained in:
57
mailcow/rulesets/rs_mailcow_mailboxes.py
Normal file
57
mailcow/rulesets/rs_mailcow_mailboxes.py
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/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_mailboxes_quota_used": DictElement(
|
||||
parameter_form=SimpleLevels(
|
||||
title=Title("Mailcow mailbox 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_mailboxes_num_messages": DictElement(
|
||||
parameter_form=SimpleLevels(
|
||||
title=Title("Number of messages in mailbox"),
|
||||
form_spec_template=Integer(),
|
||||
level_direction=LevelDirection.UPPER,
|
||||
prefill_fixed_levels=DefaultValue(value=(1000, 2500)),
|
||||
),
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
# name must begin with "rule_spec_", should refer to the used check plugin
|
||||
# must be an instance of "CheckParameters"
|
||||
rule_spec_mailcow_mailboxes = CheckParameters(
|
||||
# "name" should be the same as the check plugin
|
||||
name="mailcow_mailboxes",
|
||||
# the title is shown in the GUI
|
||||
title=Title("Mailcow mailbox 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("Mailbox")),
|
||||
)
|
||||
Reference in New Issue
Block a user