Skip to main content
Solved

Extension attribute not displaying stdout


Forum|alt.badge.img+3

I have a simple extension attribute that's supposed to display an Agent version:

#!/bin/bash

# Check to see if the SentinelOne agent is installed.
# If the agent is installed, report the agent
# version.

printf '<result>'
if result=`/usr/local/bin/sentinelctl version | awk '{print $2 $3}'`; then
  printf "$result"
else
  printf "Unavailable/Not Installed"
fi
printf '</result>'

When I run this locally on my machine, it works, but running it as an extension attribute doesn't seem to work.

Any suggestions on how to debug this issue?

Best answer by hkabik

Try:

#!/bin/bash

# Check to see if the SentinelOne agent is installed.
# If the agent is installed, report the agent
# version.

if [ -f "/usr/local/bin/sentinelctl" ] ; then 
    RESULT=$( /usr/local/bin/sentinelctl version | awk '{print $2 $3}' )
else
    RESULT="not installed"
fi

echo "<result>$RESULT</result>"
View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 7 replies
  • May 12, 2016

I also tried:

#!/bin/bash

# Check to see if the SentinelOne agent is installed.
# If the agent is installed, report the agent
# version.

if [ -f "/usr/local/bin/sentinelctl" ] ; then 
    RESULT=`sudo /usr/local/bin/sentinelctl version | awk '{print $2 $3}'`
else
    RESULT="not installed"
fi

echo "<result>$RESULT</result>"

Just to see what happens :)


Forum|alt.badge.img+16
  • Honored Contributor
  • 330 replies
  • Answer
  • May 12, 2016

Try:

#!/bin/bash

# Check to see if the SentinelOne agent is installed.
# If the agent is installed, report the agent
# version.

if [ -f "/usr/local/bin/sentinelctl" ] ; then 
    RESULT=$( /usr/local/bin/sentinelctl version | awk '{print $2 $3}' )
else
    RESULT="not installed"
fi

echo "<result>$RESULT</result>"

Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 7 replies
  • May 13, 2016

Super weird. It works when running script via Policy, but as an extension attribute, it does not.

edit: flushPolicyHistory fixed it.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings