[pve-devel] [PATCH manager 1/3] Add support for new rrd definiton
Tobias Böhm
tb at robhost.de
Mon Jun 19 12:10:19 CEST 2017
Look for the new rrd definition version first, so it is prefered to the
previous versions.
Signed-off-by: Tobias Böhm <tb at robhost.de>
---
PVE/API2Tools.pm | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index 9bd4e49d..010d3031 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -65,7 +65,27 @@ sub extract_vm_stats {
my $d;
- if ($d = $rrd->{"pve2-vm/$vmid"}) {
+ if ($d = $rrd->{"pve5.0-vm/$vmid"}) {
+
+ $entry->{uptime} = ($d->[0] || 0) + 0;
+ $entry->{name} = $d->[1];
+ $entry->{status} = $d->[2];
+ $entry->{template} = $d->[3] + 0;
+
+ $entry->{maxcpu} = ($d->[5] || 0) + 0;
+ $entry->{cpu} = ($d->[6] || 0) + 0;
+ $entry->{maxmem} = ($d->[7] || 0) + 0;
+ $entry->{mem} = ($d->[8] || 0) + 0;
+ $entry->{maxdisk} = ($d->[9] || 0) + 0;
+ $entry->{disk} = ($d->[10] || 0) + 0;
+ $entry->{netin} = ($d->[11] || 0) + 0;
+ $entry->{netout} = ($d->[12] || 0) + 0;
+ $entry->{diskread} = ($d->[13] || 0) + 0;
+ $entry->{diskwrite} = ($d->[14] || 0) + 0;
+ $entry->{ioread} = ($d->[15] || 0) + 0;
+ $entry->{iowrite} = ($d->[16] || 0) + 0;
+
+ } elsif ($d = $rrd->{"pve2-vm/$vmid"}) {
$entry->{uptime} = ($d->[0] || 0) + 0;
$entry->{name} = $d->[1];
--
2.11.0
More information about the pve-devel
mailing list