Feb 10 2020
- last edited on
Apr 08 2022
I am looking for KQL query to check Disk space utilization in GB(14h)for every VM hosted on azure in and also looking for KQL query to check server up-time for past 14h.
Any help would be appreciated.
Thanks in advance !!
Feb 10 2020 07:39 AM
For uptime you have the built-in example - its called "Availability Rate" you see it when you open a new Query Tab. This is for the Agent uptime
// Availability rate // Calculate the availability rate of each connected computer Heartbeat // bin_at is used to set the time grain to 1 hour, starting exactly 24 hours ago | summarize heartbeatPerHour = count() by bin_at(TimeGenerated, 1h, ago(24h)), Computer | extend availablePerHour = iff(heartbeatPerHour > 0, true, false) | summarize totalAvailableHours = countif(availablePerHour == true) by Computer | extend availabilityRate = totalAvailableHours*100.0/24
System Uptime is also a Perf counter - like this (if yuou are collecting this counter)
Perf | where ObjectName == "System" and CounterName == "System Up Time" | extend UpTime = CounterValue * 1s | summarize arg_max(TimeGenerated, *) by Computer | project Computer, UpTime, TimeGenerated | sort by Computer asc | project Computer, UpTime, TimeGenerated
For disk space please start here: https://techcommunity.microsoft.com/t5/azure-log-analytics/help-with-disk-query-in-log-analytics/m-p...