Forum Discussion
stuart355
Jan 21, 2020Copper Contributor
Create a new monitor dashboard
Hi I'm new to Azure and am trying to setup a new dashboard that reports on machines that are online and offline. I think the heartbeat monitor should be used but I am struggling with the details of ...
CliveWatson
Microsoft
Jan 22, 2020
There is a built-in Azure Monitor Workbook (many Dashboards are now moved or are moving to Workbooks) called "Agent Health". All Workbooks can be adapted to suit and you can look at the Log Analytics query as well, for ideas or to adjust.
Also remember HeartBeat isn't necessarily offline / online. e.g. of a machine goes offline without updating the agent there will be no HeartBeat until it comes online again. There is a similar Workbook for VM Availability.
In a Workbook you can also perform an Azure Resource Graph (ARG) query, also based on KQL. See here for a sample workbook: https://techcommunity.microsoft.com/t5/azure-sentinel/azure-sentinel-and-azure-arc/ba-p/999379So for any Azure resource (such as a VM); you can get an immediate status - this is a workbook that shows Security data about a VM as a sample. there is also a ARG example at the end of the post.
This would also show Hybrid and VMs and their status.
From the ARG Explorer (in the Azure Portal)
resources
| where type in( "microsoft.hybridcompute/machines" , "microsoft.compute/virtualmachines")
| extend statusState = trim(' ', tostring(properties.provisioningState))
| project name, type, statusState, subscriptionId
//| summarize count(name) by type
- stuart355Jan 24, 2020Copper Contributor
Thanks]for that. I'm in the Workbooks and see this
Problem is I have no idea what to do next. Could you give some pointers please
Many thanks
- CliveWatsonJan 24, 2020
Microsoft
Ok, try this step by step guide.
Start with the "Agent Health" one, click on it to open it,
After it loads you need to set your Subscription and Workspace from the Parameter drop downs
The main view is quite useful (assuming you have Heartbeat data).
------------------------------------------------
Now if you wanted to update that Workbook. Click on EDIT
Lets now update the Title. There are EDIT buttons located (normally) below each section, so press the one marked.
You can now add some changed Text - press "done Editing" when you have finished with the Text box. Its the [done editing] that relates to the section you want to press, not the overall one at the very top
Now lets use that Azure Resource Graph query I supplied.
Scroll to the bottom, and press "Add Query"
Swap the "data Source" to Azure Resource Graph"
Then paste, this text into the form
resources | where type in( "microsoft.hybridcompute/machines" , "microsoft.compute/virtualmachines") | extend statusState = trim(' ', tostring(properties.provisioningState)) | project name, type, statusState, subscriptionId //| summarize count(name) by type
Next, you need to tell the Query where to get its Data. The Workspace name is on the drop down we used earlier, so set the "Subscriptions" option to "workspace" - essentially, whatever workspace name is selected will be used.
You should get some data back:To make it more readable, let do two things:
1. Un-comment the last line of code, so it looks like this - remove the "//":
resources | where type in( "microsoft.hybridcompute/machines" , "microsoft.compute/virtualmachines") | extend statusState = trim(' ', tostring(properties.provisioningState)) | project name, type, statusState, subscriptionId | summarize count(name) by type
Then press "Run Query"
2. Lets now turn that data into a Pie Chart - click [Visualizations] , and then [Pie Chart]
Press [Done Editing] again, and you should have something like:
Finally, press the top "Done Editing" -
then SAVE - and other details.
You should have something that looks like this.
Does that help, a phase two would be to, maybe have a Drop Down Parameter - that allows you to select a computer you can see by the graph is having issues. e.g.
- stuart355Jan 27, 2020Copper ContributorThanks for that Clive
Looking at the default query for agent health, this is beyond my skills for writing queries. I was hoping there maybe somewhere where I can download templates for things like disk space and memory, or even Azure SQL related queries
Many thanks