Relevance for checking if a property is in a list of of values

Hi, im trying to run the following relevance query through the API but im not sure what the proper syntax is for checking if a value is in a list:

(id of it, hostname of it, last report time of it) of bes computers whose (id of it is in (16230263,15670199))

What would be the proper way to check for inclusion in a list?

Based on what I found in another thread I got my query to work by changing it something like this:

(id of it, operating system of it) of bes computers whose (\"|\" & id of it as string & \"|\" is contained by \"|16230263|15670199|\")

It works fine for short lists of id’s but fails at sending a list of a couple thousand id’s with an error message of “This expression has a very long string.” even though it was a short enough POST request for it accept the overall HTTP request.

What is the query string length limit? Ive tried splitting that long joined id string into chunks of 512 characters or less joined by & but it doesnt seem to help.

Changed it to the following to get it to work by breaking the large string into chunks no bigger than 512 characters and casting each chunk to rope and joining with &:

(id of it, operating system of it) of bes computers whose (rope \"512 char string\" & rope \"512 char string\" contains \"|\" & id of it as string & \"|\")

This is how:

(names of it, id of it) of  bes computers whose ( exists (id of it) whose( it is contained by set of (16230263;15670199) ) )

I tried a variation of that but the set is so large it hangs and doesnt seem to run where as the long string does work when done as ropes.

Try this:

(names of it, id of it) of  bes computers whose ( (id of it) is contained by set of (16230263;15670199) )

It may hang because it must do this comparison for every computer in the environment and if that is too many that it must do this comparison for, then it could hang.

How many entries do you have in your list of computer IDs?

How many computers do you have in your environment?

Is there something you could do to reduce the number of computers that must be examined by checking the IDs, like filter by OS first, or a particular computer group?

What is it that you are trying to do? Maybe there is a better way to go about it?

It seems like you could just define an automatic computer group with the right criteria, then just get the members of the group, instead of needing to do this with the list of IDs, but even if you did need to do the list of IDs, you could do that as the criteria for the membership in the automatic computer group.

Some of my customers could have up to a few thousand in a group so I had to implement in a way that i was guaranteed it could handle the query for automation through the API. I am ultimately using groups though, but I did initial testing on the larger set of about 7k computers.

But what I don’t understand is why aren’t you just getting the members of the computer groups you want, instead of trying to filter all bes computers?

members of bes computer groups whose(id of it = COMPUTER_GROUP_ID)

example that will work, but slower:

members of bes computer groups whose(id of it = minimum of ids of bes computer groups)

or, if you want members of multiple computer groups:

names of unique values of members of bes computer groups whose( (id of it) is contained by set of (COMPUTER_GROUP_ID1;COMPUTER_GROUP_ID2;COMPUTER_GROUP_IDN) )

It is going to be much easier to get the set of members of a set of computer groups than it is to try to filter all computers by specific ID when there are 7k specific IDs that you are trying to filter down to.

What is the result you are trying to get to? what, generically are you trying to accomplish?

One option would be to define a new computer group for this particular purpose and have it contain the members of any other groups that should be collected up and targeted by whatever you are trying to do. This new computer group could also be defined using any arbitrary relevance you want. This will cause the clients to self organize into the group that you need on their end, and then you just target that group.

Im doing automation bridging SoftLayer and IEM through the IEM API so while im starting off with an individual computer hostname or computer group, I need to filter that down to select the computers and eliminate computers with the same hostname by selecting only the one with the latest last report time in order to run actions on the right ones. I have customers with a ton of computers in IEM with hostname ‘localhost’ for example, but I dont know if its also possible for that to occur within groups so I always filter for dup hostnames. Im doing the duplicate reduction in code rather than in the relevance query as I dont know how to do it in that or if its even possible. When im getting the computers by group i do use members of computer group.

I end up with a list of computer ids to then query for computer properties or run actions against. I could query for all the details (id, hostname, os) at once at the expense of getting more detail than i need for computers I will eventually drop from the list anyway but I just separate the queries instead and ask for the properties once I have the final filtered list of computers.

The issue is that I dont know how many computers are in a group and given the large volume of computers my customers have, I need to make sure the query will not hang, so I went with the rope method which works out ok and doesnt hang.

If the computers with duplicate hostnames are the same computer, just rebuilt or showing up as a duplicate for some other reason, then there is no harm in targeting the older one with an action since it will never do anything.

If there are different computers actively reporting but have duplicate hostnames, then you’ll be only running on whichever one has reported most recently and excluding the other one, which you may need to run on.

I don’t know of a good option for only targeting the most recent report time of a particular hostname in relevance.

It may actually be more efficient to pull back the details of all of the computers of a computer group rather than trying to build a list of computer IDs to filter and then pull back the properties like you are.

If your starting point is a computer group which you filter down removing duplicates, but then you want to get properties of them, then you should do it like this:

(names of it, id of it) of members whose( (id of it) is contained by set of (16230263;15670199) ) of bes computer groups whose(id of it = COMPUTER_GROUP_ID)


(names of it, id of it) of members whose( rope \"512 char string\" & rope \"512 char string\" contains \"|\" & id of it as string & \"|\" ) of bes computer groups whose(id of it = COMPUTER_GROUP_ID)

This will only be working with the original set of computers already in the group, but filtering them down further to just the de-duped set. This will be more efficient using either the set method or the rope method.