Hi Team,
please help me how to get the results for these commands .
getenforce
sestatus
Thanks
Hi Team,
please help me how to get the results for these commands .
getenforce
sestatus
Thanks
Hi @ark,
Guessing you mean how to pull them back in an analysis property?
Youâd have a task to capture the command output to a file, something like:
wait bash -c "sestatus > /tmp/sestatus.txt"
And a property to read the results file, something like
lines of file "/tmp/sestatus.txt"
Thanks a lot
itâs working.
Can you please help me on below also.
appendfile multipath -ll|grep -i failed
powermt display
You would do it the same way; itâs not affected by pipes:
wait bash -c "multipath -ll | grep -i failed > multipath.txt"
You would have to escape any double-quotes, though ( " -> \"
)
because youâre inside the quotes,
and double all beginning curly brackets ( { -> {{
)
or else theyâll get interpreted as BigFix Relevance substitution.
https://developer.bigfix.com/action-script/guide/substitution.html
And a property to read the results file, can I use below
lines of file â/tmp/multipath.txtâ
Can you also please help how to write the property and relevance for below commands
powermt display
Yes â in the property, you read the file you generated in the task.
So you could use a property like this:
lines of file "/tmp/multipath.txt"
âŚto read the results of a command like this:
wait bash -c "multipath -ll | grep -i failed > /tmp/multipath.txt"
(the /tmp/multipath.txt matches in both)
For âpowermnt displayâ just do the same thing you did for âsestatusâ and âmultipath -ll | grep -i failedâ â itâs the same pattern: output a command result to a file in a task, then read the file in a property.
Hi,
I used below but not working.
wait bash -c "powermt display > /tmp/powermt.txt"
lines of file â/tmp/powermt.txtâ
Hi @ark,
The names have to match â try lines of file "/tmp/powermt.txt"
Also itâs a good idea to avoid spaces in filenames in general
(e.g. â/tmp/powermt display.txtâ would probably cause you trouble even if it matched the bash line)
Hi,
I used below but not working.
wait bash -c "powermt display > /tmp/powermt.txt"
lines of file â/tmp/powermt.txtâ
Hi @ark
I donât have powermt on a system so canât test that for youâŚ
but based on a quick google search I wonder if you might mean powermt display dev=all
?
Itâs a good idea to test the commands you want to run on the command line first, and make sure they produce the results you want non-interactively. Thereâs no user interaction when running commands in a BigFix task.
If you donât get the result you expect in the lines of file
property, then inspect the file manually to verify the result youâre expecting is there.
Go do some experimenting, and have fun!
Just wanted to check: is there any way I can get the result of the below command directly from the analysis without executing the task to capture the command output to a file and reading the result of the file separately.
I wanted to capture the real time output of below command from ubuntu device.
ânsclient show-status"
or
"opt/nsclient/nsAgent show-statusâ
Thanks in advance
Negative, youâd have to execute a task, save the output to a file, and then read the file contents.
Reading the file contents could be done with an Analysis, or with the Query app to run the relevance as a one-time task.
Thank you for the update.
Basically, I was attempting to use bigfix analysis to capture the current status of the application services (systemctl), but I was unable to do so for the application services status on Ubuntu devices.
Please let me know if there is a way to analysis the systemctl status and capture it.