diff --git a/agent.py b/agent.py index bc26bc4..e251e2d 100755 --- a/agent.py +++ b/agent.py @@ -95,8 +95,11 @@ class Network: num=0 for interface in psutil.net_if_addrs(): exec("self.net_"+str(num)+" = {}") + interface_usage = psutil.net_io_counters(pernic=True) for detail in psutil.net_if_addrs()[interface]: exec("self.net_"+str(num)+"['name'] = '"+str(interface)+"'") + exec("self.net_"+str(num)+"['bytes_sent'] = '"+str(human_size(interface_usage[interface].bytes_sent))+"'") + exec("self.net_"+str(num)+"['bytes_recv'] = '"+str(human_size(interface_usage[interface].bytes_recv))+"'") ip_pattern = re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") if ip_pattern.match(detail.address): exec("self.net_"+str(num)+"['address_v4'] = '"+str(detail.address)+"'") diff --git a/templates/index.html b/templates/index.html index 0e37c14..744d173 100644 --- a/templates/index.html +++ b/templates/index.html @@ -133,10 +133,10 @@ total : {{ full[key]['size_total'] }} / used : {{ full[key]['size_used'] }} / fr
Name | IPv4 | Netmask v4 | IPv6 | Netmask v6 | ||
Name | IPv4 | Netmask v4 | IPv6 | Netmask v6 | Sent | Received |
{{ full[key]['name'] }} | {{ full[key]['address_v4'] }} | {{ full[key]['netmask_v4'] }} | {{ full[key]['address_v6'] }} | {{ full[key]['netmask_v6'] }} | ||
{{ full[key]['name'] }} | {{ full[key]['address_v4'] }} | {{ full[key]['netmask_v4'] }} | {{ full[key]['address_v6'] }} | {{ full[key]['netmask_v6'] }} | {{ full[key]['bytes_sent'] }} | {{ full[key]['bytes_recv'] }} |