check_graylog: wording

This commit is contained in:
Cyberes 2023-06-27 18:36:48 -06:00
parent de29530a47
commit 6fa48b0fd8
1 changed files with 5 additions and 3 deletions

View File

@ -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'<a href="{base_url}/system/overview" target="_blank">There are {notifications["total"]} notifications.</a>'
notif_str = f'<a href="{base_url}/system/overview" target="_blank">There {are} {notifications["total"]} {notif}.</a>'
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