Examples of formulas and parameters in custom Optimizer rules
Examples of formulas
The following table contains some examples of formulas that you can add to the Formula field in the Condition section of a custom Optimizer rule.
Goal | Example of formula |
|---|---|
To generate an alert on overprovisioned datastores based on metric values (DSTORE_PROVISIONED is greater than DSTORE_SIZE) | alerted = (DSTORE_PROVISIONED.value > DSTORE_SIZE.value); |
To know if data for an indicator/metric (IND_DAYS_TO_SATURATION) is available | if (IND_DAYS_TO_SATURATION) { ... } |
To get an indicator (IND_DAYS_TO_SATURATION) value | IND_DAYS_TO_SATURATION.value |
To get a specific subresource value, for example CPU | IND_DAYS_TO_SATURATION.subresource("CPU").value; |
To know if data for a certain subresource is available, for example CPU | if (IND_DAYS_TO_SATURATION.hasSubresource("CPU")) { ... } |
To set a value or threshold in the output | point.value0 = some_value; point.threshold0 = a_threshold; ...; point.value20 = some_value; point.threshold20 = a_threshold; |
To add a resource to an alerted subresource, for example CPU | point.addAlertedResource("CPU"); |
To generate an alert when the days to saturation for CPU, memory, or storage is more than the threshold value | var res = false; if(Math.round(IND_DAYS_TO_SATURATION.value)<=30) { if(IND_DAYS_TO_SATURATION.hasSubresource("CPU") && IND_DAYS_TO_SATURATION.subresource("CPU").value<30) { res = true; } if(IND_DAYS_TO_SATURATION.hasSubresource("MEMORY") && IND_DAYS_TO_SATURATION.subresource("MEMORY").value<30) { res = true; } if(IND_DAYS_TO_SATURATION.hasSubresource("STORAGE") && IND_DAYS_TO_SATURATION.subresource("STORAGE").value<30) { res = true; } } alerted = res; |
Screenshot with sample data

Examples of parameters
Parameters must be inserted as per the following syntax:
Where <type> can be a number or a string.
To add more than one parameter to your custom rule, separate them with a newline character (press Enter) in the Parameters section. You can add as many parameters as you like.
Parameters are commonly used to define new thresholds that can be used in formulas.
The following table contains some examples of parameters that you can add to the Parameters field in the Condition section of a custom Optimizer rule.
Goal | Parameter definition |
|---|---|
To create a threshold: Days to saturation – Critical threshold, set to a value of 7 (days) | dts_th_crit|Days to saturation critical threshold|7|number |
To create a threshold: Days to saturation – Warning threshold, set to a value of 30 (days) | dts_th_warn|Days to saturation warning threshold|30|number |
Screenshot with sample data

Example of using parameters in formulas
The following table contains some examples of parameters that are used in a formula in a custom Optimizer rule.
Goal | Parameter definition |
|---|---|
To the following thresholds in the formula:
| var res = false; |
Screenshot with sample data

