Initial Commit v2.2.0

This commit is contained in:
2023-03-11 14:29:54 +01:00
parent bc5a12babd
commit b0d808ae60
14 changed files with 1038 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithoutItem,
rulespec_registry,
RulespecGroupCheckParametersApplications
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
Tuple,
Percentage,
Integer,
Float,
)
def _parameter_spec_nextcloud_database():
return Dictionary(
elements=[
("levels_database_opcache_hit_rate", Tuple(
title=_("Nextcloud levels for database opcache hit rate"),
elements=[
Percentage(
title=_("Warning below"),
default_value=99.7,
),
Percentage(
title=_("Critical below"),
default_value=99.1,
)
],
)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithoutItem(
check_group_name="nextcloud_database",
group=RulespecGroupCheckParametersApplications,
match_type="dict",
parameter_valuespec=_parameter_spec_nextcloud_database,
title=lambda: _("Nextcloud Database"),
)
)

View File

@@ -0,0 +1,43 @@
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithoutItem,
rulespec_registry,
RulespecGroupCheckParametersApplications
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
Tuple,
Percentage,
Integer,
Float,
)
def _parameter_spec_nextcloud_info():
return Dictionary(
elements=[
("levels_apps_with_updates_available", Tuple(
title=_("Nextcloud number of installed apps with updates available"),
elements=[
Integer(
title=_("Warning at"),
default_value=1,
),
Integer(
title=_("Critical at"),
default_value=2,
)
],
)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithoutItem(
check_group_name="nextcloud_info",
group=RulespecGroupCheckParametersApplications,
match_type="dict",
parameter_valuespec=_parameter_spec_nextcloud_info,
title=lambda: _("Nextcloud Info"),
)
)

View File

@@ -0,0 +1,59 @@
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersOperatingSystem,
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
Checkbox,
TextAscii,
Password,
)
from cmk.gui.plugins.wato import (
HostRulespec,
)
from cmk.gui.plugins.wato.datasource_programs import RulespecGroupDatasourceProgramsCustom
import cmk.gui.watolib as watolib
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", Password(title=_("Token"),
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=watolib.Rulespec.FACTORY_DEFAULT_UNUSED,
group=RulespecGroupDatasourceProgramsCustom,
name="special_agents:nextcloud",
valuespec=_valuespec_special_agent_nextcloud,
)
)

View File

@@ -0,0 +1,66 @@
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersApplications
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
Tuple,
Percentage,
Integer,
Float,
)
def _item_spec_nextcloud_users():
return TextAscii(
title=_("User ID")
)
def _parameter_spec_nextcloud_users():
return Dictionary(
elements=[
("levels_users_quota_used", Tuple(
title=_("Nextcloud levels for quota usage of users"),
elements=[
Percentage(
title=_("Warning at"),
default_value=65.0,
unit="%",
),
Percentage(
title=_("Critical at"),
default_value=85.0,
unit="%",
)
],
)),
("levels_users_free_space", Tuple(
title=_("Nextcloud levels for free disk space of users"),
elements=[
Float(
title=_("Warning below"),
default_value=256.0,
unit="MBytes",
),
Float(
title=_("Critical below"),
default_value=128.0,
unit="MBytes",
)
],
)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithItem(
check_group_name="nextcloud_users",
group=RulespecGroupCheckParametersApplications,
match_type="dict",
item_spec=_item_spec_nextcloud_users,
parameter_valuespec=_parameter_spec_nextcloud_users,
title=lambda: _("Nextcloud Users"),
)
)