turbot/azure_insights

Query: compute_virtual_machine_top10_cpu_past_week

Usage

powerpipe query azure_insights.query.compute_virtual_machine_top10_cpu_past_week

SQL

with top_n as (
select
name,
resource_group,
avg(average)
from
azure_compute_virtual_machine_metric_cpu_utilization_daily
where
timestamp >= CURRENT_DATE - INTERVAL '7 day'
group by
name,
resource_group
order by
avg desc
limit 10
)
select
timestamp,
name,
average
from
azure_compute_virtual_machine_metric_cpu_utilization_hourly
where
timestamp >= CURRENT_DATE - INTERVAL '7 day'
and name in (select name from top_n group by name, resource_group)
order by
timestamp;

Dashboards

The query is used in the dashboards: