diff --git a/README.md b/README.md index 860851c..85e8233 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,15 @@ # Nextcloud CheckMK Special Agent -Monitors various aspects of Nextcloud instances like state, quota and disk usage of all users, number of apps with available updates, database cache hit rate and so on. +Monitors various aspects of Nextcloud instances like state, quota and disk usage of all users, number of apps with available updates, database php opcache hit rate and so on. Gives additional information regarding versions of Nextcloud, database, number of storages and active users etc. +Tested with Nextcloud 25/26/27. +Tested only with MySQL/MariaDB as database backend. +Feel free to report other working environments. Version History: -- |Date|Version|Changes| |----|-------|-------| +|2023/08/16|2.3.3|Fixed some misleading info strings regarding database opcache| |2023/08/12|2.3.2|MKP now compatible with CheckMK 2.2| |2023/03/27|2.3.1|Fixed bugs in parameter handling| |2023/03/23|2.2.1|Adjusted parameter handling| diff --git a/local/lib/python3/cmk/base/plugins/agent_based/nextcloud_database.py b/local/lib/python3/cmk/base/plugins/agent_based/nextcloud_database.py index 3765c72..240716a 100644 --- a/local/lib/python3/cmk/base/plugins/agent_based/nextcloud_database.py +++ b/local/lib/python3/cmk/base/plugins/agent_based/nextcloud_database.py @@ -34,7 +34,7 @@ def check_nextcloud_database(params, section): # create graph for database size yield Metric("nc_database_size", size) state = getStateLower(levels, opcache_hit_rate) - summary = f"Cache hit rate: {render.percent(opcache_hit_rate)}" + summary = f"PHP OPCache hit rate: {render.percent(opcache_hit_rate)}" details = f"\nDatabase type: {type}\nDatabase version: {version}\nDatabase size: {render.bytes(size)}" yield(Result(state=state, summary=summary, details=details)) diff --git a/local/share/check_mk/checkman/nextcloud_database b/local/share/check_mk/checkman/nextcloud_database index 08c598a..ad96286 100644 --- a/local/share/check_mk/checkman/nextcloud_database +++ b/local/share/check_mk/checkman/nextcloud_database @@ -4,13 +4,13 @@ catalog: unsorted license: GPL distribution: check_mk description: - Works with Nextcloud version 25.0.3 (use at your own risk with lower versions). + Works with Nextcloud version 25/26/27 (use at your own risk with lower versions). Tested only with mysql/mariab as underlying database. You may use a username/password or username/token combination to get access to the Nextcloud API. You can create this token within the personal settings of an administrative user in Nextcloud. Got to security settings and create a new app password, use this for the token. The user must not be secured with 2FA. Shows several information about a Nextcloud database (type/version/size). - The check will raise WARN/CRIT if Database OP cache hit rate is below the configurable levels. + The check will raise WARN/CRIT if Database PHP OPcache hit rate is below the configurable levels. inventory: one service is created (with several details) \ No newline at end of file diff --git a/local/share/check_mk/checkman/nextcloud_info b/local/share/check_mk/checkman/nextcloud_info index f14bd45..073d084 100644 --- a/local/share/check_mk/checkman/nextcloud_info +++ b/local/share/check_mk/checkman/nextcloud_info @@ -4,7 +4,7 @@ catalog: unsorted license: GPL distribution: check_mk description: - Works with Nextcloud version 25.0.3 (use at your own risk with lower versions). + Works with Nextcloud version 25/26/27 (use at your own risk with lower versions). Tested only with mysql/mariab as underlying database. You may use a username/password or username/token combination to get access to the Nextcloud API. You can create this token within the personal settings of an administrative user in Nextcloud. diff --git a/local/share/check_mk/checkman/nextcloud_users b/local/share/check_mk/checkman/nextcloud_users index db0a5e6..4345347 100644 --- a/local/share/check_mk/checkman/nextcloud_users +++ b/local/share/check_mk/checkman/nextcloud_users @@ -4,7 +4,7 @@ catalog: unsorted license: GPL distribution: check_mk description: - Works with Nextcloud version 25.0.3 (use at your own risk with lower versions). + Works with Nextcloud version 25/26/27 (use at your own risk with lower versions). You may use a username/password or username/token combination to get access to the Nextcloud API. You can create this token within the personal settings of an administrative user in Nextcloud. Got to security settings and create a new app password, use this for the token. diff --git a/local/share/check_mk/web/plugins/metrics/nextcloud_metrics.py b/local/share/check_mk/web/plugins/metrics/nextcloud_metrics.py index cbce1c3..d7cb0f9 100644 --- a/local/share/check_mk/web/plugins/metrics/nextcloud_metrics.py +++ b/local/share/check_mk/web/plugins/metrics/nextcloud_metrics.py @@ -96,7 +96,7 @@ metric_info["nc_database_size"] = { } metric_info["nc_database_opcache_hit_rate"] = { - "title": _("Database OP Cache Hit Rate"), + "title": _("Database PHP OPCache Hit Rate"), "unit": "%", "color": "24/a", } diff --git a/local/share/check_mk/web/plugins/wato/nextcloud_database_rules.py b/local/share/check_mk/web/plugins/wato/nextcloud_database_rules.py index 8881ca8..5d5c005 100644 --- a/local/share/check_mk/web/plugins/wato/nextcloud_database_rules.py +++ b/local/share/check_mk/web/plugins/wato/nextcloud_database_rules.py @@ -17,7 +17,7 @@ def _parameter_spec_nextcloud_database(): return Dictionary( elements=[ ("levels_database_opcache_hit_rate", Tuple( - title=_("Nextcloud levels for database opcache hit rate"), + title=_("Nextcloud levels for database php opcache hit rate"), elements=[ Percentage( title=_("Warning below"), diff --git a/local/share/check_mk/web/plugins/wato/nextcloud_params.py b/local/share/check_mk/web/plugins/wato/nextcloud_params.py index d425d37..32c524d 100644 --- a/local/share/check_mk/web/plugins/wato/nextcloud_params.py +++ b/local/share/check_mk/web/plugins/wato/nextcloud_params.py @@ -18,7 +18,6 @@ from cmk.gui.plugins.wato import ( ) from cmk.gui.plugins.wato.datasource_programs import RulespecGroupDatasourceProgramsCustom -#import cmk.gui.watolib as watolib def _valuespec_special_agent_nextcloud(): return Dictionary( @@ -53,7 +52,6 @@ def _valuespec_special_agent_nextcloud(): rulespec_registry.register( HostRulespec( - #factory_default=watolib.Rulespec.FACTORY_DEFAULT_UNUSED, group=RulespecGroupDatasourceProgramsCustom, name="special_agents:nextcloud", valuespec=_valuespec_special_agent_nextcloud, diff --git a/local/share/check_mk/web/plugins/wato/nextcloud_users_rules.py b/local/share/check_mk/web/plugins/wato/nextcloud_users_rules.py index 8440478..9eff766 100644 --- a/local/share/check_mk/web/plugins/wato/nextcloud_users_rules.py +++ b/local/share/check_mk/web/plugins/wato/nextcloud_users_rules.py @@ -11,6 +11,7 @@ from cmk.gui.valuespec import ( Tuple, Percentage, Integer, + TextAscii, Float, ) diff --git a/mkp/Nextcloud-2.3.3.mkp b/mkp/Nextcloud-2.3.3.mkp new file mode 100755 index 0000000..55f7034 Binary files /dev/null and b/mkp/Nextcloud-2.3.3.mkp differ