Task: Monitor Resources with Azure Monitor

Video: Azure Monitor

Estimated time: 10 minutes

Goal

The goal of this task is to use the Azure monitor. This includes setting diagnostic logging for resources, monitoring activity and creating performance graphs.

Pre-requisites

  1. Non-production Azure subscription
  2. A virtual machine with required resources

Requirements

  1. Requirement 1: Configure monitoring for Azure resources
  2. Requirement 2: Generate activity
  3. Requirement 3: Monitor activity logs with Azure monitor
  4. Requirement 4: Generate a performance graph with Azure monitor

Pre-requisite setup

This task requires a virtual machine, network interface, public IP address, virtual network and bastion host. To deploy the resources required for this task, run the following from a bash cloud shell:

curl https://inedemoassets.blob.core.windows.net/taskfiles/azure_admin/deploy-3509T140-pre.sh | sh

This script will deploy the following resources:

Setting Value
Virtual network webApp-vnet
NSG webApp-nsg
VM webApp-vm
VM public IP webApp-vm-pip
Storage account <a unique name>
Web app <a unique name>
Bastion webApp-bastion
Bastion public IP webApp-bastion-pip

Support resources not shown.

Important: Record the password output. You will need it for requirement 3.

Requirement 1: Configure monitoring for Azure resources

To meet this requirement you must configure diagnostics for several resources. Configure each of the following resources to write 7 days* worth of diagnostic data to the storage account that was provisioned during the pre-requisite setup:

*Not all resources will allow you to set the retention period.

Requirement 2: Generate activity

For this requirement you will log onto the virtual machine using the Bastion connection and generate a network load. You will install software on the virtual machine to generate the load. To complete this requirement:

sudo apt-get update
sudo apt-get install -y nodejs
sudo apt-get install -y npm

Requirement 3: Monitor activity logs with Azure monitor

Now you need to confirm that activity for the resources is accessible from Azure monitor. Navigate to the Activity log view of the monitor blade in the Azure portal. Verify activity logging as follows:

Requirement 4: Generate a performance graph with Azure monitor

For the final requirement, you will build a metrics chart in Azure monitor. Display data for the last 30 minutes for the following metrics:

Resource Metric
webApp-vm Disk write bytes
webApp-nic Bytes received
webApp-pip Byte count

Cleanup

When you have completed this task, delete the task-mntr-rg resource group.