BIND 10 trac2062, updated. 04fd11bf0539ea3ace1c103cf4488cb965aec659 [2062] Show network information
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Jun 28 07:21:07 UTC 2012
The branch, trac2062 has been updated
via 04fd11bf0539ea3ace1c103cf4488cb965aec659 (commit)
from 5c6c47046be1da96c581693c500461dff5ba9304 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 04fd11bf0539ea3ace1c103cf4488cb965aec659
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Jun 28 12:49:36 2012 +0530
[2062] Show network information
These details capture the output of tools without any post-parsing, as
the support team will likely want to see all the raw data instead of a
subset of it.
-----------------------------------------------------------------------
Summary of changes:
src/bin/showtech/showtech.py.in | 24 ++++++++++---
src/lib/python/isc/sysinfo/sysinfo.py | 64 ++++++++++++++++++++++++++++++++-
2 files changed, 83 insertions(+), 5 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/showtech/showtech.py.in b/src/bin/showtech/showtech.py.in
index 599c695..752a331 100755
--- a/src/bin/showtech/showtech.py.in
+++ b/src/bin/showtech/showtech.py.in
@@ -27,7 +27,7 @@ def main():
s = SysInfo()
print('BIND 10 ShowTech tool')
- print('---------------------')
+ print('=====================')
print('\nCPU');
print(' + Number of processors: ' + str(s.get_num_processors()))
@@ -42,6 +42,7 @@ def main():
else:
print(' + SMP kernel: no')
print(' + Machine name: ' + s.get_platform_machine())
+ print(' + Hostname: ' + s.get_platform_hostname())
print(' + Uptime: %d seconds' % (s.get_uptime()))
l = s.get_loadavg()
@@ -55,10 +56,25 @@ def main():
print(' + Swap total: %d bytes' % (s.get_mem_swap_total()))
print(' + Swap free: %d bytes' % (s.get_mem_swap_free()))
- print('\nNetwork');
- print(' + Hostname: ' + s.get_hostname())
+ print('\n\nNetwork');
+ print('-------\n');
- print('')
+ print('Interfaces')
+ print('~~~~~~~~~~\n')
+
+ print(s.get_net_interfaces())
+
+ print('Routing table')
+ print('~~~~~~~~~~~~~\n')
+ print(s.get_net_routing_table())
+
+ print('Statistics')
+ print('~~~~~~~~~~\n')
+ print(s.get_net_stats())
+
+ print('Connections')
+ print('~~~~~~~~~~~\n')
+ print(s.get_net_connections())
if __name__ == '__main__':
main()
diff --git a/src/lib/python/isc/sysinfo/sysinfo.py b/src/lib/python/isc/sysinfo/sysinfo.py
index 5506974..ae01fe8 100644
--- a/src/lib/python/isc/sysinfo/sysinfo.py
+++ b/src/lib/python/isc/sysinfo/sysinfo.py
@@ -109,6 +109,53 @@ class SysInfo:
if self._platform_distro is None:
self._platform_distro = 'Unknown'
+ self._net_interfaces = None
+
+ try:
+ s = subprocess.check_output(['ip', 'addr'])
+ self._net_interfaces = s.decode('utf-8')
+ except (subprocess.CalledProcessError, OSError):
+ pass
+
+ if self._net_interfaces is None:
+ self._net_interfaces = 'Unknown'
+
+ self._net_routing_table = None
+
+ try:
+ s = subprocess.check_output(['ip', 'route'])
+ self._net_routing_table = s.decode('utf-8')
+ self._net_routing_table += '\n'
+ s = subprocess.check_output(['ip', '-f', 'inet6', 'route'])
+ self._net_routing_table += s.decode('utf-8')
+ except (subprocess.CalledProcessError, OSError):
+ pass
+
+ if self._net_routing_table is None:
+ self._net_routing_table = 'Unknown'
+
+ self._net_stats = None
+
+ try:
+ s = subprocess.check_output(['netstat', '-s'])
+ self._net_stats = s.decode('utf-8')
+ except (subprocess.CalledProcessError, OSError):
+ pass
+
+ if self._net_stats is None:
+ self._net_stats = 'Unknown'
+
+ self._net_connections = None
+
+ try:
+ s = subprocess.check_output(['netstat', '-apn'])
+ self._net_connections = s.decode('utf-8')
+ except (subprocess.CalledProcessError, OSError):
+ pass
+
+ if self._net_connections is None:
+ self._net_connections = 'Unknown'
+
def get_num_processors(self):
# This is the number of hyperthreads when hyper-threading is
# used. This is not entirely portable, so we'll have to handle
@@ -118,7 +165,7 @@ class SysInfo:
def get_endianness(self):
return self._endianness
- def get_hostname(self):
+ def get_platform_hostname(self):
return self._hostname
def get_platform_name(self):
@@ -159,3 +206,18 @@ class SysInfo:
def get_mem_swap_free(self):
return self._mem_swap_free
+
+ def get_mem_swap_free(self):
+ return self._mem_swap_free
+
+ def get_net_interfaces(self):
+ return self._net_interfaces
+
+ def get_net_routing_table(self):
+ return self._net_routing_table
+
+ def get_net_stats(self):
+ return self._net_stats
+
+ def get_net_connections(self):
+ return self._net_connections
More information about the bind10-changes
mailing list