Skip to content

Commit

Permalink
FOPTS-3031 Update parameters of Azure Rightsize Managed Disk policy (#…
Browse files Browse the repository at this point in the history
…1829)

* FOPTS-3031 Update README and CHANGELOG

* FOPTS-3031 Update policy template file parameters

* FOPTS-3031 Remove the change of the name from the policy template file

* FOPTS-3031 Add percentage sign next to the IOPS and throughput parameters

* FOPTS-3031 Remove an extra dot from the short description of the policy file

* FOTPS-3031 Remove the v1.2 again from the name of the policy

* FOPTS-3031 Address review comments 01

---------

Co-authored-by: midir99 <midir99@proton.me>
  • Loading branch information
midir99 and midir99 authored Feb 16, 2024
1 parent 387eed6 commit bedd147
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
6 changes: 6 additions & 0 deletions cost/azure/rightsize_managed_disks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.2

- Updated the descriptions and labels of the IOPS and throughput parameters in the README and policy template files.
- Updated the short description of the policy.
- Fixed the functionality of *Minimum Savings Threshold* parameter. This parameter is used to suppress recommendations with potential savings below the specified threshold.

## v1.1

- Fixed error where policy would fail completely when trying to access resources credential does not have access to. Policy will now simply skip these resources.
Expand Down
13 changes: 6 additions & 7 deletions cost/azure/rightsize_managed_disks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

## What it does

This Policy Template scans all volumes in the given account and identifies any volume that meets the user-specified criteria for being oversized. The user can filter volumes based on usage percentage of IOPS, usage percentage of throughput, or any combination of these. Any volumes that meet the user-specified criteria are considered oversized. If any oversized volumes are found, an incident report will show the volumes and related information. An email will be sent to the user-specified email addresses.
This policy checks managed disks in Azure subscriptions and identifies underutilized disks based on disk performance metrics over a lookback period and a threshold specified by the user; if underutilized disks are found, then disk type downgrade is recommended. An email will be sent to the user-specified email addresses.

- It is important that you keep constant LUN numbers for your data disks because when policy retrieves metrics for them. It will only look for the latest LUN number assigned to the data disk; if changed multiple times before running the policy, only the data points using the current LUN the disk has will be retrieved for analysis.
- Currently the policy only works for righsizing using the disk used IOPS and throughput since disk capacity (GiB) is not retrievable from Azure.
Note: It is preferred to keep the disk LUN number constant when detaching and re-attaching a data disk to a virtual machine. LUN number is used to retrieve disk performance metrics (IOPs and throughput).

### Policy Saving Details

Expand All @@ -24,10 +23,10 @@ The policy includes the estimated monthly savings. The estimated monthly savings
- *Allow/Deny Subscriptions List* - A list of allowed or denied Subscription IDs/names. If empty, no filtering will occur and recommendations will be produced for all subscriptions.
- *Allow/Deny Regions* - Whether to treat Allow/Deny Regions List parameter as allow or deny list. Has no effect if Allow/Deny Regions List is left empty.
- *Allow/Deny Regions List* - Filter results by region, either only allowing this list or denying it depending on how the above parameter is set. Leave blank to consider all the regions.
- *Minimum Used Disk IOPS %* - The minimum used disk IOPS percentage threshold at which to consider a disk to be 'oversized' and therefore be flagged for downsizing.
- *Aggregation Type For Disk IOPS* - Statistic to use when determining if the disk IOPS is more than the disk actually uses.
- *Minimum Used Disk Throughput %* - The minimum used disk throughput percentage threshold at which to consider a disk to be 'oversized' and therefore be flagged for downsizing.
- *Aggregation Type For Disk Throughput* - Statistic to use when determining if the disk throughput is more than the disk actually uses.
- *IOPS Threshold (%)* - The IOPS threshold percentage at which to consider a managed disk to be underutilized.
- *IOPS Threshold Statistic* - Statistic to use for IOPS when determining if a managed disk is underutilized.
- *Throughput Threshold (%)* - The throughput threshold at which to consider a managed disk to be underutilized.
- *Throughput Threshold Statistic* - Statistic to use for throughput when determining if a managed disk is underutilized.
- *Lookback Period* - How many days back to look at disk IOPS and throughput data. This value cannot be set higher than 90 because Azure does not retain metrics for longer than 90 days.

