Bird
Raised Fist0
Azurecloud~20 mins

Metrics for resource performance in Azure - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Azure Metrics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
2:00remaining
Understanding Azure Monitor Metrics Collection

Which of the following statements correctly describes how Azure Monitor collects metrics for a virtual machine?

AAzure Monitor only collects metrics when the VM is restarted.
BAzure Monitor collects metrics by installing an agent on the VM that sends data every 5 minutes by default.
CAzure Monitor collects metrics directly from the Azure fabric without any agent, providing near real-time data.
DAzure Monitor requires manual export of logs from the VM to collect metrics.
Attempts:
2 left
💡 Hint

Think about how Azure Monitor integrates with Azure resources without extra setup.

❓ Architecture
intermediate
2:00remaining
Designing Metric Alerts for Azure Resources

You want to create an alert that triggers when CPU usage on an Azure App Service exceeds 80% for 10 minutes. Which metric and configuration should you use?

AUse the 'CPU Percentage' metric with a threshold of 80%, aggregation type 'Average', and evaluation period of 10 minutes.
BUse the 'CPU Percentage' metric with a threshold of 80%, aggregation type 'Maximum', and evaluation period of 1 minute.
CUse the 'CPU Time' metric with a threshold of 80%, aggregation type 'Total', and evaluation period of 5 minutes.
DUse the 'CPU Usage' metric with a threshold of 80%, aggregation type 'Minimum', and evaluation period of 10 minutes.
Attempts:
2 left
💡 Hint

Consider the metric name and aggregation that best reflects sustained high CPU usage.

❓ security
advanced
2:00remaining
Securing Metric Data Access in Azure Monitor

Which Azure feature allows you to restrict access to metric data collected by Azure Monitor to only authorized users?

AAzure Role-Based Access Control (RBAC) with roles scoped to the resource or resource group.
BAzure Firewall rules applied to the Azure Monitor service.
CNetwork Security Groups (NSGs) blocking metric data endpoints.
DAzure Policy enforcing encryption of metric data.
Attempts:
2 left
💡 Hint

Think about how Azure controls user permissions for resource data.

✅ Best Practice
advanced
2:00remaining
Optimizing Metric Retention and Cost in Azure Monitor

You want to retain detailed metrics for 30 days but reduce storage costs for older data. What is the best approach?

ASet metric retention to 7 days and export all metrics to a Log Analytics workspace indefinitely.
BConfigure Azure Monitor to retain detailed metrics for 30 days, then archive older metrics to a storage account.
CDisable metric collection after 30 days to save costs.
DUse Azure Monitor's default retention and do not export metrics.
Attempts:
2 left
💡 Hint

Consider balancing detailed monitoring needs with cost-effective long-term storage.

🧠 Conceptual
expert
2:00remaining
Interpreting Metric Aggregation Behavior in Azure Monitor

You observe that the 'Disk Read Bytes' metric for a VM shows a sudden spike when viewed with 'Total' aggregation over 1 minute, but a smooth curve with 'Average' aggregation. Why does this happen?

AAzure Monitor caches metrics and delays 'Average' aggregation, causing smoother curves.
BThe 'Average' aggregation only shows the highest value, hiding spikes; 'Total' shows the sum which is always lower.
CThe metric is incorrectly configured; spikes indicate data errors in 'Total' aggregation only.
DThe 'Total' aggregation sums all read bytes in the minute, causing spikes when bursts occur; 'Average' smooths these by averaging over the period.
Attempts:
2 left
💡 Hint

Think about how summing versus averaging data points affects the graph shape.

Practice

(1/5)
1. What is the main purpose of metrics in Azure resource performance monitoring?
easy
A. To create new Azure resources automatically
B. To change resource configurations
C. To delete unused resources
D. To track how well resources are working over time

Solution

  1. Step 1: Understand what metrics represent

    Metrics provide data about resource usage and performance over time.
  2. Step 2: Identify the purpose of monitoring metrics

    Monitoring helps keep resources healthy and plan for future needs.
  3. Final Answer:

    To track how well resources are working over time -> Option D
  4. Quick Check:

    Metrics = Performance tracking [OK]
Hint: Metrics measure performance, not resource creation or deletion [OK]
Common Mistakes:
  • Confusing metrics with resource management actions
  • Thinking metrics change resource settings
  • Assuming metrics create or delete resources
