{
    "id": "4650b4aa-b039-42b5-a151-d2e301637f2c",
    "name": "Configure Resource Diagnostics",
    "slug": "configure-resource-diagnostics",
    "status": "published",
    "lab_type": "pta",
    "is_sample": false,
    "duration_in_seconds": 1800,
    "metadata": {
        "courses": [
            "1d0c3874-1dec-4abd-90aa-f5cbf362c035",
            "bdbadde2-fe15-49c9-b700-c0c8873eb04f"
        ],
        "pta_sdn": "439",
        "pta_namespace": "my.ine",
        "learning_paths": [],
        "has_published_parent": true
    },
    "session": null,
    "company": "a491bc32-c056-4946-9169-cc053387bada",
    "created": "2022-10-14T21:52:51.980840Z",
    "modified": "2023-10-03T18:58:38.117933Z",
    "is_beta": false,
    "lab_objectives": [],
    "main_learning_area": "d3f82c70-f4e7-428e-afd7-4b1d28988e18",
    "learning_areas": [
        {
            "id": "d3f82c70-f4e7-428e-afd7-4b1d28988e18",
            "name": "Cloud",
            "slug": "cloud"
        }
    ],
    "categories": [],
    "tags": [],
    "difficulty": null,
    "is_web_access": true,
    "is_lab_experience": false,
    "is_featured": false,
    "cve": null,
    "severity": null,
    "year": null,
    "classification": null,
    "is_trackable": false,
    "cpe_credits": null,
    "is_skill_check": false,
    "external_url": "",
    "solution_video": null,
    "explanation_video": null,
    "description": "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.",
    "description_html": "<p>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.</p>",
    "tasks": "",
    "tasks_html": "",
    "published_date": "2020-04-07T18:00:00Z",
    "solutions": "# Virtual machine diagnostics\n\nWhen 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.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/1.png)\n\nNavigate 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**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/2.png)\n\nIt will take nearly 2 minutes to enable the monitoring. After this navigate to the **Metrics** of the virtual machine.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/3.png)\n\nHere add a metric with below settings:\n\n* Metric namespace as **Guest (classic)** and Metric as **CPU idle time**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/4.png)\n\nAfter the first metric is added click on **Add metric** to add one more.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/5.png)\n\nConfigure this metric as below:\n\n* Metric namespace as **Guest (classic)** and Metric as **Filesystem % free space**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/6.png)\n\nSet the time frame to **Last 30 minutes** as highlighted in the below image.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/7.png)\n\nYou 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.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/8.png)\n\nYou can also navigate to the pre created storage account we used for monitoring. Here open the **Storage browser**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/9.png)\n\nGo to the **Tables** and open the **LinuxSyslog** table. You will be able to see the sys logs here.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/10.png)\n\n# Web app diagnostics\n\nNavigate to the pre created app service and open the **App Service logs**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/11.png)\n\nConfigure the app service logs as below.\n\n* Turn on the application logging (Filesystem) with **Verbose** level.\n\n* Also turn on the application logging(Blob) with **Verbose** level.\n\nClick on the icon as highlighted below to configure storage container.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/12.png)\n\nChoose the precreated storage account and a new blade for containers will open up. Click on **+Container** to create a new container.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/13.png)\n\nName this container as **webapplog** and click on **Create**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/14.png)\n\nSelect this newly create container and click on **Select**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/15.png)\n\nYou will see the storage container is configured. \n\n* Set the retention period as 7 days\n\n* Enable web server logging for **File system** and set the qouta as **35MB** with 7 days retention period.\n\n* Also enable detailed error messages and failed request tracing.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/16.png)\n\nAfter configure click on **Save** to save the settings.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/17.png)\n\nAfter 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.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/18.png)\n\nA website like the image below will open in a new tab.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/19.png)\n\nGo back to the portal and open the **Log stream** for your app service.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/20.png)\n\nNow on the website go to the **Network load** to generate a new load with below settings:\n\n* Set the number of requests as 1000\n\n* Set the respose size to a low number as 10 bytes\n\n* Enable the **Generate error** option.\n\nClick on **Execute** to start the network load.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/21.png)\n\nNavigate back to the portal and in log streams you can see that there are html error pages in the **Application logs**. \n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/22.png)\n\nSwitch to **Web Server logs** to check the server logs.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/23.png)\n\n# Network interface diagnostics\n\nNavigate to the webapp nic which is pre created for the webapp VM. Open the **Diagnostic settings** here.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/24.png)\n\nClick on **+ Add diagnostic settings** to add a new setting.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/25.png)\n\nName this setting as **webApp-nic-diag** and configure it as below:\n\n* Choose the **AllMetrics** option \n\n* Set the destination to storage account\n\n* Choose the pre created storage account in your subscription\n\n* Set the retention period to 7 days for the metrics\n\nClick on **Save** to save the settings.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/26.png)\n\nNow go to your assigned resource group and open the **Deployments**. Here open the deployment for pre created resources.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/27.png)\n\nGo to the outputs of the deployment and note the password. This password is for the webapp VM.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/28.png)\n\nGo to the webapp VM and choose **Bastion** to connect as highlighted in the below image.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/29.png)\n\nUse the username as **student** and the password you noted down earlier. Click on **Connect** to connect to the VM.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/30.png)\n\nA SSH connection to the webapp VM will open in a new browser tab.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/31.png)\n\nUse the below commands to generate some traffic:\n\n```\nsudo apt-get update\nsudo apt-get install -y nodejs\nsudo apt-get install -y npm\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/32.png)\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/33.png)\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/34.png)\n\nGo back to the portal and navigate to the storage account. Here open the **Container** and you will see a **insights** container. Open this container.\n\n**Note:** It may take some significant time for the metrics to show up in the storage account.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/35.png)\n\nNavigate inside the folders of the container.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/36.png)\n\nYou may have to navigate through 14 15 folders to finally reach a json file. Click on this file.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/37.png)\n\nClick on the **Download** button to download this file to your computer.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/38.png)\n\nOpen this file to any editor of your choice to view the contents of this file.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/39.png)\n\nOur lab is now complete.",
    "solutions_html": "<h1>Virtual machine diagnostics</h1>\n<p>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.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/1.png\" /></p>\n<p>Navigate to the webapp VM and open the <strong>diagnostic settings</strong>. Here pick the storage account which is pre created and click on <strong>Enable guest-level monitoring</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/2.png\" /></p>\n<p>It will take nearly 2 minutes to enable the monitoring. After this navigate to the <strong>Metrics</strong> of the virtual machine.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/3.png\" /></p>\n<p>Here add a metric with below settings:</p>\n<ul>\n<li>Metric namespace as <strong>Guest (classic)</strong> and Metric as <strong>CPU idle time</strong>.</li>\n</ul>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/4.png\" /></p>\n<p>After the first metric is added click on <strong>Add metric</strong> to add one more.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/5.png\" /></p>\n<p>Configure this metric as below:</p>\n<ul>\n<li>Metric namespace as <strong>Guest (classic)</strong> and Metric as <strong>Filesystem % free space</strong>.</li>\n</ul>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/6.png\" /></p>\n<p>Set the time frame to <strong>Last 30 minutes</strong> as highlighted in the below image.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/7.png\" /></p>\n<p>You will see the graph with some insights on the CPU idle time and Filesystem free space. You may click on the <strong>Refresh</strong> button after a minute to populate new data.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/8.png\" /></p>\n<p>You can also navigate to the pre created storage account we used for monitoring. Here open the <strong>Storage browser</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/9.png\" /></p>\n<p>Go to the <strong>Tables</strong> and open the <strong>LinuxSyslog</strong> table. You will be able to see the sys logs here.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/10.png\" /></p>\n<h1>Web app diagnostics</h1>\n<p>Navigate to the pre created app service and open the <strong>App Service logs</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/11.png\" /></p>\n<p>Configure the app service logs as below.</p>\n<ul>\n<li>\n<p>Turn on the application logging (Filesystem) with <strong>Verbose</strong> level.</p>\n</li>\n<li>\n<p>Also turn on the application logging(Blob) with <strong>Verbose</strong> level.</p>\n</li>\n</ul>\n<p>Click on the icon as highlighted below to configure storage container.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/12.png\" /></p>\n<p>Choose the precreated storage account and a new blade for containers will open up. Click on <strong>+Container</strong> to create a new container.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/13.png\" /></p>\n<p>Name this container as <strong>webapplog</strong> and click on <strong>Create</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/14.png\" /></p>\n<p>Select this newly create container and click on <strong>Select</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/15.png\" /></p>\n<p>You will see the storage container is configured. </p>\n<ul>\n<li>\n<p>Set the retention period as 7 days</p>\n</li>\n<li>\n<p>Enable web server logging for <strong>File system</strong> and set the qouta as <strong>35MB</strong> with 7 days retention period.</p>\n</li>\n<li>\n<p>Also enable detailed error messages and failed request tracing.</p>\n</li>\n</ul>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/16.png\" /></p>\n<p>After configure click on <strong>Save</strong> to save the settings.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/17.png\" /></p>\n<p>After the app service logs are configured go to the <strong>Overview</strong> of the app service. Here click on <strong>Browse</strong> to open the website in new tab.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/18.png\" /></p>\n<p>A website like the image below will open in a new tab.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/19.png\" /></p>\n<p>Go back to the portal and open the <strong>Log stream</strong> for your app service.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/20.png\" /></p>\n<p>Now on the website go to the <strong>Network load</strong> to generate a new load with below settings:</p>\n<ul>\n<li>\n<p>Set the number of requests as 1000</p>\n</li>\n<li>\n<p>Set the respose size to a low number as 10 bytes</p>\n</li>\n<li>\n<p>Enable the <strong>Generate error</strong> option.</p>\n</li>\n</ul>\n<p>Click on <strong>Execute</strong> to start the network load.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/21.png\" /></p>\n<p>Navigate back to the portal and in log streams you can see that there are html error pages in the <strong>Application logs</strong>. </p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/22.png\" /></p>\n<p>Switch to <strong>Web Server logs</strong> to check the server logs.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/23.png\" /></p>\n<h1>Network interface diagnostics</h1>\n<p>Navigate to the webapp nic which is pre created for the webapp VM. Open the <strong>Diagnostic settings</strong> here.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/24.png\" /></p>\n<p>Click on <strong>+ Add diagnostic settings</strong> to add a new setting.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/25.png\" /></p>\n<p>Name this setting as <strong>webApp-nic-diag</strong> and configure it as below:</p>\n<ul>\n<li>\n<p>Choose the <strong>AllMetrics</strong> option </p>\n</li>\n<li>\n<p>Set the destination to storage account</p>\n</li>\n<li>\n<p>Choose the pre created storage account in your subscription</p>\n</li>\n<li>\n<p>Set the retention period to 7 days for the metrics</p>\n</li>\n</ul>\n<p>Click on <strong>Save</strong> to save the settings.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/26.png\" /></p>\n<p>Now go to your assigned resource group and open the <strong>Deployments</strong>. Here open the deployment for pre created resources.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/27.png\" /></p>\n<p>Go to the outputs of the deployment and note the password. This password is for the webapp VM.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/28.png\" /></p>\n<p>Go to the webapp VM and choose <strong>Bastion</strong> to connect as highlighted in the below image.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/29.png\" /></p>\n<p>Use the username as <strong>student</strong> and the password you noted down earlier. Click on <strong>Connect</strong> to connect to the VM.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/30.png\" /></p>\n<p>A SSH connection to the webapp VM will open in a new browser tab.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/31.png\" /></p>\n<p>Use the below commands to generate some traffic:</p>\n<pre class=\"codehilite\"><code>sudo apt-get update\nsudo apt-get install -y nodejs\nsudo apt-get install -y npm</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/32.png\" /></p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/33.png\" /></p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/34.png\" /></p>\n<p>Go back to the portal and navigate to the storage account. Here open the <strong>Container</strong> and you will see a <strong>insights</strong> container. Open this container.</p>\n<p><strong>Note:</strong> It may take some significant time for the metrics to show up in the storage account.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/35.png\" /></p>\n<p>Navigate inside the folders of the container.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/36.png\" /></p>\n<p>You may have to navigate through 14 15 folders to finally reach a json file. Click on this file.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/37.png\" /></p>\n<p>Click on the <strong>Download</strong> button to download this file to your computer.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/38.png\" /></p>\n<p>Open this file to any editor of your choice to view the contents of this file.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-resource-diagnostics/39.png\" /></p>\n<p>Our lab is now complete.</p>",
    "flags": [],
    "min_points_to_pass": null,
    "access_type": "web",
    "user_status": "unstarted",
    "user_lab_status": null,
    "user_status_modified": null,
    "user_flags": [],
    "global_running_session": null
}