Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: API

Error with VIF_METRICS

 

 

Xen api RSS feed   Index | Next | Previous | View Threaded


kiko at luizbossoi

Jun 25, 2012, 8:02 AM

Post #1 of 4 (327 views)
Permalink
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


john.else at citrix

Jun 28, 2012, 1:44 AM

Post #2 of 4 (295 views)
Permalink
Re: Error with VIF_METRICS [In reply to]

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 [at] lists [mailto:xen-api-bounces [at] lists] On Behalf Of Luiz Roberto
Sent: 25 June 2012 16:02
To: xen-api [at] lists
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


kiko at luizbossoi

Jun 28, 2012, 10:06 AM

Post #3 of 4 (298 views)
Permalink
Re: Error with VIF_METRICS [In reply to]

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 [at] lists
> [mailto:xen-api-bounces [at] lists] *On Behalf Of *Luiz Roberto
> *Sent:* 25 June 2012 16:02
> *To:* xen-api [at] lists
> *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
>


Dave.Scott at eu

Jun 29, 2012, 3:48 AM

Post #4 of 4 (285 views)
Permalink
Re: Error with VIF_METRICS [In reply to]

Hi,

I believe the IP is the "VM_guest_metrics" since it comes from the guest agent. Have a look in the "networks" map.

Cheers,

--
Dave Scott
XenServer System Architect

On Jun 28, 2012, at 6:09 PM, "Luiz Roberto" <kiko [at] luizbossoi<mailto:kiko [at] luizbossoi>> wrote:

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 [at] lists<mailto:xen-api-bounces [at] lists> [mailto:xen-api-bounces [at] lists] On Behalf Of Luiz Roberto
Sent: 25 June 2012 16:02
To: xen-api [at] lists<mailto:xen-api [at] lists>
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 [at] lists<mailto:Xen-api [at] lists>
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

Xen api RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.