Exercise - Configure the Azure Diagnostics extension
The last time your band went on tour, your website went down while your fans were trying to buy tickets. You're not sure if the web server ran out of memory, or if the virtual machine (VM) wasn't the right size. For your new tour, you'd like a dashboard to keep track of the VM's traffic, memory, and CPU usage.
In this exercise, you install the Azure Monitor Agent on your new VM to collect near real-time metrics at the guest OS level. After you install the agent, you create a KPI dashboard to view the new metrics being captured.
Install the Azure Monitor agent by using data collection rules
In the Azure portal, search for Monitor.
Under Settings, select Data Collection Rules.
Select Create.
Enter the following values.
Setting Value Rule Name MyPerformanceMetrics Subscription Your subscription Resource group Resource group that contains the VM Region Region where the VM is located Platform Type Linux On the Resources tab, select Add resources.
On the Select a scope pane, select the monitored-linux-vm VM you created, and select Apply.
Review the result on the Resources tab.
On the Collect and deliver tab, select Add data source to configure the data to be collected and the destination to send it to.
You have different configuration options depending on the OS installed on the VM. At the basic level, these options are performance counters (CPU, Memory, Disk and Network) which can be sent to Azure Monitor Metrics and/or Azure Monitor Logs. However, you can also choose to collect custom metrics like percentage of free disk space on Windows, or the amount of swap available on Linux.
For Data source type, select Performance Counters.
Change the Sample rate (seconds) for each counter to 60.
Select the Destination tab to view the default destination for Performance Counters, Azure Monitor Metrics.
Confirm your settings include a destination type of Azure Monitor metrics.
On the bottom of the pane, select Add data source.
Select Review and create > Create. This command installs the Azure Monitor Agent on the selected VM, and starts data collection with the parameters defined in the rule you created.
Confirm that the agent is installed on the VM
In the Azure portal, search for and select Virtual Machines.
Select the virtual machine you created in the previous exercise.
On the VM overview page, under Extensions, you should see AzureMonitorLinuxAgent listed.
Create a custom KPI dashboard
In the left menu pane, under Monitoring, select Metrics. The Metrics pane appears for your VM.
Select the following values:
Setting Value Metric Namespace azure.vm.linux.guestmetrics Metric net/bytes_total Aggregation Max If the metric namespace azure.vm.linux.guestmetrics isn't listed, wait a few minutes and try again.
Select the Finish editing metric check mark.
At the top right of the chart, select Save to dashboard > Pin to dashboard. The Pin to dashboard pane appears.
Select the Create new tab.
For Type, select Private. If you're using your own subscription, you can create a shared dashboard.
In the Dashboard name field, enter KPI Dashboard.
Select Create and pin. The Metrics pane reappears.
Add a free memory percentage graph
In the top menu bar, select New chart.
Select the following values:
Setting Value Metric Namespace azure.vm.linux.guestmetrics Metric mem/available_percent Aggregation Max Select the Finish editing metric check mark.
At the top right of the chart, select Save to dashboard > Pin to dashboard. The Pin to dashboard pane appears.
In the Dashboard dropdown field, select KPI Dashboard.
Select Pin. The Metrics pane for your VM reappears.
Add a CPU usage graph
Select New chart.
Select the following values:
Setting Value Metric Namespace azure.vm.linux.guestmetrics Metric cpu/usage_active Aggregation Max Select the Finish editing metric check mark.
At the top right of the chart, select Save to dashboard > Pin to dashboard.
In the Dashboard dropdown field, select KPI Dashboard.
Select Pin. The Metrics pane for your VM reappears.
View the new dashboard
Need help? See our troubleshooting guide or provide specific feedback by reporting an issue.