简体   繁体   English

使用Java通过Azure API获取CPU使用率

[英]Get CPU usage from Azure API with Java

I have a simply program in Java and I want to get some information from the Windows Azure Service Management REST API Reference : the number of instances and the CPU usage. 我有一个使用Java编写的简单程序,我想从Windows Azure服务管理REST API参考中获取一些信息:实例数和CPU使用率。

For the number of instances, I found what I want but not for the CPU usage. 对于实例数,我找到了想要的,但没有找到CPU使用率。

For the number of instances, I do a Https Get request, the API sends me an XML response and I process this file for the information I need ( Get Hosted Service Properties ). 对于实例的数量,我执行Https Get请求,API向我发送XML响应,然后对该文件进行处理以获取所需的信息( 获取托管服务属性 )。 I don't know if it is possible for the CPU usage too. 我不知道是否也可能使用CPU。 For now, I didn't find anything in the msdn site or with Google. 目前,我在msdn站点或Google中都找不到任何内容。

Someone can help me please? 有人可以帮我吗?

One remarks : I can't test anything regarding the Azure API because my account is disabled so I would have to trust you until my account is available again. 备注:由于我的帐户被禁用,因此我无法测试任何有关Azure API的内容,因此我必须信任您,直到我的帐户再次可用为止。

In order to retrieve CPU utilization or other performance counters, you need to access WADPerformanceCountersTable in the storage account that is setup to store diagnostic data. 为了检索CPU利用率或其他性能计数器,您需要访问设置为存储诊断数据的存储帐户中的WADPerformanceCountersTable。

Here is the help page to help with connecting Java to table storage: http://www.windowsazure.com/en-us/develop/java/how-to-guides/table-service/ 这是帮助页面将Java连接到表存储的帮助页面: http : //www.windowsazure.com/en-us/develop/java/how-to-guides/table-service/

Take a look at SIGAR - System Information Gatherer And Reporter it seems to be a well supported and documented library to gather system information. 看一下SIGAR-System Information Gatherer and Reporter,它似乎是一个受良好支持并记录在案的库,用于收集系统信息。

It has a getCpuUsage function 它具有getCpuUsage函数

Windows Azure SDK for Java is actually open source, if you really want this feature to be built in, you might want to consider contributing to it following its guideline. 适用于Java的Windows Azure SDK实际上是开源的,如果您确实希望内置此功能,则可能需要考虑遵循其准则对其进行贡献。 http://windowsazure.github.io/guidelines.html#contributing http://windowsazure.github.io/guidelines.html#contributing

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM