0
0
Rest APIprogramming~20 mins

API monitoring and alerting in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
API Monitoring Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this curl command?
You run this command to check an API endpoint status:
curl -s -o /dev/null -w "%{http_code}" https://api.example.com/status

What output will this command produce if the API is healthy?
Rest API
curl -s -o /dev/null -w "%{http_code}" https://api.example.com/status
A500
BOK
C404
D200
Attempts:
2 left
💡 Hint
The command outputs the HTTP status code only.
🧠 Conceptual
intermediate
1:30remaining
Which alert condition best detects API downtime?
You want to create an alert for your API monitoring tool. Which condition below best detects when the API is down?
AAlert if HTTP status code is 500 or 503
BAlert if response time > 1 second
CAlert if API returns any 2xx status code
DAlert if API response body contains 'success'
Attempts:
2 left
💡 Hint
Server errors indicate downtime or failure.
Configuration
advanced
2:00remaining
Which Prometheus alert rule triggers on high API error rate?
Given this Prometheus metric: api_request_errors_total counts API errors, and api_requests_total counts total requests.
Which alert rule triggers if error rate exceeds 5% over 5 minutes?
A
alert: HighApiErrors
expr: (rate(api_request_errors_total[5m]) / rate(api_requests_total[5m])) > 0.05
for: 5m
B
alert: HighApiErrors
expr: rate(api_request_errors_total[5m]) > 0.05
for: 5m
C
alert: HighApiErrors
expr: api_request_errors_total / api_requests_total > 0.05
for: 5m
D
alert: HighApiErrors
expr: sum(api_request_errors_total) > 5
for: 5m
Attempts:
2 left
💡 Hint
Use rate() to calculate per-second increase over time.
Troubleshoot
advanced
2:00remaining
Why does this alert never trigger?
You configured an alert:
alert: ApiDown
expr: up{job="api"} == 0
for: 10m

But it never triggers even when the API is down. What is the likely cause?
AThe expression should use '!=' instead of '=='
BThe 'for' duration is too short to trigger
CThe 'up' metric is missing or not scraped for the API job
DThe alert name must be lowercase
Attempts:
2 left
💡 Hint
Check if the metric used in expr is available.
🔀 Workflow
expert
2:30remaining
Order the steps to set up API monitoring with alerting
Arrange these steps in the correct order to set up API monitoring and alerting:
A2,1,3,4
B1,2,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint
Think about defining what to measure before collecting data.