REST API, Query, Relevance and three states

Greetings Bigfix enthusiasts. I think I am close to my “ah ha” moment but I may also be very close to a “ha ha” moment instead.

I’m looking to build a utility that makes a call via the REST API that will provide me with state of three services for a group of computers. It doesn’t really have to be a REST API call but I saw this as an opportunity to learn.

For each of our bes computers having a name beginning with “2slb” I’d like to retrieve;

  1. state of service “besrelay”
  2. state of service “remboserver”
  3. state of service “RemboODBC”

My attempts at the (session) relevance (using the presentation debugger) are hitting various errors mostly related to “service not defined”, “results from” not defined, etc.

If there is a more appropriate API to use then /api/query please let me know. I’ve tried analysis, computer, and properties all without success.

Any assistance is very much appreciated. I’m motivated… but kind of chasing my tail.

Thank you for your time!

Before you try the REST portion of it, it’s helpful to build your Session Relevance query separately. A good tool for that is the advanced Web Reports QNA page. You need to specify the QNA page directly in your browser.

The REST API isn’t sending queries directly to the clients; instead it is querying the BigFix Server’s database, to see what results the clients have previously posted. So instead of inspectors like “services”, you’ll need to be looking at things like ‘results of bes properties’.

1 Like

Thank you for that Jason. I’ve found the QNA tool and will begin looking into “results of bes properties”.
I appreciate the guidance!

So, I’m still not “getting it” yet. I’m hoping you can lead me by the noise a little further.

I have been reviewing a number of your (@JasonWalker) posts related to ‘results of bes properties’ but I am still struggling.

I’m having trouble understanding how to write the relevance to mimic what in my mind is a loop.

Based on one of your posts (from several years ago) I created something that got me a little closer but I’m just not seeing how to modify it to include the other 2 properties I need status of. Do I need to just run three separate queries and then combine them somehow?

(names of computers of it, values of it ) of results of bes properties whose (name of it = “ODBCServiceStatus”)

I’m hoping for output like;

computer ODBCServiceStatus RelayServiceRunning ServerServiceStatus
puter1 Running Running Stopped
puter2 Running Stopping Stopped
puter3 Running Running Running

Any suggestions on how to modify this to return the name of the computer and only three of the properties; ODBCServiceStatus, RelayServiceRunning, and ServerServiceStatus? This current sentence returns all of the properties.

((values of it, name of computer of it) of results of it, names of it) of properties of bes analysis whose (name of it is “OS Deployment Server Information”)

Apologies, I don’t have a server handy right now. Are all three of these properties part of that same Analysis? If so, I’d try

Q: (name of item 0 of it, value of result (item 0 of it, item 1 of it) | "Not Reported", value of result (item 0 of it, item 2 of it) | "Not Reported", value of result (item 0 of it, item 3 of it) | "Not Reported") of (applicable computers of item 0 of it, item 1 of it, item 2 of it, item 3 of it) of (it, properties whose (name of it = "ODBCServiceStatus") of it, properties whose (name of it =  "RelayServiceRunning") of it, properties whose (name of it =  "ServerServiceStatus") of it) of bes analysis whose (name of it is "OS Deployment Server Information")

A: OSD, Running, Running, Running

edit: I think I used the creation for ‘property “Something” of it’ incorrectly.
edit2: Corrected the incorrect relevance that was here. You’re welcome, future people.

The Web QNA you showed me returns an Error of ‘The operator “reported computers” is not defined’.

Could that be a symptom of the possible misuse of the creation property or something different?

Ah, yes, I should have used ‘applicable computers’ rather than ‘reported computers’. Here’s a version I was actually able to test today

Q: (name of item 0 of it, value of result (item 0 of it, item 1 of it) | "Not Reported", value of result (item 0 of it, item 2 of it) | "Not Reported", value of result (item 0 of it, item 3 of it) | "Not Reported") of (applicable computers of item 0 of it, item 1 of it, item 2 of it, item 3 of it) of (it, properties whose (name of it = "ODBCServiceStatus") of it, properties whose (name of it =  "RelayServiceRunning") of it, properties whose (name of it =  "ServerServiceStatus") of it) of bes analysis whose (name of it is "OS Deployment Server Information")
A: OSD, Running, Running, Running
1 Like

Thank you very much for that Jason. It’s perfect.

If I could impose upon you once more… aside from that info being in your head… where else might I be able to find it? When you used “applicable computers” in place of “reported computers”… where could I have found that?

My major reference point is the relevance section of the Developer’s Page. Can you suggest any other sources you find useful?

I ended up finding that on the developer page as well, but it helps to know that ‘bes analysis’ is a shortcut for ‘bes fixlet’.

https://developer.bigfix.com/relevance/reference/bes-fixlet.html#properties

When in doubt, Introspectors are useful too. You can do a query such as

properties of type "bes fixlet" in the Console’s presentation Debugger or the Web Reports QNA page.

1 Like