[pve-devel] [PATCH] qemuserver : vm_status : add extended stats (disks, nics, memory).

Alexandre Derumier aderumier at odiso.com
Mon Jun 15 08:00:30 CEST 2015


Add extended stats results for each nics,disks and memory on full stats mode only.

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index e89308c..caeb65e 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2347,6 +2347,12 @@ sub vmstatus {
 
 	$d->{netout} += $netdev->{$dev}->{receive};
 	$d->{netin} += $netdev->{$dev}->{transmit};
+
+	if ($full) {
+	    $res->{$vmid}->{nics}->{$dev}->{netout} = $netdev->{$dev}->{receive};
+	    $res->{$vmid}->{nics}->{$dev}->{netin} = $netdev->{$dev}->{transmit};
+	}
+
     }
 
     my $ctime = gettimeofday;
@@ -2415,6 +2421,7 @@ sub vmstatus {
 	    $d->{freemem} = $info->{free_mem};
 	}
 
+	$d->{memory} = $info;
     };
 
     my $blockstatscb = sub {
@@ -2425,6 +2432,7 @@ sub vmstatus {
 	for my $blockstat (@$data) {
 	    $totalrdbytes = $totalrdbytes + $blockstat->{stats}->{rd_bytes};
 	    $totalwrbytes = $totalwrbytes + $blockstat->{stats}->{wr_bytes};
+	    $res->{$vmid}->{disks}->{$blockstat->{device}} = $blockstat->{stats};
 	}
 	$res->{$vmid}->{diskread} = $totalrdbytes;
 	$res->{$vmid}->{diskwrite} = $totalwrbytes;
-- 
2.1.4




More information about the pve-devel mailing list