check_graylog: fix notifications

This commit is contained in:
Cyberes 2023-06-27 18:34:00 -06:00
parent 61ec9a8580
commit de29530a47
1 changed files with 4 additions and 3 deletions

View File

@ -228,9 +228,10 @@ def main():
notifications = fetch_with_retry(f'{base_url}/api/system/notifications', headers=headers, notifications = fetch_with_retry(f'{base_url}/api/system/notifications', headers=headers,
auth=(args.token, 'token'), verify=args.insecure).json() auth=(args.token, 'token'), verify=args.insecure).json()
if notifications['total'] > 0: if notifications['total'] > 0:
notif_str = 'Notifications:' if args.html:
for notification in notifications['notifications']: notif_str = f'<a href="{base_url}/system/overview" target="_blank">There are {notifications["total"]} notifications.</a>'
notif_str = notif_str + f'\n{notification["type"]}: {notification["description"]}' else:
notif_str = f'There are {notifications["total"]} notifications.'
else: else:
notif_str = 'No notifications' notif_str = 'No notifications'