java - 通过 Java SDK 的 Azure VM 指标

标签 java azure azure-active-directory azure-virtual-machine azure-monitoring

// get metric definitions for storage account.
  for (MetricDefinition  metricDefinition : azure.metricDefinitions().listByResource(storageAccount.id())) {

Azure github此示例用于获取存储帐户的指标。我正在努力寻找有关应将哪些内容作为参数传递给 listByResource() 以获取 VM 指标(例如 Network In 指标)的引用?感谢任何意见。

最佳答案

首先,如果您想获取Azure Monitor支持的指标,您可以使用它来查询记录。您还可以在 sample code 中找到它.

MetricCollection metricCollection = metricDefinition.defineQuery()
                        .startingFrom(recordDateTime.minusDays(7))
                        .endsBefore(recordDateTime)
                        .withAggregation("Average")
                        .withInterval(Period.minutes(5))
                        .withOdataFilter("apiName eq 'PutBlob' and responseType eq 'Success' and geoType eq 'Primary'")
                        .execute();

方法说明可以引用 this site .

至于VM NetWork指标,我认为官方文档中不支持它:Supported metrics with Azure Monitor on Azure Stack ,它列出了 Azure Monitor 支持的指标。对于 Microsoft.Compute/virtualMachines,它仅支持 CPU 百分比指标。

关于java - 通过 Java SDK 的 Azure VM 指标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55868275/

相关文章:

java - 字符输出错误

python - 在 Apache Hadoop 上扩展 python mrjob 程序

c# - 从 C# 应用程序查询 Azure Log Analytics

java - 在循环中重新创建ExecutorService以进行批处理

java - Hibernate 标准,两个实体

Java 在没有 IDE 的情况下运行外部 jar 吗?

azure - Azure 中的机器学习 : How do I publish a pipeline to the workspace once I've already built it in Python using the SDK?

c# - Azure Keyvault 停止在 IIS 托管站点上工作

asp.net-mvc - token 获取过程中未找到缓存 token

powershell - "Unexpected Error"使用 Connect-MsolService -AccessToken 连接到 Azure AD