Complete the code to create an Azure Monitor Log Analytics workspace.
az monitor log-analytics workspace create --resource-group myResourceGroup --workspace-name [1]The workspace name is required to create a Log Analytics workspace. Here, myWorkspace is the correct name.
Complete the code to enable Azure Monitor metrics for a virtual machine.
az monitor metrics alert create --name HighCPUAlert --resource-group myResourceGroup --scopes [1] --condition "avg Percentage CPU > 80" --window-size 5m --evaluation-frequency 1m
The --scopes parameter requires the full resource ID of the virtual machine to monitor its metrics.
Fix the error in the command to create an alert rule for CPU usage.
az monitor metrics alert create --name CPUAlert --resource-group myResourceGroup --scopes [1] --condition "avg Percentage CPU > 90" --window-size 5m --evaluation-frequency 1m
The scope must be the full resource ID of the virtual machine, not just the VM name or resource group.
Fill both blanks to create a query that returns CPU usage over the last hour.
Perf | where TimeGenerated > ago([1]) | where CounterName == [2]
The query filters performance data from the last 1 hour and selects the CPU usage counter.
Fill all three blanks to create an alert rule that triggers when disk space is low.
az monitor metrics alert create --name DiskSpaceAlert --resource-group myResourceGroup --scopes [1] --condition "avg [2] [3] 10" --window-size 10m --evaluation-frequency 5m
The alert monitors the average free disk space percentage and triggers if it falls below 10%.