Question

I'm trying to get a subset of devices, but my filter isn't filtering... here's my path and query, anything obvious that I'm doing wrong here?

$resourcePath    = "/device/devices"
$queryParam      = "?size=1000&filter=CollectorId:'$($collector.id)'"

$collector is previously gathered and the '$($collector.id)' resolves the way I expect it to ... '12' in one case.  But it's getting every device (first 1000) rather than pre-filtering to members of a specific collector.

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Ultimately, the goal is to get a count of all of the instance per device per collector group so I can sort them and have a script manually re-balance the "auto-balancing" collector groups (ABCG) in our environment.  I intend to run this either once a day or once a week, then let the normal ABCG algorithms handle the load in-between.  As it sits, all of our VM Hosts have migrated to once collector, and all of our VMs to the other in the group, leading to massive CPU and port availability problems when batchscripts are run against WMI counters.

I have to figure out how to get those per device instance counts next.

Share this post


Link to post
Share on other sites
  • 0

try:

$resourcePath    = "/device/devices"
$queryParam      = "?size=1000&filter=preferredCollectorId:`"$($collector.id)`""

I don't think CollectorId is a valid property for devices and APIv2 docs say to use double quotes with filters.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Can you think of a quick and dirty way to get a count of instances per device?  That's my last step before writing the logic to perform the device redistribution across an ABCG.

Share this post


Link to post
Share on other sites
  • 0

I think my approach is going to be to walk from the instances up to build out a dataset.

  1. Instances
    1. - InstanceID
    2. - DeviceID
    3. - PrefCollectorID
  2. Collector
    1. - ID
    2. - CollectorGroupID

So each object in my data set will contain the info to relate the instance to the Device and the Collector Group.  That will allow me to gather the # of instance / device, sort by that, then distribute to the collectors in the group in a round robin fashion.  Just have to figure out how to gather the next 1000 instances :)  I have that code somewhere laying around.  Nearly there.

Edited by Cole McDonald
fixing lists... Lists don't work in formatting here.

Share this post


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.