Relay Server Identification Using API Call

Is their a way to to pull all the Relay Server information using Rest API Call ? I had tried below query but does not get any success.

https://MainBigFixServer:52311/api/query?relevance="if exists relay service then “Yes - " & state of service “BESRelay” else if exists main gather service then “Main BES Server” else “Not Installed””

If you want the list of Relays/Root and their status, then this works. However, when using these queries in the API like you’re doing, I’ve found success with url encoding the session relevance from a site like https://www.urlencoder.org and then using it in your https://MainBigFixServer:52311/api/query?relevance=< session relevance >

(name of it, value of result from (bes property "BES Relay Service Installed") of it) of bes computers whose (relay server flag of it or root server flag of it)

1 Like

i can’t help with Rest API but we have an analysis for relays that

image

1st thing is why you want to get results using API, if you just need this info you can get it from console or directly from Webreport simply, moreover you can also schedule that report to your email Ids and webreport will give you more option to add whatever other required RP/column info you want to get with that.

Or you can also create custom HTML based webreports with that data, something like below-

Appreciated, Worked for me :smiley:

In testing the REST query, the results are inconsistent, I’ve seen it miss between 1 and 30 agents per execution.

https://123:52311/api/query?relevance=(IDs of it , Names of it , Relay Server Flags of it , Operating Systems of it , Last Report Times of it, Relay Selection Method of it) of bes computers whose (agent type of it = “Native”)

The following results were generated executing requests back-to-back to avoid any potential differences due to timing:
First Execution output :- 54568
Second Execution output :- 54572
Third Execution output :- 54532

Please suggest why servers counts are mis-matching between each execution ?

Suggest trying the query formats at Efficient Session Relevance Query for Computer Properties

That adds handling for duplicates properties, missing results for a property, etc.
In that form you can compare the results between queries to see which machines are being added, removed, or missing results, and possibly identify issues in your environment.

Issue which I noticed in below API call is when I add Relay Server Flags of it that time Count of Server is mismatching per execution but without having Relay Server Flags of it in below API query server count always remains Same.

https://123:52311/api/query?relevance=(IDs of it , Names of it , Relay Server Flags of it , Operating Systems of it , Last Report Times of it, Relay Selection Method of it) of bes computers whose (agent type of it = "Native")

So, do I need to mention the Relay property in different format ?

Have anyone faced this issue in past ?

I’m confused, do you only want the results from relays themselves, or you want this info from all computers?

What is the final output you are looking for?

Also, I would recommend testing the session relevance in the Console Presentation Debugger or similar until you have it working exactly the way you want, then look at using it through the REST API from there. See here: https://github.com/jgstew/jgstew.github.io/blob/master/_posts/2018-10-29-Open-BigFix-Console-Presentation-Debugger.md

This should represent the maximum number of devices you should get in the results:

number of bes computers whose (agent type of it = "Native")

This would be to get the results from only Relays, not other clients:

number of bes computers whose (agent type of it = "Native" AND Relay Server Flag of it)

I think this is what @JasonWalker is suggesting you try:

(id of it as string | "UnknownID", name of it | "UnknownName", operating system of it | "UnknownOS", last report time of it as string | "UnknownLastReport", relay selection method of it | "UnknownRelayMethod") of bes computers whose (agent type of it = "Native" AND Relay Server Flag of it)

Something like this is required, because otherwise any computer who is lacking one of the things being queried will be silently removed from the results when using plural session relevance. This can be a good thing for efficiency reasons, but a bad thing if you are trying to include all possible items.

Basically I need all Server information along with Relay Flag entry. So, that anyone can identify from same report on x Server Client is installed and on y Server Client and Relay both are installed.