查询收集到的数据
我们可以使用如下查询语句,查询内存剩余内存小于1024MB的服务器:
let setMBValue = 1024;
let startDate = ago(12h);
// enter how many days/hours to look back on
Perf
| where TimeGenerated > startDate
| where ObjectName == "Memory" and CounterName == "Available MBytes Memory" and Computer in ((Heartbeat
| distinct Computer))
| extend FreeMemory = CounterValue
| summarize FreeMemoryMB = min(FreeMemory) by Computer
| where FreeMemoryMB < setMBValue
| summarize max(FreeMemoryMB) by Computer
| join
(
Perf
| where TimeGenerated > startDate
| where ObjectName == "Memory" and CounterName == "Available MBytes Memory" and Computer in ((Heartbeat
| distinct Computer))
| extend FreeMemory = CounterValue
)
on Computer
| make-series Free_Memory_MB = min(FreeMemory) on TimeGenerated from ago(8h) to now() step 2h by Computer
| render timechart
创建Alert
如果我们想要设置邮件,短信等报警规则,可以通过“+ New alert rule”来创建:
创建完成Alert以后,当系统的可用内存低于1024MB时,我们就会收到警报:
将性能图表固定到仪表板
统一我们也可以通过点击查询窗口右上方的“固定”按钮,然后选择我们要将图标展示在那个Dashboard,来将查询结果展示到Azure Dashboard: