From b3275109dada12f101db38461c258abf0618dba5 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Wed, 18 Aug 2021 07:40:40 +0300 Subject: [PATCH] fixup! Change the notification format. --- mnpw/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mnpw/__init__.py b/mnpw/__init__.py index 59183d9..cd01902 100644 --- a/mnpw/__init__.py +++ b/mnpw/__init__.py @@ -104,7 +104,7 @@ def main(): # noqa: MC0001 check.run(args.timeout) except Exception as ex: # pylint: disable=broad-except if args.errors and not args.dry_run: - notify(f"Check {args.command} on {HOSTNAME} failed: {ex}.") + notify(f"[HOSTNAME] Check {args.command} failed: {ex}.") parser.error(str(ex)) if check.ExitCode == nagios.NagiosCode.OK: @@ -112,21 +112,21 @@ def main(): # noqa: MC0001 elif check.ExitCode == nagios.NagiosCode.WARNING: logging.info("Check status is WARNING.") if args.warn and not args.dry_run: - notify(f"({HOSTNAME} {check.Output}") + notify(f"[{HOSTNAME}] {check.Output}") elif check.ExitCode == nagios.NagiosCode.CRITICAL: logging.info("Check status is CRITICAL.") if not args.dry_run: - notify(f"({HOSTNAME} {check.Output}") + notify(f"[{HOSTNAME}] {check.Output}") elif check.ExitCode == nagios.NagiosCode.UNKNOWN: logging.info("Check status is UNKNOWN.") if args.unknown and not args.dry_run: - notify(f"({HOSTNAME} {check.Output}") + notify(f"[{HOSTNAME}] {check.Output}") else: logging.info( f"Check status is invalid for a Nagios plugin ({check.ExitCode})." ) if args.errors: - notify(f"Check {args.command} on {HOSTNAME} status is invalid.") + notify(f"[HOSTNAME] Check {args.command} status is invalid.") if args.chain: print(check._stdout) # pylint: disable=protected-access -- GitLab