Script Needed to get the Data from BESDatabase

Hi All,

I want to get the computer property details like RAM, Computer name, OS, CPU, User name, Bios and etc… using RESTAPI method and those results need to be stored another database (SQL Server) using any script (VBS, shell, perl),

I am not much strong in scripting site, so how to start or archive this requirement, appreciate your help and input,

Thanks,
Nagaraj,

To build a custom application to meet your needs I’d strongly suggest you engage with Lab Services or Professional Services. They can work with to deliver a product tailored to your requirements.

2 Likes

If you have no experience with scripting nor REST client creation, start here:
https://developer.bigfix.com/rest-api/iem_cli/iem_samples.html

https://domain.bigfix.com:52311/api/query?relevance=( value of result (bes property “user name”, it)) of bes computers

when I am running this queries getting below error,

		<Answer type="string">Administrator</Answer>
	</Result>
	<Error>**ngular expression refers to non-unique object.</Error>

If there are more than 1 logged in user, the results would be plural but your query is singular. Try pluralizing it as

(values of results (bes property "user name", it)) of bes computers

thank you @SLB, it is working

When you get the core pieces of your integration working, there is a blog posting about making the session relevance query more error resistant and efficient over here:
https://www.ibm.com/developerworks/community/blogs/e9d21113-aa93-467e-ac77-a0d20a21eaec/entry/Session_Relevance_Computer_Properties_query_Efficiency?lang=en

2 Likes

One note to share from my experience of session relevance, if you are dealing with properties that computers may not have reported, these will tend to cause all data for the computer to be omitted from the results. One of the top tips I learnt from the MasterClass I was fortunate to attend was how to overcome this using @brolly33 approach. https://www.ibm.com/developerworks/community/blogs/e9d21113-aa93-467e-ac77-a0d20a21eaec/entry/Session_Relevance_Computer_Properties_query_Efficiency?lang=en. This is very useful for session relevance queries.

2 Likes

Ah, ya beat me to it John :slight_smile:

1 Like

(name of it, values of results (it, bes property “Computer Name”), values of results (it, bes property "IP Address") ) of bes computers

In this case in my environment all the machines having multiple IP address and while querying the IP it is showing multiple different entry like

Computer name - xxxxx
IP address - 10.10.10.4

Computer name - xxxxx
IP address - 10.10.10.5

Computer name - yyyyy
IP address - 10.12.12.5

Computer name - yyyyy
IP address - 10.12.12.6

Same computer name but 2 entry for IP address,
is this possible to show as a 2 entry ?

Yes. Brolly33’s blog linked earlier shows how to do that. Check the link. We put those there to help.

2 Likes

Without error handling,

(name of it, values of results (it, bes property "Computer Name"), concatenation ";" of values of results (it, bes property "IP Address")) of bes computers

Ideally aim towards using the method in @brolly33 blog post.

(name of item 0 of it | "Computer Name missing", (if (size of item 1 of it = 1) then ((if it = "" then "No values" else it) of concatenation ";" of values of results (item 0 of it, elements of item 1 of it)) else (if (size of item 1 of it > 1) then (concatenation ";" of values of results (item 0 of it, elements of item 1 of it)) else ("Property does not exist")))) of (elements of item 0 of it, item 1 of it) of (set of BES computers, set of bes properties whose (name of it as lowercase = ("IP Address") as lowercase))

1 Like