Module: check_mk
Branch: master
Commit: fe62316db62d68c49460e372ec83aa5a62b38da3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fe62316db62d68…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jan 22 09:33:13 2014 +0100
Add output of traceroute to host diagnostic page
---
.werks/454 | 8 ++++++++
ChangeLog | 1 +
modules/automation.py | 12 +++++++++++-
web/htdocs/wato.py | 3 ++-
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/.werks/454 b/.werks/454
new file mode 100644
index 0000000..ca3d6e8
--- /dev/null
+++ b/.werks/454
@@ -0,0 +1,8 @@
+Title: Add output of traceroute to host diagnostic page
+Level: 2
+Component: wato
+Version: 1.2.5i1
+Date: 1390379579
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index c2bd82a..7ea2049 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -173,6 +173,7 @@
* 0428 Changed user profiles (e.g. pw changes) are now replicated in distributed
setups...
* 0114 User Custom Attributes can now be exported to the core...
* 0448 New button in WATO service list for displaying check parameters...
+ * 0454 Add output of traceroute to host diagnostic page
* 0057 FIX: Fix exception in WATO host editor on custom tag without topic...
* 0241 FIX: Improved sorting of WATO folders in dropdown menu...
* 0019 FIX: Fixed wording in WATO rule for MSSQL check
diff --git a/modules/automation.py b/modules/automation.py
index 66e5d5d..89b00f9 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -684,6 +684,8 @@ def automation_scan_parents(args):
raise MKAutomationError(str(e))
def automation_diag_host(args):
+ import subprocess
+
hostname, test, ipaddress, snmp_community = args[:4]
agent_port, snmp_timeout, snmp_retries = map(int, args[4:7])
cmd = args[7]
@@ -696,7 +698,6 @@ def automation_diag_host(args):
try:
if test == 'ping':
- import subprocess
p = subprocess.Popen('ping -A -i 0.2 -c 2 -W 5 %s 2>&1' %
ipaddress, shell = True, stdout = subprocess.PIPE)
response = p.stdout.read()
return (p.wait(), response)
@@ -710,6 +711,15 @@ def automation_diag_host(args):
else:
return 0, get_agent_info_tcp(hostname, ipaddress, agent_port or None)
+ elif test == 'traceroute':
+ traceroute_prog = find_bin_in_path('traceroute')
+ 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)
+ response = p.stdout.read()
+ return (p.wait(), response)
+
elif test.startswith('snmp'):
if snmp_community:
explicit_snmp_communities[hostname] = snmp_community
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 481de8b..d1a9bcc 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2192,7 +2192,8 @@ def diag_host_tests():
('agent', _('Agent')),
('snmpv1', _('SNMPv1')),
('snmpv2', _('SNMPv2c')),
- ('snmpv2_nobulk', _('SNMPv2c (without Bulkwalk)'))
+ ('snmpv2_nobulk', _('SNMPv2c (without Bulkwalk)')),
+ ('traceroute', _('Traceroute')),
]
def mode_diag_host(phase):