diff --git a/check_graylog.py b/check_graylog.py index 9b772ad..086122f 100755 --- a/check_graylog.py +++ b/check_graylog.py @@ -228,10 +228,12 @@ 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 = "notifications" if notifications["total"] > 1 else "notification" + are = "are" if notifications["total"] > 1 else "is" if args.html: - notif_str = f'There are {notifications["total"]} notifications.' + notif_str = f'There {are} {notifications["total"]} {notif}.' else: - notif_str = f'There are {notifications["total"]} notifications.' + notif_str = f'There {are} {notifications["total"]} {notif}.' else: notif_str = 'No notifications' @@ -265,7 +267,7 @@ def main(): exit_code = max(nagios.STATE_OK, jvm_mem_usage_state, elasticsearch_exit_code, indexer_failures_exit) if notifications['total'] > 0: - text_result += f' There are notifications!' + text_result += f' There {are} {notifications["total"]} {notif}!' if args.crit_notif: exit_code = nagios.STATE_CRIT # force crit