RienSQL
TASK #166 · Medium · Dynatrace

Server Risk Score Under Peak Load

Your brief
Assume it is now 2024-03-31 19:00:00. Consider the "last hour" window — from 2024-03-31 18:00:00 (inclusive) to 2024-03-31 19:00:00 (exclusive).

Find servers whose maximum cpu_pct within this window exceeded 70%. For every such server compute risk_score using the formula:

0.4 × AVG(cpu_pct) + 0.3 × VAR_SAMP(mem_pct) + 0.2 × AVG(disk_gb) + 0.1 × AVG(net_mb)

Output server_id and risk_score (rounded to two decimals). Sort by risk_score descending.
Expected columnsserver_id risk_scoreDynatrace APM
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
applicationsapplication_id, name
logslog_id, application_id, response_time_ms, recorded_at
server_metricsmetric_id, server_id, sample_time, cpu_pct, mem_pct, disk_gb, net_mb