From 6fa48b0fd81cd766bd87577736a054168dbef608 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Tue, 27 Jun 2023 18:36:48 -0600 Subject: [PATCH] check_graylog: wording --- check_graylog.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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