vRops

vRops API | Super Metric name

This is gonna be a short one. If you have been following my blog you will know that I have been using vRops API quite a bit lately and all in all, I’m quite happy with the way it works and the data you can get out of it. There are of course room for improvement. One of the things that currently doesn’t work that well, are Super Metrics. If you know Super Metrics, this is a way to create new metrics which is created from other metric(s). The problem with Super Metrics is the name it’s given by vRops.

An example of a Super Metric key would be “Super Metric|sm_00fdeb25-6821-47b4-adc5-59638e613f7d”. This doesn’t really say a lot about what is behind the given Super Metric name, which makes it quite hard to use Super Metric in a more generic term.

Luckily vRops API has a way of handling these Super Metrics. First thing we need is to understand what behind the Super Metric key naming. The first part is generic, so all Super Metrics start with “Super Metric|sm_”, the last part is the one that is interesting to us. This is the resource id, which mean that this id can be used to get a proper name for the Super Metric.

 

Super Metric let’s get cracking

Below is an example of a way to get the name of a Super Metric. $Line here is the Super Metric key.

Invoke-RestMethod -Method Get -uri "https://$vRopsIP/suite-api/api/supermetrics/$($Line -replace "Super Metric\|sm_")" -Credential $cred).supermetric.name

 

Continuing down the path. Here the full path is to a Super Metric, with the Super Metric key in the end of the URL. As it can be seen in the picture below, id, name and formula of the Super Metric is available. Especially the last part, the formula, is interesting as it gives an even better understanding of the metric.

SuperMetric-xml

Feature Request

This could all have been so much easier if vRops had a pretty name for it’s Super Metric and that it was possible to consume that via the API, but also this could be used in the vRops gui, so that graphs and so on could have a proper name, instead of the metric key which is used today.

So a field during the creation of a Super Metric in where one could define a name to be used, in vRops graph etc.

Leave a Reply

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