How to monitor Azure resources, and receive alerts

Azure health monitoring runs by default on all our resource groups.  If you go to a resource group page and select Insights (Preview) from under Monitoring on the left had menu you can see a bunch of stuff.  Check the Show Azure resource health box for current resource health: https://portal.azure.com/#@034gc.onmicrosoft.com/resource/subscriptions/fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc/resourceGroups/TC-PLT-EGIS-RG/e2emonitoring

 

Alerts get triggered if these health metrics fail. Alerts are just listed in portal by default unless we define another action.  eGIS has worked with the cloud team to send email alerts for all default health metrics in the pilot environment.

 

Default health metrics

Azure’s default health metrics can be found here:

https://docs.microsoft.com/en-us/azure/azure-monitor/insights/vminsights-health

Some of these metrics may require a monitoring agent to be installed on the VM:

 

Enable these by clicking on the Monitoring: Insights section of a new VM in the azure portal, and click the Enable button.

Enabling email alerts for default health metrics

Only the subscription owner can enable these alerts, and it was done via script (source). Contact the cloud team for support. The script send to the cloud team to get us started is provided below.

The resulting action group can been seen in the azure portal by navigating to the Resource Group’s Alerts section, then selecting the Manage Actions link from the top of the page. For PLT this is found here: https://portal.azure.com/#blade/Microsoft_Azure_Monitoring/NotificationGroupsBlade/queryInputs/{"subscriptionIds"%3A"fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc"%2C"resourceGroupName"%3A"%2Fsubscriptions%2Ffde9cf97-7bf0-4373-9fbd-eba18c6e0dfc%2FresourceGroups%2FTC-PLT-EGIS-RG"%2C"activeTab"%3A0}

 

Sample script to enable alerts

$payload = "{'properties':{'ActionGroupResourceIds':['/subscriptions/fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc/resourceGroups/TC-PLT-EGIS-RG/providers/microsoft.insights/actionGroups/egis-plt-mon']}}" armclient PUT https://management.azure.com/subscriptions/fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc/resourceGroups/TC-PLT-EGIS-RG/providers/Microsoft.Compute/virtualMachines/EGIS-PLT-WEB0/providers/Microsoft.WorkloadMonitor/notificationSettings/default?api-version=2018-08-31-preview $payload armclient PUT https://management.azure.com/subscriptions/fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc/resourceGroups/TC-PLT-EGIS-RG/providers/Microsoft.Compute/virtualMachines/EGIS-PLT-POR0/providers/Microsoft.WorkloadMonitor/notificationSettings/default?api-version=2018-08-31-preview $payload armclient PUT https://management.azure.com/subscriptions/fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc/resourceGroups/TC-PLT-EGIS-RG/providers/Microsoft.Compute/virtualMachines/EGIS-PLT-GIS0/providers/Microsoft.WorkloadMonitor/notificationSettings/default?api-version=2018-08-31-preview $payload armclient PUT https://management.azure.com/subscriptions/fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc/resourceGroups/TC-PLT-EGIS-RG/providers/Microsoft.Compute/virtualMachines/EGIS-PLT-DS0/providers/Microsoft.WorkloadMonitor/notificationSettings/default?api-version=2018-08-31-preview $payload armclient PUT https://management.azure.com/subscriptions/fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc/resourceGroups/TC-PLT-EGIS-RG/providers/Microsoft.Compute/virtualMachines/EGIS-PLT-EVT/providers/Microsoft.WorkloadMonitor/notificationSettings/default?api-version=2018-08-31-preview $payload armclient PUT https://management.azure.com/subscriptions/fde9cf97-7bf0-4373-9fbd-eba18c6e0dfc/resourceGroups/TC-PLT-EGIS-RG/providers/Microsoft.Compute/virtualMachines/EGIS-PLT-BDS/providers/Microsoft.WorkloadMonitor/notificationSettings/default?api-version=2018-08-31-preview $payload