Jun 19 2018
12:56 PM
- last edited on
Apr 07 2022
05:12 PM
by
TechCommunityAP
Jun 19 2018
12:56 PM
- last edited on
Apr 07 2022
05:12 PM
by
TechCommunityAP
I am trying to create a visualization on VMs to monitor whether they are up and running or not on a pie chart. I came upto below extent, but how to visualize the numbers - if I have a total of 10 VMs and if 8 are up and 2 are down on pie?
Also, how to handle "0 records matched" case instead of showing "No data for the given query" ?
Heartbeat
| summarize max(TimeGenerated) by Computer
| where max_TimeGenerated < ago(15m)
| render piechart
Jun 20 2018 05:01 PM
You'll need to specify how you want your data aggregated before you plot it. In this case, try the following (rather verbose, to show the thinking process) query:
let healthyVMCountWindow = 30m; //time window we want to look at to identify how many healthy VMs we have let healthyVMs = (){ //list healthy VMs over time window above Heartbeat | where TimeGenerated > ago(healthyVMCountWindow) | distinct Computer }; let totalVMCountWindow = 1d; //time window we want to look at to identify how many VMs we have in total Heartbeat | where TimeGenerated > ago(totalVMCountWindow) | distinct Computer | extend isHealthy = iff(Computer in (healthyVMs), "healthy", "unhealthy") //create a new column called "isHealthy" where we will classify our machines | summarize count() by isHealthy | render piechart
Try it out on our demo environment, here!