diff options
author | Jon Stanley <jonstanley@gmail.com> | 2012-06-12 10:22:54 -0400 |
---|---|---|
committer | Jon Stanley <jonstanley@gmail.com> | 2012-06-12 10:22:54 -0400 |
commit | b46608a06e69039349b56daa1952d68e4f451ff5 (patch) | |
tree | 9231f1d375d824c9f33c519e692b7accfad74aaf | |
parent | d0777c5dd7765776bf8af6a819b966dbc0e66442 (diff) | |
download | sos-b46608a06e69039349b56daa1952d68e4f451ff5.tar.gz |
Change get_interface_name to support arbitrarily named interfaces
Due to support for biosdevname, we now have to look at interface
types rather than names in order to determine whether an interface
is interesting for this plugin.
-rw-r--r-- | sos/plugins/networking.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py index 1497c835..4f1f02f6 100644 --- a/sos/plugins/networking.py +++ b/sos/plugins/networking.py @@ -21,11 +21,16 @@ class networking(Plugin, RedHatPlugin): """ optionList = [("traceroute", "collects a traceroute to rhn.redhat.com", "slow", False)] - def get_interface_name(self,ifconfigFile): + def get_interface_name(self,ipaddrFile): """Return a dictionary for which key are interface name according to the output of ifconifg-a stored in ifconfigFile. """ - out=self.doRegexFindAll(r"^(eth\d+)\D", ifconfigFile) + out={} + for interface in open(ipaddrFile, 'r').readlines(): + match=re.match(r'link/ether', interface) + if match: + int=match.string.split(':')[1].lstrip() + out[int]=True return out def collectIPTable(self,tablename): @@ -51,7 +56,7 @@ class networking(Plugin, RedHatPlugin): "/etc/xinetd.d", "/etc/host*", "/etc/resolv.conf"]) - ifconfigFile=self.collectOutputNow("/sbin/ip -o addr", root_symlink = "ip_addr") + ipaddrFile=self.collectOutputNow("/sbin/ip -o addr", root_symlink = "ip_addr") self.collectExtOutput("/sbin/route -n", root_symlink = "route") self.collectIPTable("filter") self.collectIPTable("nat") @@ -66,8 +71,8 @@ class networking(Plugin, RedHatPlugin): self.collectExtOutput("/sbin/ifenslave -a") self.collectExtOutput("/sbin/ip mroute show") self.collectExtOutput("/sbin/ip maddr show") - if ifconfigFile: - for eth in self.get_interface_name(ifconfigFile): + if ipaddrFile: + for eth in self.get_interface_name(ipaddrFile): self.collectExtOutput("/sbin/ethtool "+eth) self.collectExtOutput("/sbin/ethtool -i "+eth) self.collectExtOutput("/sbin/ethtool -k "+eth) |