Getting Settings from servers in a group via API

I currently use this relevance in my .net app to query the API. I am pulling various settings from each server:

        string relevanceQuery = @"
            (
            id of it,
            name of it,
            ip addresses of it,
            last report time of it,
            value of client setting whose (name of it is ""wev_patchDayOffset"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_patchHour"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_patchMinute"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_rebootDayOffset"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_rebootHour"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_rebootMinute"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_groupClassID"") of it | ""-1""
            ) of bes computers";

I tried to modify this so it only pulls the data from server that are in the group named “KRO - All Windows Servers” but it still is pulling from all servers. Here is what I have:

        string relevanceQuery = @"
            (
            id of it,
            name of it,
            ip addresses of it,
            last report time of it,
            value of client setting whose (name of it is ""wev_patchDayOffset"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_patchHour"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_patchMinute"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_rebootDayOffset"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_rebootHour"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_rebootMinute"") of it | ""-1"",
            value of client setting whose (name of it is ""wev_groupClassID"") of it | ""-1""
            ) of members of bes computer group whose (name of it as lowercase = ""KRO - All Windows Servers"" as lowercase)";

The KRO - All Windows Servers group only has about 4200 members, but in mass all of my servers the total is 5598. Each of these two relevance strings pulls the data from all 5598 servers.

What am I missing?

Your session relevance query is almost correct, but there’s a key issue: the use of value of client setting is invalid in session relevance. These inspectors are client-side and cannot be evaluated in a session context.

While you’re using a fallback (| "-1") to avoid errors, it masks the underlying issue, which is that these lines aren’t returning real client setting values from the server, just default fallbacks.

As for the discrepancy in the number of returned results, it’s likely due to this line:

relevance

ip addresses of it

If a single device has multiple IP addresses, it will produce multiple rows—one for each address. Try deduplicating the results based on the computer name to get an accurate count that matches the expected number of group members.

Update: if there is an RP, value of the client setting is being returned using a that retrieved property. If so, use the following method to call their results against each device from that group.

value of results from (bes property "wev_patchDayOffset") of it as string | "None"

It is a valid session relevance inspector. https://developer.bigfix.com/relevance/reference/bes-client-setting.html

@paulhlee possible your are seeing multiple results for the same server due to multiple IP addresses. Say “Server1” has 3 active IP addresses, that would return 3 rows in your results. Hopefully concatenating the string results of “ip addresses” would avoid that.

(
id of it,
name of it,
concatenation ", " of (ip addresses of it as string),
last report time of it,
value of client setting whose (name of it is ""wev_patchDayOffset"") of it | ""-1"",
value of client setting whose (name of it is ""wev_patchHour"") of it | ""-1"",
value of client setting whose (name of it is ""wev_patchMinute"") of it | ""-1"",
value of client setting whose (name of it is ""wev_rebootDayOffset"") of it | ""-1"",
value of client setting whose (name of it is ""wev_rebootHour"") of it | ""-1"",
value of client setting whose (name of it is ""wev_rebootMinute"") of it | ""-1"",
value of client setting whose (name of it is ""wev_groupClassID"") of it | ""-1""
) 
of members of bes computer group whose (name of it as lowercase = ""KRO - All Windows Servers"" as lowercase)"
1 Like

Good to know! I never realized we could actually do that. :slightly_smiling_face:

1 Like

That was it! Thank you… i still have SOME of my hair left at least :slight_smile: