Version 2.2.1

This commit is contained in:
2023-03-23 13:15:32 +01:00
parent f1f5083ed8
commit dd5c3c14d2
10 changed files with 98 additions and 10 deletions

View File

@@ -30,6 +30,7 @@ OPTIONS:
-h, --help Show this help message and exit
""")
# set this to true to produce debug output (this clutters the agent output)
DEBUG = False
nc_api_endpoint = "ocs/v2.php/apps/serverinfo/api/v1/info?format=json"
@@ -190,7 +191,8 @@ def getDataUser(url, verify):
def doCmkOutput(data):
print("<<<nextcloud_info:sep(59)>>>")
print(f"NC_Version;{data['ocs']['data']['nextcloud']['system']['version']}")
print(f"NC_Version;{data['ocs']['data']['nextcloud']['system']['version']}")
print(f"NC_Freespace;{data['ocs']['data']['nextcloud']['system']['freespace']}")
print(f"NC_Status;{data['ocs']['meta']['status']}")
print(f"NC_Num_Users;{data['ocs']['data']['nextcloud']['storage']['num_users']}")
print(f"NC_Num_Files;{data['ocs']['data']['nextcloud']['storage']['num_files']}")
@@ -204,6 +206,8 @@ def doCmkOutput(data):
print(f"NC_Active_Users_Last_5Min;{data['ocs']['data']['activeUsers']['last5minutes']}")
print(f"NC_Active_Users_Last_1Hour;{data['ocs']['data']['activeUsers']['last1hour']}")
print(f"NC_Active_Users_Last_1Day;{data['ocs']['data']['activeUsers']['last24hours']}")
print(f"NC_Webserver;{data['ocs']['data']['server']['webserver']}")
print(f"NC_PHP_Version;{data['ocs']['data']['server']['php']['version']}")
print("<<<nextcloud_database:sep(59)>>>")
print(f"NC_Database_Type;{data['ocs']['data']['server']['database']['type']}")
@@ -261,7 +265,13 @@ def main():
protocol = "http"
else:
protocol = "https"
port = opt_port
port = opt_port
if (protocol == "http" and port == "443"):
sys.stderr.write(f"Combining HTTP with port 443 is not supported.\n")
sys.exit(1)
if (protocol == "https" and port == "80"):
sys.stderr.write(f"Combining HTTPS with port 80 is not supported.\n")
sys.exit(1)
nc_url = createUrl(nc_api_endpoint, opt_hostname, protocol, port, opt_folder)
nc_data = getData(nc_url, verify)
doCmkOutput(nc_data)

View File

@@ -10,9 +10,9 @@ description:
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 instance (e.g. number of files/storages/users.
Shows several information about a Nextcloud instance, e.g. number of files/storages/(active)users, free space on disk.
The check will raise CRIT if the Nextcloud instance is not in "ok" state.
The check will raise WARN/CRIT if Database OP cache hit rate is below the configurable levels.
The check will raise WARN/CRIT if free space on disk is below the configurable levels.
The check will raise WARN/CRIT if the number of installed apps with available updates is above the configurable levels.
inventory:
one service is created (with several details)

View File

@@ -78,7 +78,13 @@ metric_info["nc_active_users_last_1day"] = {
}
metric_info["nc_users_free_space"] = {
"title": _("Free Space"),
"title": _("Free Space of User"),
"unit": "bytes",
"color": "22/a",
}
metric_info["nc_free_space"] = {
"title": _("Free Space on Disk"),
"unit": "bytes",
"color": "22/a",
}

View File

@@ -29,6 +29,34 @@ def _parameter_spec_nextcloud_info():
)
],
)),
("levels_free_space", Tuple(
title=_("Nextcloud levels for free disk space overall"),
elements=[
Float(
title=_("Warning below"),
default_value=8.0,
unit="GBytes",
),
Float(
title=_("Critical below"),
default_value=4.0,
unit="GBytes",
)
],
)),
("levels_number_of_files", Tuple(
title=_("Nextcloud number of files"),
elements=[
Integer(
title=_("Warning at"),
default_value=100000,
),
Integer(
title=_("Critical at"),
default_value=250000,
)
],
)),
],
)