Procházet zdrojové kódy

initial commit of plugin edirectory_monitor server_side_calls special_agent.py

Michael Honkoop před 4 měsíci
rodič
revize
f8aef084c9

+ 28 - 0
plugins/edirectory_monitor/server_side_calls/special_agent.py

@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+from collections.abc import Iterable, Sequence
+
+from pydantic import BaseModel
+
+from cmk.server_side_calls.v1 import HostConfig, SpecialAgentCommand, SpecialAgentConfig
+from cmk.server_side_calls.v1._utils import Secret
+
+class _Params(BaseModel):
+    ldap_uri: str
+    user: str
+    password: Secret
+
+def _commands_function(params: Params, host_config: HostConfig) -> Iterable[SpecialAgentCommand]:
+    command_arguments: list[str | Secret] = [
+        params.ldap_uri,
+        params.user,
+        params.password.unsafe(),
+    ]
+
+    yield SpecialAgentCommand(command_arguments=command_arguments)
+
+special_agent_edirectory_monitor = SpecialAgentConfig(
+    name="edirectory_monitor",
+    parameter_parser=_Params.model_validate,
+    commands_function=_commands_function,
+)