[pve-devel] [PATCH 2/2] fix bug #770: Network stats for containers
Wolfgang Link
w.link at proxmox.com
Thu Oct 29 11:11:06 CET 2015
---
src/PVE/LXC.pm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 3ba0e58..d1f9ad5 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -893,6 +893,20 @@ sub vmstatus {
}
}
+ my $netdev = PVE::ProcFSTools::read_proc_net_dev();
+
+ foreach my $dev (keys %$netdev) {
+ next if $dev !~ m/^veth([1-9]\d*)i/;
+ my $vmid = $1;
+ my $d = $list->{$vmid};
+
+ next if !$d;
+
+ $d->{netout} += $netdev->{$dev}->{receive};
+ $d->{netin} += $netdev->{$dev}->{transmit};
+
+ }
+
return $list;
}
--
2.1.4
More information about the pve-devel
mailing list