vRealize Operations Manager enables you to enhance your super metric by using clauses and resource entry aliasing.

Where Clause

The where clause checks whether a particular metric value should be used in the super metric. Use this clause to point to a different metric of the same object, such as where = "metric_group|my_metric > 0.

For example: count(${adaptertype = ExampleAdapter, objecttype = ExampleObject, metric = ExampleGroup|Rating, depth=2, where = "==1"})

Resource Entry Aliasing

Resource entries are used to retrieve metric data from vRealize Operations Manager for super metric computation. A resource entry is the part of an expression which starts with $ followed by a {..} block. When computing a super metric, you may have to use the same resource entry multiple times. If you need to make changes to your computation, the changes have to be made to each and every resource entry, which may lead to errors. Use resource entry aliasing to rewrite the expression.

The following example, shows a resource entry that has been used twice.

(min(${adapterkind=VMWARE, resourcekind=HostSystem, attribute= cpu|demand|active_longterm_load, depth=5, where=”>=0”}) + 0.0001)/(max(${adapterkind=VMWARE, resourcekind=HostSystem, attribute=cpu|demand|active_longterm_load, depth=5, where=”>=0”}) + 0.0001)"

Using resource entry aliasing, you can write the expression like this. The output of both expressions are the same.

(min(${adapterkind=VMWARE, resourcekind=HostSystem, attribute= cpu|demand|active_longterm_load, depth=5, where=”>=0”} as cpuload) + 0.0001)/(max(cpuload) + 0.0001)"

Follow these guidelines when you use resource entry aliasing:

  • To create the alias, the resource entry should be followed by as and then alias:name. For example: ${…} as alias_name.

  • The alias cannot contain the ()[]+-*/%|&!=<>,.?:$ special characters, and cannot start with a digit.

  • An alias name, like all names in super metric expressions, is case-insensitive.

  • Use of an alias name is optional. You can define the alias, and not use it in an expression.

  • You cannot specify the same alias name more than once. For example: ${resource1,…} as r1 + ${resource2,…} as R1.

  • You can specify multiple aliases for the same resource entry. For example: ${…} as a1 as a2.

Conditional Expression ?: Ternary Operators

You can use a ternary operator in an expression to execute conditional expressions.

For example: expression_condition ? expression_if_true : expression_if_false.

The result of the conditional expression is converted to a number. If the value is not 0 then the condition is assumed as true.

For example: -0.7 ? 10 : 20 results in 10. 2 + 2 / 2 - 3 ? 4 + 5 / 6 : 7 + 8 results in 15 (7 + 8).

Depending on the condition, either expression_if_true or expression_if_false is executed, but not both of them. This enables you to write expressions such as, ${this, metric=cpu|demandmhz} as a != 0 ? 1/a : -1. A ternary operator can contain other operators in all its expressions, including other ternary operators.

For example: !1 ? 2 ? 3 : 4 : 5 results in 5.