VMware Cloud Community
Henrique_Cicuto
Enthusiast
Enthusiast

Super metric won't appear

vROPs 7.0.0.10098133 build 10098133

I´ve created a Super Metric using the guestFullName VM property.

The complete formula is This Resource:config|guestFullName constains CentOS ? Linux : NotLinux

Basically what I'm trying to do is for vROPs to say "Linux" if the VMs is running a CentOS and "NotLinux" if it isn't. Mostly that's me trying to understand the ? and : operators.

The thing is that this Super Metric won't show.

I've already binded it to the VM object and adjusted the "State" within my policy but this super metric simply won't show up in a VM "All Metrics" option.

I tried creating another Super Metric (config|hardware|memoryKB/1024) just for testing and this one showed up correctly.

Does anyone know why my first Super Metric does not appear?

Thank you very much.

Reply
0 Kudos
3 Replies
sk84
Expert
Expert

I'm not sure, but I don't think it works that way. Ternary operators in vROps can only handle numbers. Not strings, as far as I read in the documentation.

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.

Enhancing Your Super Metrics

I know this documentation is for vROps 6.6, but I can't find any evidence that this behavior has changed in version 7.0. And since your other supermetric works (which is based on numbers), I assume that this limitation of the ternary operators is still valid.

--- Regards, Sebastian VCP6.5-DCV // VCP7-CMA // vSAN 2017 Specialist Please mark this answer as 'helpful' or 'correct' if you think your question has been answered correctly.
Reply
0 Kudos
sxnxr
Commander
Commander

What is your end goal? There may be another way to do it

Reply
0 Kudos
Ryan701
Enthusiast
Enthusiast

Maybe try not using a Super Metric and create a tag in vcenter with the value you want to show up on the vm in vROPS.

Reply
0 Kudos