#!/user/bin/env python3 """general parameter form for HAL9002""" from cmk.rulesets.v1 import Help, Title from cmk.rulesets.v1.form_specs import ( DictElement, Dictionary, ServiceState, DefaultValue, ) from cmk.agent_based.v2 import ( State, ) 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={ "state_if_update_is_available": DictElement( required=True, parameter_form=ServiceState( title=Title("State if update is available"), help_text=Help( "State of service if an update is available, mandatory" ), prefill=DefaultValue(value=State.WARN), ), ), } ) # name must begin with "rule_spec_", should refer to the used check plugin # must be an instance of "CheckParameters" rule_spec_hal9002_status = CheckParameters( # "name" should be the same as the check plugin name="hal9002_status", # the title is shown in the GUI title=Title("HAL9002 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(), )