Loading controls...
Control: Long running compute instances should be reviewed
Description
Instances should ideally be ephemeral and rehydrated frequently, check why these instances have been running for so long.
Usage
Run the control in your terminal:
steampipe check oci_thrifty.control.compute_instance_long_running
Snapshot and share results via Steampipe Cloud:
steampipe loginsteampipe check --share oci_thrifty.control.compute_instance_long_running
Plugins & Tables
Params
Args | Name | Default | Description | Variable |
---|---|---|---|---|
$1 | compute_running_instance_age_max_days |
| The maximum number of days instances are allowed to run. |
SQL
select a.id as resource, case when a.lifecycle_state <> 'RUNNING' then 'skip' when date_part('day', now() - a.time_created) > $1 then 'alarm' else 'ok' end as status, case when a.lifecycle_state <> 'RUNNING' then a.title || ' in ' || a.lifecycle_state || ' state.' else a.title || ' has been running ' || date_part('day', now() - a.time_created) || ' days.' end as reason, coalesce(c.name, 'root') as compartment, a.regionfrom oci_core_instance as a left join oci_identity_compartment as c on c.id = a.compartment_id;