p1_current.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env python3
  2. from cmk.rulesets.v1 import Help, Title
  3. from cmk.rulesets.v1.form_specs import (
  4. DefaultValue,
  5. DictElement,
  6. Dictionary,
  7. Float,
  8. LevelDirection,
  9. SimpleLevels,
  10. )
  11. from cmk.rulesets.v1.rule_specs import (
  12. CheckParameters,
  13. HostAndItemCondition,
  14. Topic,
  15. )
  16. def _parameter_form():
  17. return Dictionary(
  18. title=Title("P1 current thresholds"),
  19. help_text=Help(
  20. "Upper current thresholds for the P1 meter."
  21. ),
  22. elements={
  23. "levels": DictElement(
  24. required=True,
  25. parameter_form=SimpleLevels(
  26. title=Title("Current thresholds"),
  27. form_spec_template=Float(
  28. unit_symbol="A",
  29. ),
  30. level_direction=LevelDirection.UPPER,
  31. prefill_fixed_levels=DefaultValue(
  32. value=(8.0, 10.0),
  33. ),
  34. ),
  35. ),
  36. },
  37. )
  38. rule_spec_p1_current = CheckParameters(
  39. name="p1_current",
  40. title=Title("P1 current"),
  41. topic=Topic.POWER,
  42. parameter_form=_parameter_form,
  43. condition=HostAndItemCondition(
  44. item_title=Title("Current channel"),
  45. ),
  46. )