From 769705348b38d8bf61c2313a7ee6af5e318cef3a Mon Sep 17 00:00:00 2001 From: Thomas Bellman <bellman@lysator.liu.se> Date: Thu, 27 Dec 2018 23:01:49 +0100 Subject: [PATCH] Better status messages from check_ping_multiaddr. Give understandable status messages for the IP addresses reported, not just the status codes. --- check_ping_multiaddr.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/check_ping_multiaddr.py b/check_ping_multiaddr.py index 73e8862..9e57990 100755 --- a/check_ping_multiaddr.py +++ b/check_ping_multiaddr.py @@ -223,12 +223,12 @@ def main(argv): (alive, unreachable, not_reported, unexpected) = \ ping_addresses(addresses) - # XXX: Better messages ping_statuses = { - 'OK': map(str, alive), - 'WARNING': map(str, unexpected), - 'CRITICAL': map(str, unreachable), - 'UNKNOWN': map(str, not_reported), + 'OK': [ '%s is alive' % (ip,) for ip in alive ], + 'WARNING': [ '%s was reported despite not being pinged' % (ip,) + for ip in unexpected ], + 'CRITICAL': [ '%s is unreachable' % (ip,) for ip in unreachable ], + 'UNKNOWN': [ '%s has no information' % (ip,) for ip in not_reported ], } lvl,message = trh_nagioslib.nagios_report(ping_statuses) sys.stdout.write(message) -- GitLab