Well the code to generate diagnostics under xen is in 
nova/virt/xenapi/vm_utils.py:

887     def compile_diagnostics(cls, session, record):
 888         """Compile VM diagnostics data"""
 889         try:
 890             host = session.get_xenapi_host()
 891             host_ip = session.call_xenapi("host.get_record", 
host)["address"]
 892         except (cls.XenAPI.Failure, KeyError) as e:
 893             return {"Unable to retrieve diagnostics": e}
 894 
 895         try:
 896             diags = {}
 897             xml = get_rrd(host_ip, record["uuid"])
 898             if xml:
 899                 rrd = minidom.parseString(xml)
 900                 for i, node in enumerate(rrd.firstChild.childNodes):
 901                     # We don't want all of the extra garbage
 902                     if i >= 3 and i <= 11:
 903                         ref = node.childNodes
 904                         # Name and Value
 905                         if len(ref) > 6:
 906                             diags[ref[0].firstChild.data] = \
 907                                 ref[6].firstChild.data
 908             return diags
 909         except cls.XenAPI.Failure as e:
 910             return {"Unable to retrieve diagnostics": e}
 911 

Example RRD is here: http://community.citrix.com/display/xs/Using+XenServer+RRDs

Perhaps someone could paste the actual data from an install running xen so we 
can see what the extracted data looks like?

Then it is as easy as adding a call like the following to 
nova/virt/libvirt/connection.py:

def get_diagnostics(self, instance_name):
  # look up the domain by instance name
  virt_dom = self._lookup_by_name(instance_name)
  # get info from the domain using libvirt calls
  # map the data into the proper dictionary format
  # return the data
  return diag

Vish

On Jan 26, 2012, at 2:56 AM, Leander Bessa wrote:

