special_agent.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env python3
  2. from cmk.rulesets.v1 import Label, Help, Title
  3. from cmk.rulesets.v1.form_specs import (
  4. DictElement,
  5. Dictionary,
  6. migrate_to_password,
  7. Password,
  8. String,
  9. validators,
  10. )
  11. from cmk.rulesets.v1.rule_specs import SpecialAgent, Topic
  12. def _parameter_form() -> Dictionary:
  13. return Dictionary(
  14. help_text=Help(
  15. "This rule selects the Agent eDirectory Monitor instead of the normal Checkmk Agent "
  16. "which collects information through a LDAP call to cn=Monitor"
  17. ),
  18. elements={
  19. "ldap_uri": DictElement(
  20. required=True,
  21. parameter_form=String(
  22. title=Title("LDAP URL"),
  23. custom_validate=(validators.LengthInRange(min_value=1),),
  24. ),
  25. ),
  26. "user": DictElement(
  27. required=True.
  28. parameter_form=String(
  29. title=Title("DN of Username to use for Monitoring"),
  30. ),
  31. ),
  32. "password": DictElement(
  33. required=True,
  34. parameter_form=Password(
  35. title=Title("Password of the User"),
  36. custom_validate=(validators.LengthInRange(min_value=1),),
  37. migrate=migrate_to_password,
  38. ),
  39. ),
  40. },
  41. )
  42. rule_spec_special_agent_edirectory_monitor = SpecialAgent(
  43. name="edirectory_monitor",
  44. title=Title("eDirectory Monitoring via LDAP"),
  45. topic=Topic.APPLICATIONS,
  46. parameter_form=_parameter_form,
  47. )