0
0
Azurecloud~30 mins

Metrics for resource performance in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
Metrics for resource performance
📖 Scenario: You are managing cloud resources in Microsoft Azure. To keep your resources healthy and efficient, you want to collect performance metrics like CPU usage and memory usage.This project will guide you to create a simple Azure Monitor metrics query to check resource performance.
🎯 Goal: Build an Azure Monitor metrics query that retrieves CPU and memory usage metrics for a specific virtual machine resource.
📋 What You'll Learn
Create a variable with the resource ID of the virtual machine
Define a time range for the metrics query
Write a metrics query to get CPU and memory usage
Configure the query to return average values
💡 Why This Matters
🌍 Real World
Monitoring cloud resources is essential to ensure they run efficiently and to detect problems early. Azure Monitor metrics help track resource health and performance.
💼 Career
Cloud engineers and administrators use metrics queries to analyze resource usage and optimize costs and performance.
Progress0 / 4 steps
1
Set the resource ID variable
Create a variable called resource_id and set it to the exact string "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM".
Azure
Need a hint?

The resource ID is a long string that uniquely identifies your VM in Azure.

2
Define the time range for metrics
Create a variable called time_range and set it to the string "PT1H" which means the last 1 hour.
Azure
Need a hint?

Use ISO 8601 duration format for the time range.

3
Write the metrics query
Create a variable called metrics_query and set it to the string "metrics?timespan=PT1H&metricnames=Percentage CPU,Available Memory Bytes&aggregation=Average" to query average CPU and memory usage for the last hour.
Azure
Need a hint?

The query string includes timespan, metric names, and aggregation type.

4
Complete the Azure Monitor metrics request URL
Create a variable called request_url that combines resource_id and metrics_query with a slash between them.
Azure
Need a hint?

Use string concatenation with a slash to build the full request URL.