From d56bcc3ac9340ba285a35dfb2352a7cb67a55588 Mon Sep 17 00:00:00 2001 From: Shawn Huckabay Date: Wed, 16 Oct 2024 06:42:38 -0500 Subject: [PATCH] update --- .../aws_rightsize_ec2_instances.pt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cost/aws/rightsize_ec2_instances/aws_rightsize_ec2_instances.pt b/cost/aws/rightsize_ec2_instances/aws_rightsize_ec2_instances.pt index 59897b3812..36a7f1db24 100644 --- a/cost/aws/rightsize_ec2_instances/aws_rightsize_ec2_instances.pt +++ b/cost/aws/rightsize_ec2_instances/aws_rightsize_ec2_instances.pt @@ -1117,34 +1117,34 @@ script "js_idle_and_underutil_instances", type:"javascript" do if (param_downsize_multiple == "Yes") { if (checking_cpu && checking_mem && param_stats_check_both == "Both CPU and Memory") { - while (ds_aws_instance_size_map[instance['newResourceType']]['down'] && cpu_value / 2 > param_stats_underutil_threshold_cpu_value && mem_value / 2 > param_stats_underutil_threshold_mem_value) { - cpu_value = cpu_value / 2 - mem_value = mem_value / 2 + while (ds_aws_instance_size_map[instance['newResourceType']]['down'] && cpu_value * 2 < param_stats_underutil_threshold_cpu_value && mem_value * 2 < param_stats_underutil_threshold_mem_value) { + cpu_value = cpu_value * 2 + mem_value = mem_value * 2 instance["newResourceType"] = ds_aws_instance_size_map[instance['newResourceType']]['down'] savingsMultiplier += 1 } } if (checking_cpu && checking_mem && param_stats_check_both == "Either CPU or Memory") { - while (ds_aws_instance_size_map[instance['newResourceType']]['down'] && (cpu_value / 2 > param_stats_underutil_threshold_cpu_value || mem_value / 2 > param_stats_underutil_threshold_mem_value)) { - cpu_value = cpu_value / 2 - mem_value = mem_value / 2 + while (ds_aws_instance_size_map[instance['newResourceType']]['down'] && (cpu_value * 2 < param_stats_underutil_threshold_cpu_value || mem_value * 2 < param_stats_underutil_threshold_mem_value)) { + cpu_value = cpu_value * 2 + mem_value = mem_value * 2 instance["newResourceType"] = ds_aws_instance_size_map[instance['newResourceType']]['down'] savingsMultiplier += 1 } } if (checking_cpu && !checking_mem) { - while (ds_aws_instance_size_map[instance['newResourceType']]['down'] && cpu_value / 2 > param_stats_underutil_threshold_cpu_value) { - cpu_value = cpu_value / 2 + while (ds_aws_instance_size_map[instance['newResourceType']]['down'] && cpu_value * 2 < param_stats_underutil_threshold_cpu_value) { + cpu_value = cpu_value * 2 instance["newResourceType"] = ds_aws_instance_size_map[instance['newResourceType']]['down'] savingsMultiplier += 1 } } if (!checking_cpu && checking_mem) { - while (ds_aws_instance_size_map[instance['newResourceType']]['down'] && mem_value / 2 > param_stats_underutil_threshold_mem_value) { - mem_value = mem_value / 2 + while (ds_aws_instance_size_map[instance['newResourceType']]['down'] && mem_value * 2 < param_stats_underutil_threshold_mem_value) { + mem_value = mem_value * 2 instance["newResourceType"] = ds_aws_instance_size_map[instance['newResourceType']]['down'] savingsMultiplier += 1 }