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

60 lines
2.4 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
2023-03-11 14:29:54 +01:00
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,
2023-03-11 14:29:54 +01:00
rulespec_registry,
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
Checkbox,
TextAscii,
Password,
)
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,
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"),
size = 40,
2023-03-11 14:29:54 +01:00
allow_empty=False,
help=_("Username with administrative rights, mandatory"))),
("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,
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(
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
)
)