2. Which Azure CLI command correctly lists metrics for a resource?
easy
A. az metrics get --resource-group
B. az resource metrics show --name
C. az monitor metrics list --resource
D. az monitor resource metrics fetch --id

Solution

  1. Step 1: Recall the correct Azure CLI syntax for metrics

    The official command to list metrics is az monitor metrics list with the resource specified.
  2. Step 2: Verify the options

    Only az monitor metrics list --resource uses the correct command and parameter format.
  3. Final Answer:

    az monitor metrics list --resource <resource-id> -> Option C
  4. Quick Check:

    Correct CLI command = az monitor metrics list --resource [OK]
Hint: Use 'az monitor metrics list' to get metrics data [OK]
Common Mistakes:
  • Using incorrect command verbs like 'get' or 'show'
  • Mixing resource and resource-group parameters wrongly
  • Adding unsupported flags or commands
3. Given this Azure CLI command output snippet for CPU percentage metric:
{"value": [{"timeseries": [{"data": [{"timeStamp": "2024-06-01T10:00:00Z", "average": 30.5}, {"timeStamp": "2024-06-01T10:05:00Z", "average": 45.2}]}]}]}
What is the average CPU usage at 10:05 AM?
medium
A. 45.2%
B. No data available
C. 75.7%
D. 30.5%

Solution

  1. Step 1: Locate the timestamp 10:05 AM in the data

    Find the entry with "timeStamp": "2024-06-01T10:05:00Z".
  2. Step 2: Read the average CPU value at that time

    The average value is 45.2% at 10:05 AM.
  3. Final Answer:

    45.2% -> Option A
  4. Quick Check:

    CPU at 10:05 = 45.2% [OK]
Hint: Match timestamp exactly to find correct metric value [OK]
Common Mistakes:
  • Picking the wrong timestamp value
  • Adding values instead of reading single entry
  • Confusing average with total or max
4. You run az monitor metrics list --resource <id> but get an error: "Resource not found". What is the most likely cause?
medium
A. Metrics are not enabled for the resource
B. The resource ID is incorrect or does not exist
C. You forgot to login to Azure CLI
D. The command syntax is wrong

Solution

  1. Step 1: Understand the error message

    "Resource not found" means Azure cannot locate the resource by the given ID.
  2. Step 2: Identify common causes

    An incorrect or non-existent resource ID is the most common reason for this error.
  3. Final Answer:

    The resource ID is incorrect or does not exist -> Option B
  4. Quick Check:

    Resource not found = Wrong ID [OK]
Hint: Check resource ID spelling and existence first [OK]
Common Mistakes:
  • Assuming metrics must be enabled to avoid this error
  • Ignoring login status
  • Blaming command syntax without checking resource ID
5. You want to monitor the average disk read bytes for a virtual machine over the last 24 hours using Azure CLI. Which command correctly achieves this?
hard
A. az monitor metrics list --resource --metric DiskReadBytes --interval PT24H --aggregation Average
B. az monitor metrics list --resource --metric DiskReadBytes --interval 24h --aggregation Total
C. az monitor metrics show --resource --metric DiskReadBytes --time-range 24h --aggregation Average
D. az metrics list --resource --metric DiskReadBytes --interval PT24H --aggregation Average

Solution

  1. Step 1: Identify the correct command and parameters

    The command to list metrics is az monitor metrics list. The metric name is DiskReadBytes. The interval uses ISO 8601 duration format (PT24H for 24 hours). Aggregation for average is 'Average'.
  2. Step 2: Compare options for correctness

    az monitor metrics list --resource --metric DiskReadBytes --interval PT24H --aggregation Average uses correct command, metric, interval format, and aggregation. Others have wrong commands, interval formats, or aggregation types.
  3. Final Answer:

    az monitor metrics list --resource <vm-resource-id> --metric DiskReadBytes --interval PT24H --aggregation Average -> Option A
  4. Quick Check:

    Correct CLI + metric + interval + aggregation = az monitor metrics list --resource --metric DiskReadBytes --interval PT24H --aggregation Average [OK]
Hint: Use ISO 8601 interval format and 'Average' aggregation [OK]
Common Mistakes:
  • Using wrong command like 'az metrics show'
  • Using incorrect interval format like '24h'
  • Choosing 'Total' instead of 'Average' aggregation