![](/img/trans.png)
[英]How to get Azure VM reboot and shutdown logs into Azure Log Analytics?
[英]how to get Azure VM last reboot using azure resource graph
我正在使用 azure 资源图来创建仪表板并需要 VM 上次重启或关机日期。 请需要你的帮助。 谢谢
我试图在我的环境中重现相同的内容:
图查询:
Resources
| where type == 'microsoft.compute/virtualmachines'
| summarize count() by PowerState = tostring(properties.extended.instanceView.powerState.code)
尝试以下查询:
resources
| where type has 'microsoft.compute/virtualmachines/extensions'
| where name has 'MicrosoftMonitoringAgent' or name has 'AzureMonitorWindowsAgent'
| extend AzureVM = extract('virtualMachines/(.*)/extensions',1,id), ArcVM = extract('machines/(.*)/extensions',1,id)
|summarize count() by name=tolower(AzureVM), ArcVM=tolower(ArcVM), subscriptionId, resourceGroup, AgentType=name
| extend hasBoth = iff(count_ > 0, 'Yes', 'No')
| join
(
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| project name, properties.extended.instanceView.powerState.displayStatus,
properties.extended.instanceView.powerState.code,
created_ = properties.timeCreated
| order by name desc
) on name
我在哪里创建了 azure 虚拟机运行时间和释放时间。
如果你想在虚拟机停止时发出警报,你可以检查这个: azureportal - Azure 警报在虚拟机停止时通知 - 堆栈内存溢出
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.