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

Re: [Xen-API] Error with VIF_METRICS



Hello

That's exactly I did..

But no success..
To get the VIF metrics now I'm doing a CURL at /vm_rrd ..

Is that a right way do get the VIF metrics stats?

How can I get the assigned IP for this Interface? (by xencenter I can see the IP, but and with API, how?)

Thanks

Em 28/06/2012 05:44, John Else escreveu:

Hi Luiz,

 

The VIF_metrics is a separate object from the VIF itself – my perl is not very good, but in python I’d do something like this:

 

vms = session.xenapi.VM.get_all()

 

for vm in vms:

                vm_record = session.xenapi.VM.get_record(vm)

                if record[“is_a_template”] == False and record[“is_control_domain”] == False:

                                for vif in vm_record[“VIFs”]:

                                                metrics = session.xenapi.VIF.get_metrics(vif)

                                                if metrics != “OpaqueRef:NULL”:

                                                                metrics_record = session.xenapi.VIF_metrics.get_record(metrics)

                                                                # do something with metrics_record…

 

John

 

From: xen-api-bounces@xxxxxxxxxxxxx [mailto:xen-api-bounces@xxxxxxxxxxxxx] On Behalf Of Luiz Roberto
Sent: 25 June 2012 16:02
To: xen-api@xxxxxxxxxxxxx
Subject: [Xen-API] Error with VIF_METRICS

 

Hello everybody,

I need to get VIF_metrics from a specific VM and I got a problem while trying to do that.

(HANDLE_INVALID VIF_metrics OpaqueRef:f71830ff-301b-77a8-37e9-f4c4aaa2905b)

It is very strange, I never got this error before.
Take a look on my code:

$vms_array = $xenserver->VM_get_all();

foreach ($vms_array as $vm) {
    $record = $xenserver->VM_get_record($vm);
    if($record['is_a_template']==false && $record['is_control_domain']==false) {

        var_dump($record['VIFs']); //Return :  0 => string 'OpaqueRef:f71830ff-301b-77a8-37e9-f4c4aaa2905b' (length=46)

        foreach($record['VIFs'] as $vif) {
            $metrics = $xenserver->__call('VIF_metrics.get_record',array($vif) ));
            var_dump($metrics);
        }
    }
}

I tried many values as parameter but no success...

Anybody here knows what is this problem?
Thanks



_______________________________________________
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®.