The goal of this task is to configure basic diagnostics for a virtual machine, web app, and network interface. This includes generating activity and viewing the diagnostics for each resource.

Virtual machine diagnostics

When you will login to the azure with your assigned credentials. You will get some resources in your resource group. This will be all precreated resources needed for this task.

Navigate to the webapp VM and open the diagnostic settings. Here pick the storage account which is pre created and click on Enable guest-level monitoring.

It will take nearly 2 minutes to enable the monitoring. After this navigate to the Metrics of the virtual machine.

Here add a metric with below settings:

After the first metric is added click on Add metric to add one more.

Configure this metric as below:

Set the time frame to Last 30 minutes as highlighted in the below image.

You will see the graph with some insights on the CPU idle time and Filesystem free space. You may click on the Refresh button after a minute to populate new data.

You can also navigate to the pre created storage account we used for monitoring. Here open the Storage browser.

Go to the Tables and open the LinuxSyslog table. You will be able to see the sys logs here.

Web app diagnostics

Navigate to the pre created app service and open the App Service logs.

Configure the app service logs as below.

Click on the icon as highlighted below to configure storage container.

Choose the precreated storage account and a new blade for containers will open up. Click on +Container to create a new container.

Name this container as webapplog and click on Create.

Select this newly create container and click on Select.

You will see the storage container is configured.

After configure click on Save to save the settings.

After the app service logs are configured go to the Overview of the app service. Here click on Browse to open the website in new tab.

A website like the image below will open in a new tab.

Go back to the portal and open the Log stream for your app service.

Now on the website go to the Network load to generate a new load with below settings:

Click on Execute to start the network load.

Navigate back to the portal and in log streams you can see that there are html error pages in the Application logs.

Switch to Web Server logs to check the server logs.

Network interface diagnostics

Navigate to the webapp nic which is pre created for the webapp VM. Open the Diagnostic settings here.

Click on + Add diagnostic settings to add a new setting.

Name this setting as webApp-nic-diag and configure it as below:

Click on Save to save the settings.

Now go to your assigned resource group and open the Deployments. Here open the deployment for pre created resources.

Go to the outputs of the deployment and note the password. This password is for the webapp VM.

Go to the webapp VM and choose Bastion to connect as highlighted in the below image.

Use the username as student and the password you noted down earlier. Click on Connect to connect to the VM.

A SSH connection to the webapp VM will open in a new browser tab.

Use the below commands to generate some traffic:

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

Go back to the portal and navigate to the storage account. Here open the Container and you will see a insights container. Open this container.

Note: It may take some significant time for the metrics to show up in the storage account.

Navigate inside the folders of the container.

You may have to navigate through 14 15 folders to finally reach a json file. Click on this file.

Click on the Download button to download this file to your computer.

Open this file to any editor of your choice to view the contents of this file.

Our lab is now complete.