This article will help you to learn how to configure and manage diagnostics and alerts on Linux Virtual Machine on Azure. To use VM diagnostics you should make sure that Microsoft.Insights resource provider is registered in your subscription which provides you with a list of performance metrics available for capture.
Step 1
From your Azure portal, select Subscriptions from All services tab
Step 2
Select the Subscription you want to work on from the list of subscriptions (Only one will be listed if you are assigned only one subscription to your account)
Step 3
Click on the Resource providers tab of the subscription you selected.
Step 4
Make sure that Microsoft.Insights resource provider is Registered in the list. If not click on register to initiate the registration. It may take several minutes to register the resource provider.
Step 5
From the Portal click on Create a Resource > Storage > Storage account – blob, file, table, queue.
- Name
Unique across the world, recommended to use something like vmdiag<text> for identification purposes.
- Location
Must be the same as the VM, as Storage accounts for diagnostics must be in the same region as the virtual machine.
- Replication
Locally-redundant storage (LRS)
- Resource Group
Select existing and use the same resource group of the Virtual Machine.
Step 6
Open your VM dashboard and click on Diagnostics settings tab, enable the diagnostic agent by turning it On, select the previously created Storage account and check for both Basic Metrics and Boot Diagnostics. Click on Save and restart the VM to capture the Boot Diagnostics data.
Step 7
Open your VM dashboard and click on Alerts (Classic) tab from the monitoring category and click on Add metric alert (Classic). Give a Name and description for your alert and make sure it has selected the same resource group and resource. Change the Threshold to 70 and check the Notify via email owners, contributors and readers. There is a provision for providing additional administrators' emails also.
Step 8
Open your VM dashboard and select the Boot diagnostics setting, from where you can download the screenshot of the console of the virtual machine. This can help you troubleshoot boot issues since the console is not normally accessible through the portal. You can also click the Serial Log tab where you can view or download the raw output from the VM console.