turbot/oci_thrifty
Loading controls...

Control: Autonomous databases with low CPU utilization should be reviewed

Description

Resize or eliminate under utilized autonomous databases.

Usage

Run the control in your terminal:

powerpipe control run oci_thrifty.control.database_autonomous_database_low_utilization

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run oci_thrifty.control.database_autonomous_database_low_utilization --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1autonomous_database_avg_cpu_utilization_low
25
The average CPU utilization required for autonomous databases to be considered infrequently used. This value should be lower than autonomous_database_avg_cpu_utilization_high.
$2autonomous_database_avg_cpu_utilization_high
35
The average CPU utilization required for autonomous databases to be considered frequently used. This value should be higher than autonomous_database_avg_cpu_utilization_low.

SQL

with database_autonomous_database_utilization as (
select
id,
round(cast(sum(maximum) / count(maximum) as numeric), 1) as avg_max,
count(maximum) as days
from
oci_database_autonomous_db_metric_cpu_utilization_daily
where
date_part('day', now() - timestamp) <= 30
group by
id
)
select
i.id as resource,
case
when avg_max is null then 'error'
when avg_max < $1 then 'alarm'
when avg_max < $2 then 'info'
else 'ok'
end as status,
case
when avg_max is null then 'Monitoring metrics not available for ' || i.title || '.'
else i.title || ' averaging ' || avg_max || '% max utilization over the last ' || days || ' day(s).'
end as reason,
coalesce(c.name, 'root') as compartment,
i.region
from
oci_database_autonomous_database as i
left join database_autonomous_database_utilization as u on u.id = i.id
left join oci_identity_compartment as c on c.id = i.compartment_id;

Tags