Nextcloud-CheckMK/local/share/check_mk/web/plugins/wato/nextcloud_params.py

60 lines
2.4 KiB
Python

#!/usr/bin/env python3
from cmk.gui.i18n import _
from cmk.gui.plugins.wato.special_agents.common import RulespecGroupDatasourceProgramsApps
from cmk.gui.plugins.wato.utils import (
HostRulespec,
Rulespec,
IndividualOrStoredPassword,
rulespec_registry,
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
Checkbox,
TextAscii,
Password,
)
def _factory_default_special_agent_nextcloud():
return Rulespec.FACTORY_DEFAULT_UNUSED
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,
help=_("Hostname of Nextcloud server (bare FQDN or IP, IP not tested), mandatory"))),
("username", TextAscii(title=_("Username"),
allow_empty=False,
help=_("Username with administrative rights, mandatory"))),
("password", Password(title=_("Password"),
allow_empty=True,
help=_("Specify password OR token, not both, token recommended"))),
("token", IndividualOrStoredPassword(title=_("App Password"),
allow_empty=True,
help=_("Specify password OR token, not both, token recommended"))),
("port", TextAscii(title=_("Port"),
allow_empty=True,
help=_("Specify port if not listening to HTTPS, optional"))),
("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(
factory_default = _factory_default_special_agent_nextcloud(),
group = RulespecGroupDatasourceProgramsApps,
name = "special_agents:nextcloud",
valuespec = _valuespec_special_agent_nextcloud,
)
)