• 0

AppliesTo Scripting Question


Go to solution Solved by mnagel,

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

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
  • Solution

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*"

 

  • Like 2
Link to post
Share on other sites
  • 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 :).

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.