Query check server status

I have this function which checks for server status before running the action.

but it gets messy when none of the server exist in the bigfix then it return all the servers from bigfix. And if the server is registered under fqdn instead of shortname then it return empty also.
I am not sure how to make the server check more resilient in case of server is present and if its registered under shortname or fqdn.

Take a look at those server inspectors:

Q: host name of root server
A: nc926040.xxx.xxx.com

Q: name of selected server
A: nc926040.xxx.xxx.com

Q: apparent registration server time
A: Wed, 23 Oct 2019 10:30:27 +0200

If i have these computer targets in the xml.
abc
def.xyz.com
123
456.abc.com
768

But in the bigfix server “768” registered as fqdn like 768.pyq.com. then I don’ t the status of the server back. That’s where the query fails.

If I have the computer targets in the xml like this
abc
def
123
456
If all these host registered as fqdn instead of shortname then I will get the full blown list of the servers from the bigfix.

The computer name registeredin bigfix is exactly what the endpoint reports as its “hostname”, which can vary based on the computer configuration. Linux endpoints especially have a tendancy to vary and include the FQDN depending on their config.

If you want to target by name, you shoukd first send a sessiin query to retrieve the correct names (or better, computer ids).

Looks like you’ve figured out the API pretty well, so try sending a relevance query using the /api/query resource and parse the results. Try

/api/query?relevance=(names of items 0 of it) of (bes computers; set of ("name1";"name2.domain.com")) whose (name of item 0 of it is contained by item 1 of it or preceding text of first "." of name of item 0 of it is contained by item 1 of it)

I think that will not make efficient way for me to verify the server to pull the 10K server from the bigfix and verify the computers which i am carrying via xml.

I am using the xml with limited amount of server ( 20 -50 per count) to verify if they are present in the bigfix.

Another issue I have encountered. If i entered more then let say 100 computers in the xml. It takes nosedive and give the full the 10K in return instead of what I asked for.

I am firing all my action via restAPI using python. Python script spawn the action and cyclically check the status of the action til its done using recursion function.

That sounds like a tough problem. The root of it, is that your list of hostnames is simply not correct. The method I describe is a pattern-matching to try to guess the correct hostnames based on pattern-matching your input, but yes I agree the better solution is to correct your hostname list.

As far as returning all servers when none of the hostnames match, that may well be a product bug and you should open a support ticket on it. What version of BigFix Server are you running?

Finally, the method you’re using is the ClientQuery api resource - this has to propagate a query all the way to the endpoint to get a response back. You won’t get responses at all for servers that are turned offnor have the UDP traffic blocked. Just wanted to make sure that is your intention?

We are using 9.5.11 across the board.

Yah, we do have hostname issue when I get the list from the user. No body pulled the list from Bigfix and by which name server is registered under bigfix.We have only 2 people who has access to bigfix. I am the one of them who has bigfix access.

User pulled the list from another source like CMDB, and then I run the action on the list of server which user provided. I have no way of knowing if host registered under fqdn or shortname in bigfix. Its kind of tricky to validate by what fqdn/shortname server registered under the bigfix.

Another interesting behavior is if I fire the action under shortname but bigfix has fqdn then action don’t do anything and my python recursive function which check for the action status stuck in inifnite loop.

This is function which validate the action status. I am not sure if there is any effective way of catching the action status.

Yeah, as much as I dislike using spreadsheets for stuff like this, it does seem to be a “useful hack” that gets put into practice all-too-frequently.

Depending on how much control you have over the workflow, you might find it useful to create a new custom property to track “short name”. It’s relevance would be
(preceding text of first "." of it | it) of (computer name as lowercase)

This way, you get a lowercase version of every hostname, and no FQDN included. You can export a CSV mapping this short name to either the “real” hostname or computer ID, and do some Excel magic to map these to the spreadsheet list your CMDB is providing. Then you’d send your API actions based on the “real” name or computer ID resulting from the CMDB mapping instead of using the CMDB name directly.

If you’d like to pursue a tighter integration (for instance where BigFix updates the CMDB to reflect tge actual hostname, serial number, installed software list; or where the CMDB workflow can directly create BigFix actions, etc.) that is something we could help with in Pro Services, or you could engage one of the several partners who post about their integrations here. I understand there are some out-of-the-box integrations planned as well in the product roadmap.

yah I think I have to do some sort of hostname massaging before passing to action script after validating with bigfix inventory.

We can’t push the bigfix to update the cmdb, too much of politics/bureaucracy involved in that.