We already have seen how to enable insights on the virtual machine to monitor metrics from Guest OS. In this article, we will try to create a simple dashboard to demonstrate how the log queries can be utilized to visualize the metrics.
What are Azure Dashboards ?
Azure Dashboards provide a comprehensive, organized view of Cloud resources in Azure Portal. You can use dashboards as workspaces, each of these workspaces can be used for your day to day tasks of operations and monitoring the resources.
Azure portal provides a default dashboard, which can be edited as per your needs. You can also create custom dashboards. In this article, we are going to create a new dashboard which will show data of a log query.
To complete the example in this tutorial, you must have an existing virtual machine connected to the Log Analytics workspace.
Login to Azure Portal and select Dashboard from the left navigation. This should open a panel as shown in below snapshot. Then click on New dashboard button.
The above action would create an empty dashboard. The new panel would show the dashboard in edit mode, meaning you can edit the name of dashboard and/or can insert or arrange the new tiles.
Let’s the name of dashboard as
Virtual Machines Dashboard - Sample and then click on Done customizing button.
By default this dashboard is private, meaning only you can see it. If you want this dashboard to appear alongside the commands, click on Share button. This would open a new panel as shown below:
Select appropriate dashboard, subscription and location in the new panel. Ensure that the check box is selected. Then click on Publish button.
Now, let’s go to the Azure Portal and search for
Monitor in portal and select Logs from left navigation. Make sure appropriate Log Analytics Workspace is selected for analysis.
Then run below query. This query will show the free disk space metrics value averaged over 10 min duration.
|| where Namespace contains "LogicalDisk" and Name contains "FreeSpacePercentage"|
|| summarize AggregatedValue = avg(Val) by bin(TimeGenerated, 10m), Computer|
|| render timechart|
It should render a line chart as shown in the below snapshot:
Pin to Dashboard
On the query editor, there is an option Pin to dashboard, which we will use to put these results on the dashboard.
Once Pin to dashboard button is clicked, a new panel will open on right hand side. It will show input list boxes to select subscriptions and resource groups. Make sure valid subscriptions and all resource groups are selected.
Gotcha: Points to Remember
- Make sure that the dashboard is published
- Make sure that you have assigned Role Assignment (Contributor role) to the Azure Portal login
- If you have performed both steps and the dashboard is still not visible, then try to log out and login to reflect the role permissions.