special_agent_edirectory_monitor.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/env python3
  2. # -*- encoding: utf-8; py-indent-offset: 4 -*-
  3. # (c) Michael Honkoop <mhonkoop@comsolve.nl>
  4. # License: GNU General Public License v2
  5. from cmk.rulesets.v1 import Help, Label, Title
  6. from cmk.rulesets.v1.form_specs import (
  7. DictElement,
  8. Dictionary,
  9. migrate_to_password,
  10. Password,
  11. String,
  12. validators,
  13. BooleanChoice,
  14. DefaultValue,
  15. )
  16. from cmk.rulesets.v1.rule_specs import SpecialAgent, Topic
  17. def _parameter_form() -> Dictionary:
  18. return Dictionary(
  19. help_text=Help(
  20. "This rule selects the Agent eDirectory Monitor instead of the normal Checkmk Agent "
  21. "which collects information through a LDAP call to cn=Monitor"
  22. ),
  23. elements={
  24. "user": DictElement(
  25. required=True,
  26. parameter_form=String(
  27. title=Title("DN of Username for Monitoring"),
  28. custom_validate=(validators.LengthInRange(min_value=1),),
  29. ),
  30. ),
  31. "password": DictElement(
  32. required=True,
  33. parameter_form=Password(
  34. title=Title("Password of the User"),
  35. custom_validate=(validators.LengthInRange(min_value=1),),
  36. migrate=migrate_to_password,
  37. ),
  38. ),
  39. "check_tls": DictElement[bool](
  40. parameter_form=BooleanChoice(
  41. title=Title("Certificate Validation"),
  42. help_text=Help(
  43. "Checking this option will Enable Certificate Validation."
  44. ),
  45. label=Label("Enable Certificate Validation"),
  46. ),
  47. required=False,
  48. ),
  49. "exclude_sections": DictElement(
  50. parameter_form=String(
  51. title=Title("Exclude (comma-separated) Monitor sections"),
  52. help_text=Help(
  53. "Exclude subsection(s) of cn=Monitor comma-separated per section (Agent,Dclient,DHOST,LDAP,RecordManager,IDM)."
  54. ),
  55. ),
  56. required=False,
  57. ),
  58. },
  59. )
  60. rule_spec_special_agent_edirectory_monitor = SpecialAgent(
  61. name="edirectory_monitor",
  62. title=Title("eDirectory Monitoring via LDAP"),
  63. topic=Topic.APPLICATIONS,
  64. parameter_form=_parameter_form,
  65. )