Skip to content
Snippets Groups Projects
Commit 76970534 authored by Thomas Bellman's avatar Thomas Bellman
Browse files

Better status messages from check_ping_multiaddr.

Give understandable status messages for the IP addresses reported,
not just the status codes.
parent 66cd3e87
Branches
Tags
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment