Module: check_mk
Branch: master
Commit: 657997a4eab87c9dd3e51e3e749d70d0677195fb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=657997a4eab87c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 20 12:17:34 2013 +0100
cmk -d now handles ping-only hosts and piggybacked hosts
---
modules/check_mk.py | 31 +++++++++++++++++--------------
1 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 394793e..9bf7372 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -3473,20 +3473,23 @@ def output_plain_hostinfo(hostname):
if info:
sys.stdout.write(info)
return
- try:
- ipaddress = lookup_ipaddress(hostname)
- sys.stdout.write(get_agent_info(hostname, ipaddress, 0))
- except MKAgentError, e:
- sys.stderr.write("Problem contacting agent: %s\n" % (e,))
- sys.exit(3)
- except MKGeneralException, e:
- sys.stderr.write("General problem: %s\n" % (e,))
- sys.exit(3)
- except socket.gaierror, e:
- sys.stderr.write("Network error: %s\n" % e)
- except Exception, e:
- sys.stderr.write("Unexpected exception: %s\n" % (e,))
- sys.exit(3)
+ if is_tcp_host(hostname):
+ try:
+ ipaddress = lookup_ipaddress(hostname)
+ sys.stdout.write(get_agent_info(hostname, ipaddress, 0))
+ except MKAgentError, e:
+ sys.stderr.write("Problem contacting agent: %s\n" % (e,))
+ sys.exit(3)
+ except MKGeneralException, e:
+ sys.stderr.write("General problem: %s\n" % (e,))
+ sys.exit(3)
+ except socket.gaierror, e:
+ sys.stderr.write("Network error: %s\n" % e)
+ except Exception, e:
+ sys.stderr.write("Unexpected exception: %s\n" % (e,))
+ sys.exit(3)
+
+ sys.stdout.write(get_piggyback_info(hostname))
def do_snmpwalk(hostnames):
if len(hostnames) == 0: