From 1266615cc13ae552356592350ea66fb2414b8a99 Mon Sep 17 00:00:00 2001 From: meisterfischy Date: Wed, 5 Oct 2022 17:20:47 +0200 Subject: Changed parameter --- plugins/check_nextcloud | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/check_nextcloud b/plugins/check_nextcloud index ceebd6d..72a8d85 100755 --- a/plugins/check_nextcloud +++ b/plugins/check_nextcloud @@ -28,7 +28,7 @@ def dict_to_list(dic): parser = argparse.ArgumentParser(description='Check nextcloud status via api') parser.add_argument('-t', dest='token', action='store', type=str, required=True) -parser.add_argument('--url', dest='url', action='store', type=str, required=True) +parser.add_argument('-H', dest='hostname', action='store', type=str, required=True) parser.add_argument('-u', dest='max_conns', action='store', type=int, default=None, nargs=2) parser.add_argument('-c', dest='opcache', action='store', type=float, default=None, nargs=2) parser.add_argument('-a', dest='updates', action='store_true', help='check for app updates') @@ -38,7 +38,7 @@ def check_interned_strings_cache(data_json, warning: float, critical: float) -> data_opcache = data_json['ocs']['data']['server']['php']['opcache'] cache_max = data_opcache['interned_strings_usage']['buffer_size'] cache_used = data_opcache['interned_strings_usage']['used_memory'] / cache_max - data = {'internd_string_cache' : f'{cache_used:.0%};{warning*100:.0f};{critical*100:.0f}'} + data = {'interned_string_cache' : f'{cache_used:.0%};{warning*100:.0f};{critical*100:.0f}'} if cache_used >= critical: msg = "The OPcache interned strings buffer is full." if critical == 1 \ else f"OPcache interned strings buffer is to {cache_used:.0%} filled. " + f"This should not be more than {critical:.0%}!" @@ -67,8 +67,8 @@ def check_app_updates(data_json) -> Check: return Check('OK', 'No app updates were found.', None) try: - data_json = requests.get(args.url + '?format=json' - , headers={'NC-Token': args.token}).json() + data_json = requests.get(f'https://{args.hostname}/ocs/v2.php/apps/serverinfo/api/v1/info?format=json' + , headers={'NC-Token': args.token, 'host': args.hostname}).json() if data_json['ocs']['meta']['status'] == 'failure': raise APIError('API call failed!') if args.updates: -- cgit v1.2.3