Complete the code to define a threshold that triggers an alert when CPU usage exceeds a limit.
if cpu_usage [1] threshold: trigger_alert()
The alert should trigger when CPU usage is greater than the threshold.
Complete the code to set a memory alert threshold at 80%.
memory_alert_threshold = [1]80% is represented as 0.8 in decimal form for threshold setting.
Fix the error in the alert condition to correctly trigger when disk space is below the threshold.
if disk_space [1] threshold: trigger_alert()
The alert should trigger when disk space is less than the threshold, so use '<'.
Fill both blanks to create a threshold check that triggers an alert if response time is greater than 200ms and error rate is above 5%.
if response_time [1] 200 and error_rate [2] 0.05: trigger_alert()
Both conditions check if values exceed their thresholds, so use '>' for both.
Fill all three blanks to define a dictionary of alert thresholds for CPU, memory, and disk usage.
alert_thresholds = {
'cpu': [1],
'memory': [2],
'disk': [3]
}Common thresholds are 85% for CPU, 80% for memory, and 90% for disk usage.