Jump to content
Welcome to our new Citrix community!
  • 0

Could not retrieve "CPU utilisatiion" by Citrix XenServer Management API


wei qin

Question

Citrix support staff let me raise question here for asking  Citrix experts and developers' help. I try to describe my problem clearly, thanks in advance.

 

I used the com.xensource.xenapi.HostCpu  which is from Citrix XenServer Management API (xenserver-6.0.0.jar) to get XenServer 7.1Cu2 env's CPU related information such as the vendor of the physical CPU(HostCPU.vendor), the speed of the physical CPU(HostCPU.speed) , the model name of the physical CPU(HostCPU.modelname) and also including the current CPU utilisation(HostCPU.utilisation). Most attributes can get the correct values in the following JAVA code, but for CPU utilisation, it's always null.

And I also find many attributes related to memory used/total size , net work in/out throughput etc. could not get the correct values. 

 

 

A piece of my JAVA code:

-----------------------------------------------------

……

import com.xensource.xenapi.HostCpu;

……

public IAttributeGroupRecord mapRecord(HostCpu.Record record, Connection connection) throws Types.XenAPIException, XmlRpcException {

  ……

   attributeGroupRecord.add(str(record.model));

   attributeGroupRecord.add(str(record.modelname));

   attributeGroupRecord.add(str(record.speed));

   attributeGroupRecord.add(str(record.stepping));

   attributeGroupRecord.add(str(MessageFormat.format("{0,number,###.##}", record.utilisation), (record.utilisation != null) ));

   attributeGroupRecord.add(str(record.vendor));

   ……

   return attributeGroupRecord;

 }

---------------------------------------------------

My env information are:

XenServer version : 7.1 Cu2

XenServer JAVA SDK : xenserver-6.0.0-1.jar along with xmlrpc-client-3.1.3.jar and xmlrpc-common-3.1.3.jar

 

Thanks

 

 

 

Link to comment

4 answers to this question

Recommended Posts

  • 0
On 12/16/2020 at 8:21 PM, Tobias Kreidl said:

Probably the old code is incompatible with the newer XenServer / Citrix Hypervisor releases would be my first guess.

Yes, I thought so too at first,  but the XenServer is 7.1 Cu2, and on page 303 of  Citrix XenServer Management API Revision 2.6  https://docs.citrix.com/en-us/xenserver/7-1/downloads/management-api-guide.pdf   which is XenServer 7.1(LTSR) doc, we can see it should be supported.

That's why I eager to get help or suggestions from Citrix, if it's a bug or issue.

 

Thanks

Link to comment
  • 0
On 1/1/2021 at 2:02 AM, Tobias Kreidl said:

The syntax didn't change, did it?

No any change for long time. And those attributes such as the vendor of the physical CPU(HostCPU.vendor), the speed of the physical CPU(HostCPU.speed) , the model name of the physical CPU(HostCPU.modelname) and so on can still get correct value...

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...