Kusto查询,选择5分钟的时间间隔并计算平均值。

huangapple go评论78阅读模式
英文:

Kusto Query, selecting an interval of 5 minutes and calculate the average

问题

我相对较新于Kusto查询语言,所以也许这是一些非常常见的东西,但我真的找不到我的答案。所以让我们开始。

我已经在一些服务器上启用了Azure Log Analytics的性能数据收集,并希望实现以下目标:

从Perf数据集中,选择前一天的所有CPU数据,并显示每5分钟的平均CPU利用率。现在我已经弄清楚了第一部分,这真的很容易做到。但是我无法弄清楚如何在Kusto中进行每5分钟的选择。我猜想可能需要使用"summarise"?有人可以分享一些见解吗?

Perf
| where Computer == "servername.domain.internal"
| where TimeGenerated > ago(1d) 
| where CounterName == "% Processor Time" 
| where ObjectName == "Processor Information"
| summarize AvgCPU = avg(CounterValue) by bin(TimeGenerated, 5m)

上述查询将按照每5分钟的时间窗口对CPU利用率进行平均,并将结果存储在"AvgCPU"列中。

英文:

I'm fairly new to the Kusto Query language so perhaps this is something very common, but I really can't find my answer. So here goes.

I've enabled performance gathering with Azure Log Analytics on some of our servers and would like to achieve the following:

From the Perf dataset, select all the CPU data from the previous day and display the average CPU utilization per 5 minutes. Now I've figured out the first part, which was really easy to do. However I can't figure out how to do the per 5 minute selection in Kusto. I'm guessing something with summarise? Can anyone share some insights?

Perf
| where Computer == "servername.domain.internal"
| where TimeGenerated > ago(1d) 
| where CounterName == "% Processor Time" 
| where ObjectName == "Processor Information" 

答案1

得分: 9

尝试将 | summarize avg(CounterValue) by bin(Time Generated, 5m) 添加到您的查询中。

对于图表,您还可以在后面添加 | render timechart

英文:

Try adding | summarize avg(CounterValue) by bin(Time Generated, 5m) to your query.

For charting, you can also append a | render timechart to the latter.

huangapple
  • 本文由 发表于 2020年1月3日 20:29:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/59578681.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定