p1.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 voltage thresholds"),
  19. help_text=Help(
  20. "Upper voltage thresholds. "
  21. "The first value is WARNING and the second is CRITICAL."
  22. ),
  23. elements={
  24. "levels": DictElement(
  25. required=True,
  26. parameter_form=SimpleLevels(
  27. title=Title("Voltage thresholds"),
  28. form_spec_template=Float(
  29. unit_symbol="V",
  30. ),
  31. level_direction=LevelDirection.UPPER,
  32. prefill_fixed_levels=DefaultValue(
  33. value=(252.0, 253.0)
  34. ),
  35. ),
  36. ),
  37. },
  38. )
  39. rule_spec_p1_voltage = CheckParameters(
  40. name="p1_voltage",
  41. title=Title("P1 voltage"),
  42. topic=Topic.POWER,
  43. parameter_form=_parameter_form,
  44. condition=HostAndItemCondition(
  45. item_title=Title("Phase"),
  46. ),
  47. )