top of page

Converting Property Strings to Metrics in VCF Operations

  • Writer: Brock Peterson
    Brock Peterson
  • 7 days ago
  • 2 min read

There are times you may want to convert Property Strings to Metrics in VCF Operations, for example maybe you want to convert ESX Host Property Power State (Powered On or Powered Off) to 1/0. Or maybe you want to convert Cluster Property HA Enabled (true or false) to 1/0. One reason would be to then use these Metrics in a VCF Operations Dashboard Heatmap Widget, which only accepts integer values. Here's how you do it.


We'll start with an ESXi Host Property called Power State, but this same thing could be done for any binary String Property. Note all screenshots here are taken from VCF Operations 9.


ree

As you can see this is a String, with two potential values: Powered On of Powered Off. I'd like to convert those to values to 1 or 0, which I'll do with a Super Metric.


Go to Infrastructure Operations - Configurations - Super Metrics - ADD.


ree

Give it a name and description and click NEXT.


ree

Select Host System, this is the Object Type against which the Super Metric will be defined. Click NEXT.


ree

Generally, Super Metrics don't support strings, but the where operator allows us to work with them. In this case we're using the count function in a way that will give us one of two results:

  • If Power State is "Powered On" the Super Metric will return 1

  • If Power State is "Powered Off" the Super Metric will return 0


Click NEXT and enable in whatever Policies you'd like.


Back on an ESXi Host we can now see our Super Metric.


ree

We now have an integer representation of a String Property we can use in Heatmaps! You can use this same methodology for any String Properties that are binary (either one value or another). If you'd like this Super Metric you can download it here, enjoy!

    bottom of page