VMware Aria Operations – go beyond standard Super Metrics

VMware Aria Operations – go beyond standard Super Metrics

This post is about Super Metrics in VMware Aria Operations (also know as: vROPs and vRealize Operations Manager) and how to go beyond the standard calculations. Super Metrics are a powerful feature for creating own metrics. Anyone who has ever worked with super metrics knows that it is not always easy to find the way to the goal. In this post I want to show three advanced formular technics:

Basics first: Create a Super metric

First start the creation wizard in Configure -> Super Metrics and press ADD and give the new metric a name.

In step 2, choose the object type this Super Metric is associated to. That means, this metric will be calculated only on this layer respectively objects. This is also very important when you think of THIS reference in the formular editor and the depth parameter.

In step 3 the formular is written that defines the new metric.

In the last step, the policy can be selected your Super Metric should be calculated in. You define here for which objects the metric is created. Only objects of the type you selected in step 2 that this policy is assigned to are used for metric calculation.

Note

It is essential to understand the use of THIS and depth. With THIS the Super Metric has access to exactly the object to which it is defined. In contrast, using a specific object type in the formular and using parameter depth, no objects above this level can be accessed. An example should clarify my attempt at explanation. You can define a Super Metric for object types datacenter and cluster. With it you can calculate metrics from clusters, when calculation takes place on datacenter level. But on cluster level, your metric does not have access to exactly this cluster. To accomplish this, a depth of 0 would be necessary, but this is not supported. By the way, a negative depth is supported.

Filter using where-clause

Super Metrics can perform mathematical functions on objects down the inventory. Means, you can for example sum active memory of all VMs within a cluster in a simple formular. But what if you don’t want count all of these objects? To accomplish this, the where-clause is your friend. Unfortunately, it is not always easy to use where.

Let’s go into it with a simple example. We want to have a metric that counts all running VMs of a cluster, except vSphere Cluster Services (vCLS) VMs. The simple idea is to take the Number of Running VMs metric from the cluster and subtract all vCLS VMs. Working formular:

sum({‌THIS: ‌Summary|Number of Running VMs}) - count({‌Virtual Machine: ‌Configuration|Name, depth=8, where = ($value contains 'vCLS')})

This metric is defined on a cluster level. Therefore Number of Running VMs is taken directly from the cluster. Since there is no metric for running vCLS VMs we need to count them. This happens in the count function. We count VMs, that apply to the filter: Name contains 'vCLS'. The variable $value contains the metric we queried from each VM: its name. For other comparison, equals and startsWith can be used.

Now we want the number of all vCPUs of all running VMs, except vCLS VMs. This example is to show a more powerful operation using the where-clause. Again, the simple idea is to take the information of all vCPUs of all running VMs from the cluster level und subtract vCPUs form vCLS VMs. Formular needs to be adjusted because on the one hand we want vCPU count of each vCLS but we determine a vCLS by its name. So we need two different metrics respectively parameter of each VM. The first intuitive attempt leads to an error.

[Incorrect resource entry: ’objecttype’ already exists. It must be specified only once.]

The message says, objecttype must be specified only once. This is a little bit tricky in the editor. To correct this, switch to Unformatted and change the formular there. You need to remove adaptertype and objecttype within the where-clause. Take care of the parenthesis and curly brackets!

When the syntax is correct, you will see a change in the formatted version.

sum({‌THIS: ‌Summary|Number of Running VMs}) - count({‌Virtual Machine: ‌Configuration|Name, depth=8, where = ({metric=‌: ‌Configuration|Name} contains 'vCLS')})

Note

  • contains, equals and startsWith are casa sensitive.

Query for vSphere Tags

Another very useful feature is the ability to query for vSphere Tags in Super Metrics. Let’s start with a simple example. We want to count all VMs assigned to a specific tag. I use the where-clause in this code too.

count({‌Virtual Machine: ‌Summary|vSphere Tag, depth=8, where = ($value contains 'Backup-daily' )})

Looks easy, but a few words of explanation are necessary. Technically, vSphere Tags are returned as a array of strings in Aria Operations. But in vSphere vCenter Tags are a combination of a category and a value. In my example, assigned tags looks like this:

Tags view vCenter vs Aria Operations

Delimiter between category and tag is a hyphen (“-“). According to my tests, each combination works: hyphen in category and/or tag-name. Because it is a array of strings, you need not to enter the whole category-name combination. So it is also possible to search just for category or tag name.

What about AND/OR operators? Works as well: use “&&” for AND and “||” for OR:

count({‌Virtual Machine: ‌Summary|vSphere Tag, depth=8, where = ($value contains 'Backup-daily' && $value contains 'Backup-Windows')})

respectively

count({‌Virtual Machine: ‌Summary|vSphere Tag, depth=8, where = ($value contains 'Backup-daily' || $value contains 'Backup-Windows')})

If-Else conditions

What if the value I want to calculate with depends on the value of a metric? For this purpose you can use the if-else conditions. There are some restrictions that limit the use of if-else. So with current versions, it does not work to use strings in conditions. Aggregating via objects does not seem to work either.

Basically, if-else in Aria Operations looks like this:

{‌THIS: ‌Disk Space|Snapshot Space} > 0 ? 1 : 0​

What it means: “if used snapshot space is greater than 0, than value is 1, else value is 0”. And this is the essence of if-else. You can query a metric but return your own value.

Honestly, with the ability of the where-clause, if-else use cases are rare. Nonetheless I have a real world example. With it I partly overcome the mentioned limitation of using strings. Goal is to have a Super Metric that depends on the name of a cluster. We use this as a threshold for pCPU to vCPU ratio. For example, in all clusters a 4:1 ratio is fine, while in Cluster-01a 2:1 should be the upper limit.

count({‌This Resource: ‌config|name, where = ($value equals 'Cluster-01a')}) == 1 ? 2 : 4

I use the trick to count all clusters having the desired name. Since this metric is defined on cluster level, count can return either 1 or 0. If one is found, value is 2 otherwise it is 4. Unfortunately this does not scale if each cluster needs a different value.

Notes

I hope this post helps in defining more advanced Super Metrics in Aria Operations. See also the short list of other posts:

Leave a Reply

Your email address will not be published. Required fields are marked *