Control: Long running virtual machines should be reviewed
Description
Virtual machines should ideally be ephemeral and rehydrated frequently, check why these virtual machines have been running for so long.
Usage
Run the control in your terminal:
powerpipe control run azure_thrifty.control.compute_virtual_machine_long_running
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run azure_thrifty.control.compute_virtual_machine_long_running --share
Steampipe Tables
SQL
select vm.id as resource, case when date_part('day', now() - (s ->> 'time') :: timestamptz) > $1 then 'alarm' else 'ok' end as status, vm.title || ' has been running for ' || date_part('day', now() - (s ->> 'time') :: timestamptz) || ' days.' as reason , vm.resource_group , display_name as subscriptionfrom azure_compute_virtual_machine as vm, jsonb_array_elements(statuses) as s, azure_subscription as subwhere sub.subscription_id = vm.subscription_id and vm.power_state in ('running', 'starting') and s ->> 'time' is not null;
Params
Args | Name | Default | Description | Variable |
---|---|---|---|---|
$1 | compute_running_vm_age_max_days |
| The maximum number of days virtual machines are allowed to run. |