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

[Xen-API] Re: Problems in extracting VIF metrics



Hi Abhijeet,

As Alberto mentioned, you should be using the RRD interface rather than looking 
at the VIF metrics. There's documentation about that
on the wiki:

http://wiki.xensource.com/xenwiki/XAPI_RRDs

Jon

On 5 Mar 2010, at 11:20, Sane, Abhijeet wrote:

> Hi ,
> 
> I am trying to extract VIF metrics data of all the VMs on a Citrix Xen host.
> I wrote the code as follows to iterate the VIF sets in all VMs and from the 
> VIF record of each VIF get the VIF metrics.
> The VIF metrics like I/O read / write rates are not available.
> 
> Please guide whether I am doing something wrong.
> 
> 
>       session = XenAPI.xapi_local(
>       session.xenapi.login_with_password("root","")
>       all = session.xenapi.VM.get_all()
>        try:
> 
>                for vm in all:
>                        try:
>                                record = session.xenapi.VM.get_record(vm)
>                                if  not record["is_control_domain"] and  not 
> record["is_a_template"] and record["resident_on"]
> :
>                                        domid = record["domid"]
>                                        name = record["name_label"]
>                                        vif_set = 
> session.xenapi.VM.get_VIFs(vm)
>                                        for vif in vif_set:
>                                                               vif_metrics = 
> session.xenapi.VIF.get_metrics(vif)
>                                                vif_rec = 
> session.xenapi.VIF.get_record(vif)
>                                                mac_addr = vif_rec["MAC"]
>                                                metrc =  
> session.xenapi.VIF_metrics.get_record(vif_rec["metrics"])
>                                                               # I have 
> removed the code to extract io_read and io_write at this point of time .
>                                        loca_str =  '%s,%s,%s,%s,%s\n' % 
> (domid , name , mac_addr ,io_read ,io_write)
>                                        csv_string = csv_string + loca_str
> 
>                                domid = ""
>                                name = ""
>                                mac_addr = ""
>                                io_read = ""
>                                io_write = ""
> 
>                        except Exception, e:
>                                print "Exception 1",e
>                                loca_str =  '%s,%s,%s,%s,%s\n' % (domid , name 
> , mac_addr ,io_read ,io_write)
>                                csv_string = csv_string + loca_str
> 
>        except Exception ,e:
>               print "Exception 2",e
>            loca_str =  '%s,%s,%s,%s,%s\n' % (domid , name , mac_addr ,io_read 
> ,io_write)
>            csv_string = csv_string + loca_str
> 
> 
> 
> 
> 
> Program output is as follows
> -------------------------------
> 
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:96f906d4-7826-97cc-c85e-9073a9271b02']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:6b85fae4-3e72-5f7a-7dab-2765ca9fb659']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:754f4f2e-566c-945b-7e60-479c8b19abde']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:fab22cb7-8cee-857f-ad11-77eb7a331717']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:80c3d61b-802f-a4a2-4bd7-dca9c7069766']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:09cd33b9-f1d3-f37c-37df-1e48ed029785']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:f8d0bc81-a695-a471-ac49-e70b2e23da99']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:7583302f-0e7b-8cf3-d1b3-4f661fad30cd']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:29fd1bbf-be28-5481-361d-639c3fcc79a2']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:bac40158-2bbe-7b19-fb9f-8d6435599f12']
> Exception 1 ['HANDLE_INVALID', 'VIF_metrics', 
> 'OpaqueRef:82db2114-6376-43ad-2f06-255841a1a3aa']
> 2,xen-w2k3-v4,de:3a:0c:0e:b0:b2,,
> 1861,xen-w2k3-v7,16:20:b6:0b:05:5c,,
> 1866,win2k8x64,ee:4c:51:d4:d9:3f,,
> 1864,xen-w2k3-v5,46:cf:2f:59:99:4d,,
> 1863,xen-w2k3-v6,62:b6:09:53:aa:f4,,
> 1867,xen-win2k-v3,8a:a7:b9:31:9e:42,,
> 1,xen-winxp-v2,6e:19:cc:4c:73:9f,,
> 4,xen-vm1,ea:6c:34:15:62:6f,,
> 3,xen-vm2,12:4f:f3:2e:62:89,,
> 2,RHEL_5.3_V11,a6:6d:78:97:ee:d3,,
> 1,xen-rlnx53-v1,2a:f9:c4:18:3e:40,,
> 
> 
> 
> 
> 
> 
> Regards
> Abhijeet
> 


_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

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