【问题标题】:How to get instances count for VMSS in Application Insights?如何在 Application Insights 中获取 VMSS 的实例数?
【发布时间】:2019-01-15 06:53:35
【问题描述】:

我有一个带有自动缩放规则的虚拟机规模集 (VMSS)。我可以获得主机的性能指标,但没有实例计数图表。

VMSS 设置“Scaling”->“Run history”上有一个图表,像这样。

但是我如何从 Metrics 中获取它并放置在仪表板上?

【问题讨论】:

  • 是什么让您认为它可能?为什么应用洞察力会捕获 azure 平台数据?
  • 好的,可能不是 Appinsight,而是 Azure Monitor。目标是将此指标放入Grafana dashboard

标签: azure azure-application-insights autoscaling azure-vm-scale-set azure-monitoring


【解决方案1】:

默认情况下,拥有 VMSS 不会向 Application Insights (AI) 发送任何内容,除非您将应用/平台(例如 Service Fabric)配置为使用 AI。

因此,如果您确实在 VMSS 上运行了向 AI 发射的软件,那么您可以编写 AI analytics query 来获取实例计数,如下所示:

requests
| summarize dcount(cloud_RoleInstance) by bin(timestamp, 1h) 

通常cloud_RoleInstance 包含一个 VM 标识符,因此我在查询中使用了该标识符。它确实显示了不同的虚拟机数量。

仅当软件在 VMSS 中的所有 VM 上运行并且所有 VM 至少每小时向 AI 发送一次数据时,这才可靠。当然,您可以根据自己的喜好/要求调整脚本。

使用的运算符:
dcount:统计指定字段的唯一出现次数
bin:分组结果为 1 小时的时隙

【讨论】:

    【解决方案2】:

    感谢 Peter Bons,这正是我需要的!

    当我在 VM 上运行 Docker 时,我可以添加 OMS 代理容器并使用它的数据。

    这就是我想要的。 ContainerInventory | where TimeGenerated >= ago(3h) | where Name contains "frontend" | summarize dcount(Computer) by bin(TimeGenerated, 5m)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-13
      • 2023-01-07
      • 1970-01-01
      • 2020-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多