Printing Output of an Action on BigFix Server

Hi @ageorgiev,

Thank you for all your help, I found output in and it’s content was correct:
…\BES Server\UploadManagerData\BufferDir\sha1<20><43567890>\txt_0_services.txt

But now there is another problem:
I applied my task to 3 different computers but there was just one output file from last computer under one directory: sha1\20\43567890)

Each client computer will have its own folder under the sha1 folder - you need to recursively scan the whole directory tree to look for files that match the pattern txt_*_services.txt

2 Likes

In sha1, there is only one directory that created in recent time.
And in that directory there is only one computer id and one output text.
Should I add some other lines for solution you say?

Don’t limit your search by directory creation time. Find the directory corresponding to the client IDs.

1 Like

I found them, thank you.
As you said I was searching in directories that have a recent creation time only.
In linux systems,
I will use a sh script for same purpose. (In action part I will select “sh script” option)
I will delete “waithidden cmd.exe /C Cscript.exe __Download /ALL /Quiet” part and
I will change “BESClient_ArchiveManager_FileSet-txt” = “C:\services.txt” on “{now}” for client” part as something like "BESClient_ArchiveManager_FileSet-txt” = “/tmp/” on “{now}” for client"
Right?

You will need to run it as “actionscript” on linux as well - “archive now” command" and the settings will not work in action type “sh”, so you will need to write the actual execution command for Linux using wait - not really *nix person but something like:

wait bash -c '…'
wait /tmp/somefile.sh

but yea, apart from that the file collection mechanism should work exactly the same.

1 Like

Hi everyone :slight_smile:
I am trying to use my “archived now” task for linux devices and there is a problem:
I used “sh” type action and wrote my script (it prints output to /tmp/services.txt)
Then I wanted to use setting commands for archive now configs (like “BESClient_ArchiveManager_FileSet-txt” = “C:\services.txt” on “{now}” for client”) but it didn’t work
My script is “sh” type action and “archived now” commands are “BigFix Action Script” type commands.
Is there a way for using both of them in same action?

Just the same as your Windows variant

You write actionscript that either downloads or creates on the fly the script to run on the target, makes the call to execute that script and then uploads the results.

What you can’t do is randomly mix & match code that will be parsed and sequenced by multiple interpreters within the one script

Typically you would have 1 fixlet /task for the Windows OS in a site that only Windows sysems subscribe to and the Linux fixlet/task in a site that only Linuix systems subscribe to which keeps the endpoint processing cycles optimal.

If you do have 1 fixlet/task that you are trying to use across Windows and Linux plaforms, you could add actionscript code to execute different commands based on the OS, eg

if{windows of operating system}
	waithidden your_windows_commands
elseif {(unix of it and name of it as lowercase contains "linux") of operating system}
	wait your_linux_commands
endif

Hi,

My linux action is in a different task. Action type is "sh"
My linux script is working, creating output in specified location but I cannot archive the output.
I think archive now commands are not recognized by “sh” type action, they should be in "BigFix action script"
But I want to use them in same task, what can I do?
My action is like:

wget …/script.sh
chmod +x script.sh
wait bash -c script.sh
wait script.sh
setting "BESClient_ArchiveManager_FileSet-txt” = “tmp\services.txt” on “{now}” for client
setting “BESClient_ArchiveManager_OperatingMode” = “2” on “{now}” for client
archive now

Where is the problem :slight_smile:

wget and chmod aren’t native action script command so will fail. You could use the download or prefetch actionscript commands to download the script.sh then use a run command to run chmod to make the file executable (not sure if that needed if being invoked direclty with bash). I would also cleanup the archive manager settings as I think that will re-upload the file on a recurring basis.

download http://your.server.com/script.sh
run chmod +x __Download/script.sh
wait bash -c __Download/script.sh
setting "BESClient_ArchiveManager_FileSet-txt" = "tmp\services.txt" on "{now}" for client
setting "BESClient_ArchiveManager_OperatingMode" = "2" on "{now}" for client
archive now
setting "BESClient_ArchiveManager_OperatingMode" = "0" on "{now}" for client
setting delete "BESClient_ArchiveManager_FileSet-txt" on "{now}" for client

Note: Using the </> button to format lines of code as preformatted text will help format any code and avoid smart quotes

image

1 Like

nevermind with padding

@SLB, thank you so much. I will try this.

Hi @SLB,
I used your format but this time even services.txt is (my script’s output) not created at local /tmp directory of target computer

My action was like:

Script type: sh

#!/bin/bash
download http://****/script.sh
run chmod +x __Download/script.sh
wait bash -c __Download/script.sh

archive now

is it right?

No, you would need to change the type to ActionScript as your command are native Bigfix action script commands. You would still need the line to enable and configure the upload manager prior to the archive now command

1 Like

Thank you for all your supports, I can archive files now from linux devices too.
But one thing is bothering me:
I see my archives in this directory:
BES Server\UploadManagerData\BufferDir\sha1<20><43567890>\txt_0_services.txt
In this example 43567890 should be unique pc id. What does “20” stand for?
There are lots of two digit number directories like <20> and they include several computer ids.
Is it possible to gather archives from all computers to same directory?

The two digit folder should be the last 2 digits of the ComputerID. It’s a way to semi-organize things by ComputerID (i.e. the opposite of putting all in the same directory). One thing I have done in one of my use case is to build the machine name into the uploaded file:

setting “_BESClient_ArchiveManager_OperatingMode”=“2” on “{now}” for client
setting “_BESClient_ArchiveManager_FileSet-someprefix_{computer name}”="{(value of variable “systemdrive” of environment) & “\somepath\someprefix_*.txt”}" on “{now}” for client

but unless you are cleaning settings up, the lists of client settings grows exponentially and given when you right-click on a machine it loads up “all existent client settings” things can get bad… but it does make the combining of uploaded files easier in my opinion. To answer your question though - no, unfortunately I am not aware of a way to customize the location and way the uploads are stored, in fact, BigFix Inventory uploads struggle in certain situation because they use this very same methodology…

1 Like