Azure Application Insights collects a lot of information about the performance of an Azure Service - but only if you turn it on.
Enabling Application Insights for a Virtual Machine (VM) is a simple step when creating the Virtual Machine.
When you create a new Virtual Machine in the Azure Portal, you are presented with a tabbed dialog. The "Monitoring" tab is shown in Fig. 1.
By default, Boot Diagnostics is enabled, and logs are stored in a storage account managed by Microsoft. Boot Diagnostics help you troubleshoot issues that occur during the boot process - sometimes preventing the VM from booting up. You can choose to store these logs in your own storage account, or you can disable this entirely.
You can log even more information by checking the "Enable OS guest diagnostics" checkbox and selecting a storage account in which to save these log entries. This provides data every minute about the health of the VM.
Check the "Enable recommended alert rule" checkbox to enable alerts when a metric is outside a normal range. Checking this checkbox displays the "Recommended alert rules" dialog, as shown in Fig. 2.
Here you can specify the thresholds that trigger an alert and the action to fire when a threshold is reached. You can expand each category to configure more information about the alert. For example, Fig. 3 shows the "Percentage CPU" alert expanded.
You can also enable and configure Application Insights after creating a Virtual Machine.
To do so, navigate to the VM and select the "Insights" button under the "Monitoring" section in the left menu, as shown in Fig. 4.
If you did not enable Application Insights when creating the VM, the dialog shown in Fig. 5 displays.
Click the [Enable] button to enable Application Insights for this VM. The "Monitoring configuration" dialog displays, as shown in Fig. 6.
Configure Application Insights, as desired and click the [Configure] button.
In this article, you learned how to enable and configure Azure Application Insights for an Azure Virtual Machine - when creating the VM and after the VM is created. In future articles, I will explain and demonstrate some of the features provided by Application Insights.