[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-API] XenAPI & DomU Memory Usage


  • To: Frederik Van Hecke <frederik@xxxxxxxxx>
  • From: Jonathan Ludlam <Jonathan.Ludlam@xxxxxxxxxxxxx>
  • Date: Tue, 1 May 2012 13:57:54 +0100
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Cc: "xen-api@xxxxxxxxxxxxx" <xen-api@xxxxxxxxxxxxx>
  • Delivery-date: Tue, 01 May 2012 12:58:08 +0000
  • List-id: Development list for XCP and Xen API <xen-api.lists.xen.org>
  • Thread-index: Ac0nmggwN2bZLUiFSvCGYNwxywyVyA==
  • Thread-topic: [Xen-API] XenAPI & DomU Memory Usage

You can use the API call 'VM.query_data_source' to query a single RRD data 
source through the API.

e.g.

[root@st21 ~]# python
Python 2.4.3 (#1, Sep 21 2011, 20:06:00) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib
>>> s=xmlrpclib.Server("http://localhost/";)
>>> s.session.login_with_password("root","root")
{'Status': 'Success', 'Value': 'OpaqueRef:1d1f04f1-f01d-a585-6e27-30ee9da3da2f'}
>>> sess='OpaqueRef:1d1f04f1-f01d-a585-6e27-30ee9da3da2f'
>>> vm=s.VM.get_by_uuid(sess,'c4d25869-386d-4238-2bc4-851b021a14e2')['Value']
>>> s.VM.query_data_source(sess,vm,'memory')         
{'Status': 'Success', 'Value': 268435456.0}

This is, of course, only recommended if it's all you want. Don't query all data 
sources on all VMs on all hosts every five seconds like this - use the RRDs :-)

Jon

On 25 Apr 2012, at 14:10, Frederik Van Hecke wrote:

> Hi,
> 
> I'm running XCP 1.5 Beta with xen-tools installed in the DomU.
> Both XenCenter (6.0.2) as xsconsole show the actual memory usage of the VM.
> However the memory record for the vm's guest_metrics is empty.
> 
> I was wondering whether that memory usage is retrievable through the API or 
> not?
> I know it's in the RRD's, but if I can get it through the API that'd be so 
> much more consistent / convenient.
> 
> Any help / direction very much appreciated. Thank you.
> 
> 
> Kind regards,
> Frederik
> _______________________________________________
> Xen-api mailing list
> Xen-api@xxxxxxxxxxxxx
> http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.