3 Replies Latest reply on Feb 1, 2019 7:48 AM by Ryan701

    Super metric won't appear

    Henrique_Cicuto Enthusiast

      vROPs 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.

        • 1. Re: Super metric won't appear
          sk84 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.

          • 2. Re: Super metric won't appear
            sxnxr Master

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

            • 3. Re: Super metric won't appear
              Ryan701 Novice

              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.