HAL9002-CheckMK/hal9002/rulesets/rs_hal9002_storages.py

48 lines
1.6 KiB
Python

#!/user/bin/env python3
"""parameter form ruleset for HAL9002 storages"""
from cmk.rulesets.v1 import Title
from cmk.rulesets.v1.form_specs import (
DefaultValue,
DictElement,
Dictionary,
Float,
LevelDirection,
SimpleLevels,
)
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_hal_storages_rates": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for storage up and download rate"),
form_spec_template=Float(unit_symbol="MBytes/s"),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(200.0, 300.0)),
),
required=True,
),
}
)
# name must begin with "rule_spec_", should refer to the used check plugin
# must be an instance of "CheckParameters"
rule_spec_hal9002_storages = CheckParameters(
# "name" should be the same as the check plugin
name="hal9002_storages",
# the title is shown in the GUI
title=Title("HAL9002 levels for storage upload/download"),
# this ruleset can be found under Setup|Service monitoring rules|Applications...
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 storages (item)
condition=HostAndItemCondition(item_title=Title("Storage ID")),
)