turbot/oci_insights

Query: mysql_db_system_by_cpu_utilization_category

Usage

powerpipe query oci_insights.query.mysql_db_system_by_cpu_utilization_category

SQL

with cpu_buckets as (
select
unnest(
array [ 'Unused (<1%)',
'Underutilized (1-10%)',
'Right-sized (10-90%)',
'Overutilized (>90%)' ]
) as cpu_bucket
),
max_averages as (
select
id,
case
when max(average) <= 1 then 'Unused (<1%)'
when max(average) between 1 and 10 then 'Underutilized (1-10%)'
when max(average) between 10 and 90 then 'Right-sized (10-90%)'
when max(average) > 90 then 'Overutilized (>90%)'
end as cpu_bucket,
max(average) as max_avg
from
oci_mysql_db_system_metric_cpu_utilization_daily
where
date_part('day', now() - timestamp) <= 30
group by
id
)
select
b.cpu_bucket as "CPU Utilization",
count(a.*)
from
cpu_buckets as b
left join max_averages as a on b.cpu_bucket = a.cpu_bucket
group by
b.cpu_bucket;

Dashboards

The query is used in the dashboards: