Module: check_mk
Branch: master
Commit: 9146c3d892adc6dd09e589914bc3e89acdab6d8e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9146c3d892adc6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 14 14:18:07 2015 +0200
The host diagnose is now using the primary IP address family of a host (either IPv4 or
IPv6)
---
.werks/2674 | 1 -
modules/automation.py | 10 +++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/.werks/2674 b/.werks/2674
index 561aa69..2ad124f 100644
--- a/.werks/2674
+++ b/.werks/2674
@@ -41,7 +41,6 @@ components in the Check_MK environment left which need to be extended to
be full
compatible with IPv6. Some of them are:
LI: Parent scanning (check_mk --scan-parents)
-LI: WATO - Host-Diagnose
LI: WATO - Most active checks
LI: Event Console
LI: Notification Forwarding
diff --git a/modules/automation.py b/modules/automation.py
index 0690e29..bcdfa15 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -568,13 +568,16 @@ def automation_diag_host(args):
if not ipaddress:
try:
- ipaddress = lookup_ipv4_address(hostname)
+ ipaddress = lookup_ip_address(hostname)
except:
raise MKGeneralException("Cannot resolve hostname %s into IP
address" % hostname)
+ ipv6_primary = is_ipv6_primary(hostname)
+
try:
if test == 'ping':
- p = subprocess.Popen('ping -A -i 0.2 -c 2 -W 5 %s 2>&1' %
ipaddress, shell = True, stdout = subprocess.PIPE)
+ base_cmd = ipv6_primary and "ping6" or "ping"
+ p = subprocess.Popen('%s -A -i 0.2 -c 2 -W 5 %s 2>&1' %
(base_cmd, ipaddress), shell = True, stdout = subprocess.PIPE)
response = p.stdout.read()
return (p.wait(), response)
@@ -592,7 +595,8 @@ def automation_diag_host(args):
if not traceroute_prog:
return 1, "Cannot find binary
<tt>traceroute</tt>."
else:
- p = subprocess.Popen('traceroute -n %s 2>&1' % ipaddress,
shell = True, stdout = subprocess.PIPE)
+ family_flag = ipv6_primary and "-6" or "-4"
+ p = subprocess.Popen('traceroute %s -n %s 2>&1' %
(family_flag, ipaddress), shell = True, stdout = subprocess.PIPE)
response = p.stdout.read()
return (p.wait(), response)