diff options
author | meisterfischy <grbmn@kstn.in> | 2022-10-05 16:47:31 +0200 |
---|---|---|
committer | meisterfischy <grbmn@kstn.in> | 2022-10-05 16:47:31 +0200 |
commit | 4e008271558897843ea00de495e806fe69e45549 (patch) | |
tree | c4a2d3c46dd7511da35fd75ed69b079ef4edc49f /plugins | |
parent | 3cfcce67acbee0ee9c92d886d47b068baaa262ad (diff) | |
download | monitoring_custom-4e008271558897843ea00de495e806fe69e45549.tar.gz |
API url as parameter
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/check_nextcloud | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/check_nextcloud b/plugins/check_nextcloud index 45411d8..ceebd6d 100755 --- a/plugins/check_nextcloud +++ b/plugins/check_nextcloud @@ -28,6 +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('-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') @@ -66,7 +67,7 @@ def check_app_updates(data_json) -> Check: return Check('OK', 'No app updates were found.', None) try: - data_json = requests.get('https://nextcloud.my.cum.re/ocs/v2.php/apps/serverinfo/api/v1/info?format=json' + data_json = requests.get(args.url + '?format=json' , headers={'NC-Token': args.token}).json() if data_json['ocs']['meta']['status'] == 'failure': raise APIError('API call failed!') |