## Policy Actions
Expand Down
26 changes: 15 additions & 11 deletions cost/azure/rightsize_managed_disks/azure_rightsize_managed_disks.pt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name "Azure Rightsize Managed Disks"
rs_pt_ver 20180301
type "policy"
short_description "Looks for oversized managed disks and suggest recommendations to save money. See the [README](https://github.com/flexera-public/policy_templates/tree/master/cost/azure/rightsize_managed_disks/) and [docs.flexera.com/flexera/EN/Automation](https://docs.flexera.com/flexera/EN/Automation/AutomationGS.htm) to learn more."
short_description "This policy finds underutilized managed disks and recommends downgrading the managed disk tier if this results in savings and satisfies required usage levels. See the [README](https://github.com/flexera-public/policy_templates/tree/master/cost/azure/rightsize_managed_disks/) and [docs.flexera.com/flexera/EN/Automation](https://docs.flexera.com/flexera/EN/Automation/AutomationGS.htm) to learn more."
long_description ""
category "Cost"
severity "low"
default_frequency "monthly"
info(
version: "1.1",
version: "1.2",
provider: "Azure",
service: "Managed Disks",
policy_set: "Rightsize Storage",
Expand Down Expand Up @@ -90,8 +90,8 @@ end
parameter "param_min_used_disk_iops_pct" do
type "number"
category "Filters"
label "Used disk IOPS percentage threshold"
description "The minimum used disk IOPS percentage threshold at which to consider a disk to be 'oversized' and therefore be flagged for downsizing. Set to -1 to disable this filter."
label "IOPS Threshold (%)"
description "The IOPs threshold at which to consider a managed disk to be underutilized. Set to -1 to turn off this filter."
min_value -1
max_value 100
default -1
Expand All @@ -100,17 +100,17 @@ end
parameter "param_stats_aggregation_for_disk_iops" do
type "string"
category "Statistics"
label "Aggregation type for determining oversized disk IOPS"
description "Statistic to use when determining if the disk IOPS is more than the disk actually uses."
label "IOPS Threshold Statistic"
description "Statistic to use for IOPS when determining if a managed disk is underutilized."
allowed_values "Average", "Maximum"
default "Maximum"
end

parameter "param_min_used_disk_throughput_pct" do
type "number"
category "Filters"
label "Used disk throughput percentage threshold"
description "The minimum used disk throughput percentage threshold at which to consider a disk to be 'oversized' and therefore be flagged for downsizing. Set to -1 to disable this filter."
label "Throughput Threshold (%)"
description "The throughput threshold at which to consider a managed disk to be underutilized. Set to -1 to turn off this filter."
min_value -1
max_value 100
default -1
Expand All @@ -119,8 +119,8 @@ end
parameter "param_stats_aggregation_for_disk_throughput" do
type "string"
category "Statistics"
label "Aggregation type for determining oversized disk throughput"
description "Statistic to use when determining if the disk throughput is more than the disk actually uses."
label "Throughput Threshold Statistic"
description "Statistic to use for throughput when determining if a managed disk is underutilized."
allowed_values "Average", "Maximum"
default "Maximum"
end
Expand Down Expand Up @@ -842,6 +842,10 @@ script "js_disk_rightsizing_recommendations", type: "javascript" do
newResourceTypePriceCurrency = fittingDiskPrice.currencyCode
} else continue;
if (monthlySavings < param_min_savings) {
continue;
}
tags = []
if (typeof(disk.tags) == 'object') {
_.each(Object.keys(disk.tags), function(key) {
Expand Down Expand Up @@ -890,7 +894,7 @@ script "js_disk_rightsizing_recommendations", type: "javascript" do
totalMonthlySavings += monthlySavings
}
if (recommendations.length > 0 && totalMonthlySavings >= param_min_savings) {
if (recommendations.length > 0) {
monthlySavings = monthlySavings.toFixed(2)
recommendations[0].message = "Oversized disks are those that meet the following conditions within the last " + param_stats_lookback + " day(s):\n\n"
Expand Down

0 comments on commit bedd147

Please sign in to comment.