From de29530a471bcf27aa9419b5b125726fbe4bd6bc Mon Sep 17 00:00:00 2001 From: Cyberes Date: Tue, 27 Jun 2023 18:34:00 -0600 Subject: [PATCH] check_graylog: fix notifications --- check_graylog.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/check_graylog.py b/check_graylog.py index 16079ea..9b772ad 100755 --- a/check_graylog.py +++ b/check_graylog.py @@ -228,9 +228,10 @@ def main(): notifications = fetch_with_retry(f'{base_url}/api/system/notifications', headers=headers, auth=(args.token, 'token'), verify=args.insecure).json() if notifications['total'] > 0: - notif_str = 'Notifications:' - for notification in notifications['notifications']: - notif_str = notif_str + f'\n{notification["type"]}: {notification["description"]}' + if args.html: + notif_str = f'There are {notifications["total"]} notifications.' + else: + notif_str = f'There are {notifications["total"]} notifications.' else: notif_str = 'No notifications'