vRealize Operations includes functions and operators that you can use in super metric formulas. The functions are either looping functions or single functions.
Looping Functions
Function | Description |
---|---|
avg | Average of the collected values. |
combine | Combines all the values of the metrics of the included objects in a single metric timeline. |
count | Number of values collected. |
max | Maximum value of the collected values. |
min | Minimum value of the collected values. |
sum | Total of the collected values. |
Looping Function Arguments
The looping function returns an attribute or metric value for an object or object type. An attribute is metadata that describes the metric for the adapter to collect from the object. A metric is an instance of an attribute. The argument syntax defines the desired result.
For example, CPU usage is an attribute of a virtual machine object. If a virtual machine has multiple CPUs, the CPU usage for each CPU is a metric instance. If a virtual machine has one CPU, then the function for the attribute or the metric return the same result.
Argument syntax example | Description |
---|---|
funct(${this, metric =a|b:optional_instance|c}) | Returns a single data point of a particular metric for the object to which the super metric is assigned. This super metric does not take values from the children or parents of the object. |
funct(${this, attribute=a|b:optional_instance|c}) | Returns a set of data points for attributes of the object to which the super metric is assigned. This super metric does not take values from the child or parent of the object. |
funct(${adaptertype=adaptkind, objecttype=reskind, resourcename=resname, identifiers={id1=val1id2=val2,…}, metric=a|b:instance|c}) | Returns a single data point of a particular metric for the resname specified in the argument. This super metric does not take values from the children or parents of the object. |
funct(${adaptertype=adaptkind, objecttype=reskind, resourcename=resname, identifiers={id1=val1, id2=val2,…}, attribute=a|b:optional_instance|c}) | Returns a set of data points. This function iterates attributes of the resname specified in the argument. This super metric does not take values from the child or parent of the object. |
funct(${adaptertype=adaptkind, objecttype=reskind, depth=dep}, metric=a|b:optional_instance|c}) | Returns a set of data points. This function iterates metrics of the reskind specified in the argument. This super metric takes values from the child (depth > 0) or parent (depth < 0) objects, where depth describes the object location in the relationship chain. For example, a typical relationship chain includes a data center, cluster, host, and virtual machines. The data center is at the top and the virtual machines at the bottom. If the super metric is assigned to the cluster and the function definition includes depth = 2, the super metric takes values from the virtual machines. If the function definition includes depth = -1, the super metric takes values from the data center. |
funct(${adaptertype=adaptkind, objecttype=reskind, depth=dep}, attribute=a|b:optional_instance|c}) | Returns a set of data points. This function iterates attributes of the reskind specified in the argument. This super metric takes values from the child (depth > 0) or parent (depth < 0) objects. |
For example, avg(${adaptertype=VMWARE, objecttype=VirtualMachine, attribute=cpu|usage_average, depth=1}) averages the value of all metric instances with the cpu|usage_average attribute for all objects of type VirtualMachine that the vCenter adapter finds. vRealize Operations searches for objects one level below the object type where you assign the super metric.
Single Functions
Single functions work on only a single value or a single pair of values.
Function | Format | Description |
---|---|---|
abs | abs(x) | Absolute value of x. x can be any floating point number. |
acos | acos(x) | Arccosine of x. |
asin | asin(x) | Arcsine of x. |
atan | atan(x) | Arctangent of x. |
ceil | ceil(x) | The smallest integer that is greater than or equal to x. |
cos | cos(x) | Cosine of x. |
cosh | cosh(x) | Hyperbolic cosine of x. |
exp | exp(x) | e raised to the power of x. |
floor | floor(x) | The largest integer that is less than or equal to x. |
log | log(x) | Natural logarithm (base x) of x. |
log10 | log10(x) | Common logarithm (base 10) of x. |
pow | pow(x,y) | Raises x to the y power. |
rand | rand() | Generates a pseudo random floating number greater than or equal to 0.0 and less than 1.0. |
sin | sin(x) | Sine of x. |
sinh | sinh(x) | Hyperbolic sine of x. |
sqrt | sqrt(x) | Square root of x. |
tan | tan(x) | Tangent of x. |
tanh | tanh(x) | Hyperbolic tangent of x. |
Operators
Operators are mathematical symbols and text to enclose or insert between functions.
Operators | Description |
---|---|
+ | Plus |
- | Subtract |
* | Multiply |
/ | Divide |
% | Modulo |
== | Equal |
!= | Not equal |
< | Less than |
<= | Less than, or equal |
> | Greater than |
>= | Greater than, or equal |
|| | Or |
&& | And |
! | Not |
? : | Ternary operator. If/then/else For example: conditional_expression ? expression_if_condition_is_true : expression_if_condition_is_false For more information about ternary operators, see Enhancing Your Super Metrics. |
( ) | Parentheses |
[ ] | Use in an array of expressions |
[x, y, z] | An array containing x, y, z. For example, min([x, y, z]) |
String Operators | Description |
---|---|
equals | Returns true if metric/property string value is equal to specified string. |
contains | Returns true if metric/property string value contains specified string. |
startsWith | Returns true if metric/property string value starts with the specified prefix. |
endsWith | Returns true if metric/property string value ends with the specified suffix. |
!equals | Returns true if metric/property string value is not equal to specified string. |
!contains | Returns true if metric/property string value does not contain specified string. |
!startsWith | Returns true if metric/property string value does not start with the specified prefix. |
!endsWith | Returns true if metric/property string value does not end with the specified suffix. |