MKP 2.5.1, added version infos for apps with available updates
This commit is contained in:
@@ -136,10 +136,10 @@ def getSession(username, secret):
|
||||
return session
|
||||
|
||||
def getData(session, url, verify):
|
||||
data = {}
|
||||
headers = CaseInsensitiveDict()
|
||||
headers["Accept"] = "application/json"
|
||||
cookies = {"nc_sameSiteCookiestrict": "true"}
|
||||
response = session.get(url, headers=headers, cookies=cookies, verify=verify)
|
||||
response = session.get(url, headers=headers, verify=verify)
|
||||
status = response.status_code
|
||||
if (status == 200):
|
||||
jsdata = response.text
|
||||
@@ -157,8 +157,7 @@ def getDataAllUsers(session, url, verify):
|
||||
headers = CaseInsensitiveDict()
|
||||
headers["Accept"] = "application/json"
|
||||
headers["OCS-APIRequest"] = "true"
|
||||
cookies = {"nc_sameSiteCookiestrict": "true"}
|
||||
response = session.get(url, headers=headers, cookies=cookies, verify=verify)
|
||||
response = session.get(url, headers=headers, verify=verify)
|
||||
status = response.status_code
|
||||
if (status == 200):
|
||||
jsdata = response.text
|
||||
@@ -172,8 +171,7 @@ def getDataUser(session, url, verify):
|
||||
headers = CaseInsensitiveDict()
|
||||
headers["Accept"] = "application/json"
|
||||
headers["OCS-APIRequest"] = "true"
|
||||
cookies = {"nc_sameSiteCookiestrict": "true"}
|
||||
response = session.get(url, headers=headers, cookies=cookies, verify=verify)
|
||||
response = session.get(url, headers=headers, verify=verify)
|
||||
status = response.status_code
|
||||
if (status == 200):
|
||||
jsdata = response.text
|
||||
@@ -184,6 +182,8 @@ def getDataUser(session, url, verify):
|
||||
sys.exit(1)
|
||||
|
||||
def doCmkOutput(data):
|
||||
apps_with_updates_available = {}
|
||||
str_apps_with_updates_available = ""
|
||||
print("<<<nextcloud_info:sep(59)>>>")
|
||||
print(f"NC_Version;{data['ocs']['data']['nextcloud']['system']['version']}")
|
||||
print(f"NC_Freespace;{data['ocs']['data']['nextcloud']['system']['freespace']}")
|
||||
@@ -205,6 +205,11 @@ def doCmkOutput(data):
|
||||
try:
|
||||
print(f"NC_Num_Apps_Installed;{data['ocs']['data']['nextcloud']['system']['apps']['num_installed']}")
|
||||
print(f"NC_Num_Apps_Updates_Available;{data['ocs']['data']['nextcloud']['system']['apps']['num_updates_available']}")
|
||||
apps_with_updates_available = data['ocs']['data']['nextcloud']['system']['apps']['app_updates']
|
||||
if apps_with_updates_available:
|
||||
for app, version in apps_with_updates_available.items():
|
||||
str_apps_with_updates_available = str_apps_with_updates_available + app + "/" + version + " "
|
||||
print(f"NC_Apps_With_Updates_Available;{str_apps_with_updates_available}")
|
||||
except KeyError:
|
||||
pass
|
||||
print(f"NC_Active_Users_Last_5Min;{data['ocs']['data']['activeUsers']['last5minutes']}")
|
||||
|
||||
@@ -12,7 +12,9 @@ description:
|
||||
The user must not be secured with 2FA.
|
||||
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 if there is an update availbale for Nextcloud.
|
||||
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.
|
||||
The check will raise WARN/CRIT if the number of files is above the configurable levels.
|
||||
inventory:
|
||||
one service is created (with several details)
|
||||
@@ -51,10 +51,12 @@ def _parameter_spec_nextcloud_info():
|
||||
Integer(
|
||||
title=_("Warning at"),
|
||||
default_value=100000,
|
||||
size=32,
|
||||
),
|
||||
Integer(
|
||||
title=_("Critical at"),
|
||||
default_value=250000,
|
||||
size=32,
|
||||
)
|
||||
],
|
||||
)),
|
||||
|
||||
Reference in New Issue
Block a user