VMware Cloud Community
MickOToole
Contributor
Contributor

VROPS Super Metric: if then else (if clustername equal "ClusterName" then vale equal 3 else 4)

Hi Folks, hoping someone can help me with this one. 

I am trying to do a if then else in a VROPs super metric. Effectively what i am trying to do is to check if the name of the cluster matches a string and if it does the value is equal to 3 and if not the value is equal to 4. 

This is done in the format:

expression_condition ? expression_if_true : expression_if_false.

I am trying: 

${adaptertype=VMWARE, objecttype=ClusterComputeResource, attribute=config|name, depth=1}contains"ClusterName" ? 3:4

has anyone achieve something similar. i have tried a few different variations of the above but no joy. I have seen similar stuff done with numeric metrics but not with string values. 

 

Tags (2)
Reply
0 Kudos
2 Replies
sennevanlaer
Enthusiast
Enthusiast

String operators are valid in 'where' condition only. For example: ${this, metric=summary|runtime|isIdle, where = "System Properties|resource_kind_type !contains GENERAL"}

https://docs.vmware.com/en/vRealize-Operations/Cloud/com.vmware.vcom.config.doc/GUID-7A557E72-0FD0-4...

Reply
0 Kudos
MickOToole
Contributor
Contributor

thanks very much for the reply, that explains why i cant get the IF statement to work with the string. 

I don't see how i can achieve what i am trying to do with the where clause in VROPs as it look like i can only return one value using the where clause. I am trying to return a value for some cluster and a different value for another cluster. 

 

Reply
0 Kudos