|
|
@@ -0,0 +1,49 @@
|
|
|
+#!/usr/bin/env python3
|
|
|
+
|
|
|
+from cmk.rulesets.v1 import Help, Title
|
|
|
+from cmk.rulesets.v1.form_specs import (
|
|
|
+ DefaultValue,
|
|
|
+ DictElement,
|
|
|
+ Dictionary,
|
|
|
+ Float,
|
|
|
+ LevelDirection,
|
|
|
+ SimpleLevels,
|
|
|
+)
|
|
|
+from cmk.rulesets.v1.rule_specs import (
|
|
|
+ CheckParameters,
|
|
|
+ HostAndItemCondition,
|
|
|
+ Topic,
|
|
|
+)
|
|
|
+
|
|
|
+def _parameter_form():
|
|
|
+ return Dictionary(
|
|
|
+ title=Title("P1 power thresholds"),
|
|
|
+ help_text=Help(
|
|
|
+ "Upper power thresholds for the P1 meter."
|
|
|
+ ),
|
|
|
+ elements={
|
|
|
+ "levels": DictElement(
|
|
|
+ required=True,
|
|
|
+ parameter_form=SimpleLevels(
|
|
|
+ title=Title("Power thresholds"),
|
|
|
+ form_spec_template=Float(
|
|
|
+ unit_symbol="W",
|
|
|
+ ),
|
|
|
+ level_direction=LevelDirection.UPPER,
|
|
|
+ prefill_fixed_levels=DefaultValue(
|
|
|
+ value=(2100.0, 2200.0),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+rule_spec_p1_power = CheckParameters(
|
|
|
+ name="p1_power",
|
|
|
+ title=Title("P1 power"),
|
|
|
+ topic=Topic.POWER,
|
|
|
+ parameter_form=_parameter_form,
|
|
|
+ condition=HostAndItemCondition(
|
|
|
+ item_title=Title("Power channel"),
|
|
|
+ ),
|
|
|
+)
|