[pve-devel] [PATCH 3/9] api2tool : extract_vm_stats : add template value

Alexandre Derumier aderumier at odiso.com
Tue Jan 15 10:01:03 CET 2013


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

diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index bdf20a8..97d9f52 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -2,6 +2,7 @@ package PVE::API2Tools;
 
 use strict;
 use warnings;
+use PVE::SafeSyslog;
 
 sub extract_node_stats {
     my ($node, $members, $rrd) = @_;
@@ -40,6 +41,24 @@ sub extract_vm_stats {
 	type => $data->{type},
     };
 
+
+    if (my $d = $rrd->{"pve2.3-vm/$vmid"}) {
+	$entry->{uptime} = ($d->[0] || 0) + 0;
+	$entry->{name} = $d->[1];
+	$entry->{template} = $d->[2];
+
+	$entry->{maxcpu} = ($d->[4] || 0) + 0;
+	$entry->{cpu} = ($d->[5] || 0) + 0;
+	$entry->{maxmem} = ($d->[6] || 0) + 0;
+	$entry->{mem} = ($d->[7] || 0) + 0;
+	$entry->{maxdisk} = ($d->[8] || 0) + 0;
+	$entry->{disk} = ($d->[9] || 0) + 0;
+	$entry->{netin} = ($d->[10] || 0) + 0;
+	$entry->{netout} = ($d->[11] || 0) + 0;
+	$entry->{diskread} = ($d->[12] || 0) + 0;
+	$entry->{diskwrite} = ($d->[13] || 0) + 0;
+  };
+
     if (my $d = $rrd->{"pve2-vm/$vmid"}) {
 
 	$entry->{uptime} = ($d->[0] || 0) + 0;
-- 
1.7.10.4




More information about the pve-devel mailing list