Forum Discussion

MichaelW's avatar
5 years ago

AppliesTo Scripting Question

Hi

I have spent some time trying to work this out but need. My environment consists of about 30 vCenter Servers (including their hypervisors). I am trying to create a dynamic group with a custom query that finds all those hypervisors with a certain property. In this instance, I am looking for specific versions of ESXi so have got the following custom query:
isVirtualization(contains(auto.version_number,"6.5.0"))
It picks up the ESXi hosts that are at version 6.5.0 but it also picks up ESXi hosts on other versions. Please can someone help point out where I am going wrong?

I will also look to expand it to include 6.7.0 and 7.0.0 first things first.

Thanks for any assistance.


Regards,

Michael

  • It sounds like you are expecting a function to be able to take arguments, because "function".  I did as well many years ago when I wanted to create a single isClient function with the client name as an argument, but found after a very painful support ticket that they absolutely are not functions, just macros.

    You would need to write a separate version for each check.  In this case, you would have to add a new function like this and a new one for each version:

    system.virtualization=~"VMware" && auto.version_number =~"6\\.5\\.0*"

     

  • 2 minutes ago, Stuart Weenig said:

    AppliesTo Functions is a misnomer. They should be AppliesTo Aliases.

    Yeah, brings back horrible memories of me requesting repeatedly the documentation on how to pass parameters and getting the most insane response from support :).

  • Anonymous's avatar
    Anonymous

    AppliesTo Functions is a misnomer. They should be AppliesTo Aliases.

  • Apologies for only getting back to you now @mnagel and thanks for the reply. Has given me plenty to work with.

  • It sounds like you are expecting a function to be able to take arguments, because "function".  I did as well many years ago when I wanted to create a single isClient function with the client name as an argument, but found after a very painful support ticket that they absolutely are not functions, just macros.

    You would need to write a separate version for each check.  In this case, you would have to add a new function like this and a new one for each version:

    system.virtualization=~"VMware" && auto.version_number =~"6\\.5\\.0*"