Forum Discussion
Bharath Karumudi
Jun 19, 2018Copper Contributor
Heartbeat Azure Monitoring the VM - piechart
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...
Evgeny Ternovsky
Microsoft
Jun 20, 2018You'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!