【Azure 事件中心】通过 az rest --method get 如何获得Event Hub Entity 级的统计指标

问题描述

通过 az rest --method get  如何获得Event Hub Entity 级的统计指标?

 

问题解答

查阅文档  https://learn.microsoft.com/en-us/rest/api/monitor/metrics/list?tabs=HTTP ,  可以通过 filter 参数指定 EntityName eq '*'  或者 EntityName eq '<entity-name>'

 

Windows系统的CMD中,使用AZ CLI测试:

复制代码
# EntityName eq '*'
az rest --debug --method get --url "/subscriptions/<your subscription id>/resourceGroups/<your resource group>
/providers/Microsoft.EventHub/namespaces/<event-hub-name>/providers/microsoft.Insights/metrics?
timespan=2022-08-31T07:03:32.960Z/2022-08-31T07:57:34.794Z
&interval=PT5M&metricnames=IncomingRequests&aggregation=total
&metricNamespace=microsoft.eventhub%2Fnamespaces&top=10
&orderby=total desc&
$filter=EntityName eq '*'
&api-version=2019-07-01
" # EntityName eq 'entity-name' az rest --method get --url "/subscriptions/<your subscription id>/resourceGroups/<your resource group>
/providers/Microsoft.EventHub/namespaces/<event-hub-name>/providers/microsoft.Insights/metrics?
timespan=2022-08-31T07:03:32.960Z/2022-08-31T07:57:34.794Z
&interval=PT5M&metricnames=IncomingRequests&aggregation=total
&metricNamespace=microsoft.eventhub%2Fnamespaces&top=10
&orderby=total desc
&$filter=EntityName eq 'kafka-test'
&api-version=2019-07-01
"
复制代码

Linux系统中,需要对url参数中的$filter进行转义,变为 $filter 。 

复制代码
az rest --debug --method get --url "/subscriptions/<your subscription id>/resourceGroups/<your resource group>
/providers/Microsoft.EventHub/namespaces/<event-hub-name>/providers/microsoft.Insights/metrics?
timespan=2022-08-31T07:03:32.960Z/2022-08-31T07:57:34.794Z
&interval=PT1M
&metricnames=SuccessfulRequests
&aggregation=total
&metricNamespace=microsoft.eventhub%2Fnamespaces
&top=10
&orderby=total asc
&\$filter=EntityName eq 'kafka-test'
&api-version=2019-07-01
"

复制代码

 

参考资料

Metrics - List:https://learn.microsoft.com/en-us/rest/api/monitor/metrics/list?tabs=HTTP

 
posted @   路边两盏灯  阅读(21)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示