Forum Discussion
lobryan2023
Sep 06, 2023Copper Contributor
Looking for VM Availability Percentage
I'm trying to make a logic app that will report the percentage availability of all of my VMs over a week. I have a log analytics query that gives me the availability of each server over a week, but ...
Clive_Watson
Sep 07, 2023Bronze Contributor
Maybe?
let weeklyTotalAverage = toscalar(
Heartbeat
| where Computer has ""
| where TimeGenerated > ago(7d)
| summarize heartbeatPerHour = count() by bin_at(TimeGenerated, 1m, ago(1d)), Computer
| extend AvailablePerHour = iff(heartbeatPerHour > 0, true, false)
| summarize TotalAvailableMinutes = countif(AvailablePerHour == true) by Computer
| extend AvailabilityRate = round(TotalAvailableMinutes*100.0/10080, 3)
| project Computer, AvailabilityRate
| summarize weeklyTotalAverage=avg(AvailabilityRate)
);
Heartbeat
| where Computer has ""
| where TimeGenerated > ago(7d)
| summarize heartbeatPerHour = count() by bin_at(TimeGenerated, 1m, ago(1d)), Computer
| extend AvailablePerHour = iff(heartbeatPerHour > 0, true, false)
| summarize TotalAvailableMinutes = countif(AvailablePerHour == true) by Computer
| extend AvailabilityRate = round(TotalAvailableMinutes*100.0/10080, 3)
| project Computer, AvailabilityRate, weeklyTotalAverage=round(weeklyTotalAverage,3)
let weeklyTotalAverage = toscalar(
Heartbeat
| where Computer has ""
| where TimeGenerated > ago(7d)
| summarize heartbeatPerHour = count() by bin_at(TimeGenerated, 1m, ago(1d)), Computer
| extend AvailablePerHour = iff(heartbeatPerHour > 0, true, false)
| summarize TotalAvailableMinutes = countif(AvailablePerHour == true) by Computer
| extend AvailabilityRate = round(TotalAvailableMinutes*100.0/10080, 3)
| project Computer, AvailabilityRate
| summarize weeklyTotalAverage=avg(AvailabilityRate)
);
Heartbeat
| where Computer has ""
| where TimeGenerated > ago(7d)
| summarize heartbeatPerHour = count() by bin_at(TimeGenerated, 1m, ago(1d)), Computer
| extend AvailablePerHour = iff(heartbeatPerHour > 0, true, false)
| summarize TotalAvailableMinutes = countif(AvailablePerHour == true) by Computer
| extend AvailabilityRate = round(TotalAvailableMinutes*100.0/10080, 3)
| project Computer, AvailabilityRate, weeklyTotalAverage=round(weeklyTotalAverage,3)