#!/user/bin/env python3 """general parameter form for Traefik""" from cmk.rulesets.v1 import Title, Help from cmk.rulesets.v1.form_specs import ( DictElement, Dictionary, SimpleLevels, DefaultValue, Float, LevelDirection, ) from cmk.rulesets.v1.rule_specs import CheckParameters, Topic, HostCondition # function name should begin with an underscore to limit it's visibility def _parameter_form(): return Dictionary( elements={ "levels_traefik_agent_execution_time": DictElement( parameter_form=SimpleLevels( title=Title("Levels for agent execution time"), help_text=Help( "Define the levels for the maximum agent execution time" ), form_spec_template=Float(unit_symbol="ms"), level_direction=LevelDirection.UPPER, prefill_fixed_levels=DefaultValue(value=(500.0, 750.0)), ), required=True, ), } ) # name must begin with "rule_spec_", should refer to the used check plugin # must be an instance of "CheckParameters" rule_spec_traefik_info = CheckParameters( # "name" should be the same as the check plugin name="traefik_info", # the title is shown in the GUI title=Title("Traefik general parameters"), # 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, condition=HostCondition(), )