[pve-devel] r5981 - qemu-server/pve2/PVE/API2
svn-commits at proxmox.com
svn-commits at proxmox.com
Mon May 16 10:37:18 CEST 2011
Author: dietmar
Date: 2011-05-16 10:37:18 +0200 (Mon, 16 May 2011)
New Revision: 5981
Modified:
qemu-server/pve2/PVE/API2/Qemu.pm
Log:
add RRD support
Modified: qemu-server/pve2/PVE/API2/Qemu.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu.pm 2011-05-16 08:28:21 UTC (rev 5980)
+++ qemu-server/pve2/PVE/API2/Qemu.pm 2011-05-16 08:37:18 UTC (rev 5981)
@@ -181,11 +181,103 @@
{ subdir => 'status' },
{ subdir => 'unlink' },
{ subdir => 'vncproxy' },
+ { subdir => 'rrd' },
+ { subdir => 'rrddata' },
];
return $res;
}});
+__PACKAGE__->register_method({
+ name => 'rrd',
+ path => '{vmid}/rrd',
+ method => 'GET',
+ protected => 1, # fixme: can we avoid that?
+ permissions => {
+ path => '/vms/{vmid}',
+ privs => [ 'VM.Audit' ],
+ },
+ description => "Read VM RRD statistics (returns PNG)",
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ vmid => get_standard_option('pve-vmid'),
+ timeframe => {
+ description => "Specify the time frame you are interested in.",
+ type => 'string',
+ enum => [ 'hour', 'day', 'week', 'month', 'year' ],
+ },
+ ds => {
+ description => "The list of datasources you want to display.",
+ type => 'string', format => 'pve-configid-list',
+ },
+ cf => {
+ description => "The RRD consolidation function",
+ type => 'string',
+ enum => [ 'AVERAGE', 'MAX' ],
+ optional => 1,
+ },
+ },
+ },
+ returns => {
+ type => "object",
+ properties => {
+ filename => { type => 'string' },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+
+ return PVE::Cluster::create_rrd_graph(
+ "pve2-vm/$param->{vmid}", $param->{timeframe},
+ $param->{ds}, $param->{cf});
+
+ }});
+
+__PACKAGE__->register_method({
+ name => 'rrddata',
+ path => '{vmid}/rrddata',
+ method => 'GET',
+ protected => 1, # fixme: can we avoid that?
+ permissions => {
+ path => '/vms/{vmid}',
+ privs => [ 'VM.Audit' ],
+ },
+ description => "Read VM RRD statistics",
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ vmid => get_standard_option('pve-vmid'),
+ timeframe => {
+ description => "Specify the time frame you are interested in.",
+ type => 'string',
+ enum => [ 'hour', 'day', 'week', 'month', 'year' ],
+ },
+ cf => {
+ description => "The RRD consolidation function",
+ type => 'string',
+ enum => [ 'AVERAGE', 'MAX' ],
+ optional => 1,
+ },
+ },
+ },
+ returns => {
+ type => "array",
+ items => {
+ type => "object",
+ properties => {},
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+
+ return PVE::Cluster::create_rrd_data(
+ "pve2-vm/$param->{vmid}", $param->{timeframe}, $param->{cf});
+ }});
+
+
__PACKAGE__->register_method ({
name => 'vm_config',
path => '{vmid}/config',
More information about the pve-devel
mailing list