aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2016-02-10 16:33:07 +0000
committerBryn M. Reeves <bmr@redhat.com>2016-02-10 16:33:07 +0000
commit606dcbc7d1cc203487ae9e773fe7173aa1966f2c (patch)
treeabfbf551f2842c17dbc3cada59d6e25f8c7a3e2c
parentffc1254f3158d0835d36c588e3f834cf53e2d47a (diff)
downloadsos-606dcbc7d1cc203487ae9e773fe7173aa1966f2c.tar.gz
[networking] disable netstat output truncation
By default netstat will truncate addresses that are wider than the current column width. Disable this to ensure that all IPv6 addresses can be captured in full. On Red Hat a non-upstream option (-T) was added to versions prior to 2.0 - handle these version checks in the RedHatNetworking class and set the appropriate option for each. Fixes #734. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/networking.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index 646eb226..8db28d59 100644
--- a/sos/plugins/networking.py
+++ b/sos/plugins/networking.py
@@ -26,6 +26,9 @@ class Networking(Plugin):
option_list = [("traceroute", "collects a traceroute to %s" % trace_host,
"slow", False)]
+ # switch to enable netstat "wide" (non-truncated) output mode
+ ns_wide = "-W"
+
def get_bridge_name(self, brctl_file):
"""Return a list for which items are bridge name according to the
output of brctl show stored in brctl_file.
@@ -141,7 +144,10 @@ class Networking(Plugin):
self.collect_ip6table("filter")
self.collect_ip6table("nat")
self.collect_ip6table("mangle")
- self.add_cmd_output("netstat -neopa", root_symlink="netstat")
+
+ self.add_cmd_output("netstat %s -neopa" % self.ns_wide,
+ root_symlink="netstat")
+
self.add_cmd_output([
"netstat -s",
"netstat -agn",
@@ -299,6 +305,14 @@ class RedHatNetworking(Networking, RedHatPlugin):
trace_host = "rhn.redhat.com"
def setup(self):
+ # Handle change from -T to -W in Red Hat netstat 2.0 and greater.
+ netstat_pkg = self.policy().package_manager.all_pkgs()['net-tools']
+ try:
+ # major version
+ if int(netstat_pkg['version'][0]) < 2:
+ self.ns_wide = "-T"
+ except:
+ pass # default to upstream option
super(RedHatNetworking, self).setup()