Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
XOmniverse committed Oct 16, 2024
1 parent cc6687b commit d56bcc3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cost/aws/rightsize_ec2_instances/aws_rightsize_ec2_instances.pt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d56bcc3

Please sign in to comment.