2024-01-12 12:23:21 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2023-03-11 14:29:54 +01:00
|
|
|
from cmk.gui.i18n import _
|
2024-01-12 12:23:21 +01:00
|
|
|
from cmk.gui.plugins.wato.special_agents.common import RulespecGroupDatasourceProgramsApps
|
|
|
|
from cmk.gui.plugins.wato.utils import (
|
|
|
|
HostRulespec,
|
|
|
|
Rulespec,
|
|
|
|
IndividualOrStoredPassword,
|
2023-03-11 14:29:54 +01:00
|
|
|
rulespec_registry,
|
|
|
|
)
|
|
|
|
from cmk.gui.valuespec import (
|
|
|
|
Dictionary,
|
|
|
|
ListChoice,
|
|
|
|
Checkbox,
|
|
|
|
TextAscii,
|
|
|
|
Password,
|
|
|
|
)
|
|
|
|
|
2024-01-12 12:23:21 +01:00
|
|
|
def _factory_default_special_agent_nextcloud():
|
|
|
|
return Rulespec.FACTORY_DEFAULT_UNUSED
|
2023-03-11 14:29:54 +01:00
|
|
|
|
|
|
|
def _valuespec_special_agent_nextcloud():
|
|
|
|
return Dictionary(
|
|
|
|
title=_("Nextcloud Server Information"),
|
|
|
|
help = _("Checking Nextcloud servers via API"),
|
|
|
|
elements=[
|
|
|
|
("hostname", TextAscii(title=_("Hostname"),
|
|
|
|
allow_empty=False,
|
2024-01-12 14:12:05 +01:00
|
|
|
size = 40,
|
|
|
|
help=_("Hostname of Nextcloud server (bare FQDN or IP), mandatory, eg. nextcloud.yourdomain.tld"))),
|
2023-03-11 14:29:54 +01:00
|
|
|
("username", TextAscii(title=_("Username"),
|
2024-01-12 14:12:05 +01:00
|
|
|
size = 40,
|
2023-03-11 14:29:54 +01:00
|
|
|
allow_empty=False,
|
|
|
|
help=_("Username with administrative rights, mandatory"))),
|
2024-01-12 14:12:05 +01:00
|
|
|
("password", IndividualOrStoredPassword(title=_("App Password"),
|
|
|
|
size = 40,
|
|
|
|
allow_empty=False,
|
|
|
|
help=_("Specify app password, mandatory, use Personal Settings|Security|Devices and Sessions within the NC UI to create one for the given user"))),
|
2023-03-11 14:29:54 +01:00
|
|
|
("port", TextAscii(title=_("Port"),
|
|
|
|
allow_empty=True,
|
2024-01-12 14:12:05 +01:00
|
|
|
help=_("Specify port if not listening to HTTP(S), optional"))),
|
2023-03-11 14:29:54 +01:00
|
|
|
("folder", TextAscii(title=_("Folder"),
|
|
|
|
allow_empty=True,
|
|
|
|
help=_("Specify subfolder if your Nextcloud instance is not installed in the web root, no trailing/leading slashes, optional"))),
|
|
|
|
("no_https", Checkbox(title=_("Disable HTTPS"),
|
|
|
|
help=_("Activate to disable encryption (not recommended), optional"))),
|
|
|
|
("no_cert_check", Checkbox(title=_("Disable certificate validation"),
|
|
|
|
help=_("Activate to disable certificate validation (not recommended), optional"))),
|
|
|
|
],
|
|
|
|
optional_keys=[],
|
|
|
|
)
|
|
|
|
|
|
|
|
rulespec_registry.register(
|
|
|
|
HostRulespec(
|
2024-01-12 12:23:21 +01:00
|
|
|
factory_default = _factory_default_special_agent_nextcloud(),
|
|
|
|
group = RulespecGroupDatasourceProgramsApps,
|
|
|
|
name = "special_agents:nextcloud",
|
|
|
|
valuespec = _valuespec_special_agent_nextcloud,
|
2023-03-11 14:29:54 +01:00
|
|
|
)
|
|
|
|
)
|