> Could you give me some references on how i could implement the diagnostics 
> call for kvm/libvirt?
> 
> Regards,
> 
> Leander
> 
> On Wed, Jan 25, 2012 at 7:39 PM, Vishvananda Ishaya <vishvana...@gmail.com> 
> wrote:
> There are currently no plans for such of thing. It seems easier to rely on 
> existing plugins for monitoring.  That said, it shouldn't be too hard to 
> implement the diagnostics call for kvm/libvirt if someone wants to tackle it.
> 
> Vish
> 
> On Jan 25, 2012, at 8:21 AM, Leander Bessa wrote:
> 
>> Are there any plans to add support for monitoring instances which run 
>> libvirt? Does XEN also use libvirt?
>> 
>> On Wed, Jan 25, 2012 at 2:01 PM, Leander Bessa <leande...@gmail.com> wrote:
>> Ok i'll look into that, thank you for the answers.
>> 
>> Regards,
>> 
>> Leander
>> 
>> 
>> On Tue, Jan 24, 2012 at 11:16 PM, Vishvananda Ishaya <vishvana...@gmail.com> 
>> wrote:
>> Monitoring can be done through libvirt monitoring plugins.  For example:
>> 
>> http://honk.sigxcpu.org/projects/libvirt/
>> 
>> Vish
>> 
>> On Jan 24, 2012, at 2:01 PM, Leander Bessa wrote:
>> 
>>> How exactly do i install that particular extension and what can i use as an 
>>> alternative to monitor instances with KVM?
>>> 
>>> 
>>> On Tue, Jan 24, 2012 at 6:11 PM, Kiall Mac Innes <ki...@managedit.ie> wrote:
>>> I've just verified this against my install, but since the diagnostics is 
>>> unsupported when using libvirt/kvm, it still errors out (but with a 500, 
>>> rather than 404)
>>> 
>>> Thanks,
>>> Kiall
>>> 
>>> 
>>> 
>>> On Tue, Jan 24, 2012 at 5:56 PM, Brian Waldon <brian.wal...@rackspace.com> 
>>> wrote:
>>> Actually the diagnostics command was not added in Essex, but it was 
>>> converted to a true extension. However it is part of the Admin API, which 
>>> means for Diablo you need to set the allow_admin_api flag on your nova-api 
>>> node.
>>> 
>>> 
>>> On Jan 24, 2012, at 9:41 AM, Kiall Mac Innes wrote:
>>> 
>>>> Hi,
>>>> 
>>>> The diagnostics command was added in Essex, my packages are using the 
>>>> stable Diablo version.
>>>> 
>>>> Novaclient sadly shows these options even though they can't be used with 
>>>> Diablo.
>>>> 
>>>> Kiall
>>>> 
>>>> Sent from my mobile - Sorry for being short.
>>>> 
>>>> On Jan 24, 2012 5:04 p.m., "Leander Bessa" <leande...@gmail.com> wrote:
>>>> Hello,
>>>> 
>>>> I've setup a single node configuration with keystone using the packages 
>>>> from https://launchpad.net/~managedit/+archive/openstack.
>>>> 
>>>> I've managed to launch an instance, however when i run the commando nova 
>>>> diagnostics <server> i get this:
>>>> 
>>>> REQ: curl -i http://127.0.0.1:5000/tokens -X POST -H "Content-Type: 
>>>> application/json" -H "User-Agent: python-novaclient"
>>>> 
>>>> REQ BODY: {"auth": {"tenantName": "admin", "passwordCredentials": 
>>>> {"username": "admin", "password": "admin"}}}
>>>> 
>>>> RESP:{'date': 'Tue, 24 Jan 2012 16:56:24 GMT', 'status': '200', 
>>>> 'content-length': '1119', 'content-type': 'application/json; 
>>>> charset=UTF-8'} {"access": {"token": {"expires": "2015-02-05T00:00:00", 
>>>> "id": "999888777666", "tenant": {"id": "1", "name": "admin"}}, 
>>>> "serviceCatalog": [{"endpoints": [{"adminURL": 
>>>> "http://127.0.0.1:8774/v1.1/1";, "region": "RegionOne", "internalURL": 
>>>> "http://127.0.0.1:8774/v1.1/1";, "publicURL": 
>>>> "http://127.0.0.1:8774/v1.1/1"}], "type": "compute", "name": "nova"}, 
>>>> {"endpoints": [{"adminURL": "http://127.0.0.1:8774/v1.0";, "region": 
>>>> "RegionOne", "internalURL": "http://127.0.0.1:8774/v1.0";, "publicURL": 
>>>> "http://127.0.0.1:8774/v1.0/"}], "type": "compute", "name": 
>>>> "nova_compat"}, {"endpoints": [{"adminURL": 
>>>> "http://127.0.0.1:9292/v1.1/1";, "region": "RegionOne", "internalURL": 
>>>> "http://127.0.0.1:9292/v1.1/1";, "publicURL": 
>>>> "http://127.0.0.1:9292/v1.1/1"}], "type": "image", "name": "glance"}, 
>>>> {"endpoints": [{"adminURL": "http://127.0.0.1:35357/v2.0";, "region": 
>>>> "RegionOne", "internalURL": "http://127.0.0.1:5000/v2.0";, "publicURL": 
>>>> "http://127.0.0.1:5000/v2.0"}], "type": "identity", "name": "identity"}], 
>>>> "user": {"id": "1", "roles": [{"tenantId": "1", "id": "1", "name": 
>>>> "Admin"}, {"id": "1", "name": "Admin"}], "name": "admin"}}}
>>>> 
>>>> REQ: curl -i http://127.0.0.1:8774/v1.1/1/servers/3/diagnostics -X GET -H 
>>>> "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H 
>>>> "X-Auth-Token: 999888777666"
>>>> 
>>>> REQ: curl -i http://127.0.0.1:8774/v1.1/1/servers/3/diagnostics -X GET -H 
>>>> "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H 
>>>> "X-Auth-Token: 999888777666"
>>>> 
>>>> RESP:{'date': 'Tue, 24 Jan 2012 16:56:24 GMT', 'status': '404', 
>>>> 'content-length': '52', 'content-type': 'text/plain; charset=UTF-8'} 404 
>>>> Not Found
>>>> 
>>>> The resource could not be found.
>>>> 
>>>>    
>>>> 
>>>> RESP:{'date': 'Tue, 24 Jan 2012 16:56:24 GMT', 'status': '404', 
>>>> 'content-length': '52', 'content-type': 'text/plain; charset=UTF-8'} 404 
>>>> Not Found
>>>> 
>>>> The resource could not be found.
>>>> 
>>>>  
>>>> n/a (HTTP 404)
>>>> 
>>>> 
>>>> Any ideas?
>>>> 
>>>> Regards,
>>>> 
>>>> Leander
>>>> 
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~openstack
>>>> Post to     : openstack@lists.launchpad.net
>>>> Unsubscribe : https://launchpad.net/~openstack
>>>> More help   : https://help.launchpad.net/ListHelp
>>>> 
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~openstack
>>>> Post to     : openstack@lists.launchpad.net
>>>> Unsubscribe : https://launchpad.net/~openstack
>>>> More help   : https://help.launchpad.net/ListHelp
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~openstack
>>> Post to     : openstack@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~openstack
>>> More help   : https://help.launchpad.net/ListHelp
>> 
>> 
>> 
> 
> 

_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to     : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp

Reply via email to