Client settings keyword missing error via bigfix action

facing issue while creating setting value if having special charater and throwing error , is there any way to skip special characters in the output ?

action uses wow64 redirection {not x64 of operating system}

action parameter query “Output_Folder” with description “Please enter the Folder Name and Path” with default value “”

if { not exists (parameter “Output_Folder”)}
folder create {parameter “Output_Folder”}
endif

parameter “output”="{lines of file “output.txt” of folder (parameter “Output_Folder”)}"

setting “ActionOut”="{parameter “output”})" on “{parameter “action issue date” of action}” for client

Error

Command failed (Missing ‘on’ keyword) setting “ActionOut”=" 55CPU Average--------------------------------------------------[ { “)\% processor time”, “InstanceName”: “services”, “CookedValue”: 59.374578440493075, “RawValue”: 111201093750, “SecondValue”: 132956234770855807, “MultipleCount”: 1, “CounterType”: 542180608, “Timestamp”: “/Date(1651149877085)/”, “Timestamp100NSec”: 132956432770850000, “Status”: 0, “DefaultScale”: 0, “TimeBase”: 10000000 },

You have a stray closing brace

update code but still getting same issue , looks like code is having issue with special characters which is there in the output.txt file , when i remove the special characters it creates the settings ??

action uses wow64 redirection {not x64 of operating system}

action parameter query “Output_Folder” with description “Please enter the Folder Name and Path” with default value “”

if { not exists (parameter “Output_Folder”)}
folder create {parameter “Output_Folder”}
endif

parameter “output”="{lines of file “output.txt” of folder (parameter “Output_Folder”)}“
setting “ActionOut1”=”{parameter “output”}" on “{parameter “action issue date” of action}” for client

Error:

Command failed (Missing 'on' keyword) setting "ActionOut1"="create the property ActionOut1asdfasdfsffasfasdfsa------------------------"Path": "\\\\srvat0045\\process(services)\\% processor time", " on "Thu, 28 Apr 2022 14:08:16 +0000" for client (action:12966)

I don’t think you’ll be able to apply that as a client setting, instead you should just read the output file as an Analysis property without trying to set it as a client setting.

thanks for your reply, if i set analysis then how i can get the latest data when i want to see the output from the analysis from a dynamic created folder as it may run at certain interval ? Is it possible to get the updated data at once ?

i need to call this settings as in rest call

https://appserver:52311/api/computer/1076481996/setting/ActionOut1

@JasonWalker Is there a way to strip out the special characters from the lines of file "output.txt"?

@Jason - Bigfix also has one Field - Comment

Is there a way we can add the data to that field using action script.

Also, is there a way we can read the output of that Filed “Comment” - via Rest API

Comment -

@batra_d

Session relevance does expose comments for most BES objects.
https://developer.bigfix.com/relevance/reference/bes-fixlet.html#comment-of-bes-fixlet-bes-comment

REST API does not expose the comments, but you can get to them using Query and passing the session relevance statement.

https://BigFixServer:52311/api/action/64543

No Comments.

This REST API query will show the comments:

https://BigFixServer:52311/api/query?relevance=(id of it, (name of author of it, text of it, timestamp of it) of comments of it) of bes action whose (id of it = 64543)

1 Like

Thanks a lot for your Response - It some how solved the purpose.
But can you please confirm that is i have to update/add a new comment using action script how can we do that ?

@batra_d
I do not think there is a way to add comments from inside of an action script running on an endpoint.
I think adding comments is a Console Only feature.
If there is a way, I would love to learn about it.

Updating the Comments on a computer would require authenticating to the Bigfix Console, it’s not something a client should be doing.

For your use case, the best method is still to have your Action write to a file, and an Analysis read the file. You still need to be careful about the number of files you’re reading and the sizes of those files, as reporting them as Analysis properties is going to consume database size. For example 10 KB of file lines reported by ten thousand computers is going to add a hundred megabytes of text to the database.

That said, the basic form of the Action would be something like

folder create "{pathname of parent folder of parent folder of client folder of site "actionsite"}\script-output"
wait cmd.exe /c "run-something.cmd > "{pathname of parent folder of parent folder of client folder of site "actionsite"}\script-output\{id of action}.txt""

In the Analysis, you’d retrieve something like
Property: “Action Logs”

Relevance:

(name of it, lines of it) of files of folders "script-output" of parent folder of parent folder of client folder of site "actionsite"

The results would look like

1.txt, hello from action 1 
2.txt, goodbye form action 2 

Then from API you could use

values whose (it as string starts with "1.txt") of results whose (name of computer of it = "Computer1") of bes properties "Action Logs"

(to retrieve the results where the computer is “Computer1” and the action ID was “1”)

(the relevance for parent folder of parent folder of client folder of site "actionsite" can be made much simpler with things like ‘data folder of client’ and ‘storage folder of client’ but I still use the older form because it’s compatible to much earlier BES Client versions)

1 Like

@JasonWalker - Thanks a lot for your response, we will definitely take this in consideration.

Hi Jason , thanks for your reply.

How frequent we should keep this analysis property update , as we need instance update once we execute the action ?

Secondly , if we use clientquery instead of analysis root then which one may be faster for 100s of server along with sequential / parallel execution’s ? as clientquery and cleitnqueryresults these two api we have to run to retrieve the results from client client and analysis is single API method.

Yeah, for that purpose BigFix Query may be a better fit, after all.

Or maybe even Remote Control, since you seem to be expecting real-time response.

1 Like

is there is any delay in processing for getting result output on rest api call for clientquery & clientqueryresults?

for example : hundred servers with 50 fixlets ?

Generally we’d send the query, and then poll.for results every 30 seconds or so until all the systems have responded or timeout after several minutes.

1 Like

Got it thanks for your help