Solarwinds Agent Package for Linux

Does anyone have a Solarwinds Agent Package for Linux? The following is an unattended command. How can I put this in a fixlet that will run in Linux?

[ "${AUTO_SHELL}" = "" ] && AUTO_SHELL=`bash -c 'echo bash' 2>/dev/null || ksh -c 'echo ksh' 2>/dev/null || ( >&2 echo "Unable to find supported shell (bash or ksh). Please, define full path to your shell in environment variable AUTO_SHELL and retry installation" && exit 2 )`; "${AUTO_SHELL}" -c 'x(){ echo "AUTO_SHELL=\"'${AUTO_SHELL}'\""; echo "export AUTO_SHELL"; P=/Orion/AgentManagement/DownloadLinuxOnlineInstallScript.ashx?requestId=8c49b6b4-5ade-4205-891b-f694c15d256e;U=(https://xxxx https://solarwinds.com https://zzzzzzzz:443 https://zzzzzzz:443 https://wwwww https://xxxxxxx);dt(){ D=(wget curl);A=(-O\ -\ --no-check-certificate\ --tries=1\ --read-timeout=30 --insecure\ --retry\ 1); for((i=0;i<${#D[@]};i++));do which ${D[$i]}>/dev/null 2>/dev/null&&DT="${D[$i]} ${A[$i]}" && export DT && return;done;>&2 echo "Cannot find download tool - please install some (${D[*]}) or use other installation method";exit 1;};dt;echo DT=\"$DT\";echo export DT;>&2 echo; >&2 echo -n "Downloading installation data from Orion Poller...";for u in ${U[*]};do echo "URL=\"$u\""; echo "export URL"; if ${DT} $u$P 2>/dev/null; then FOUND=1; break; fi; >&2 echo -n "."; done; >&2 echo ""; if [ "${FOUND}" != "1" ]; then >&2 echo "Unable to connect to Orion Poller to download agent package. Please use an alternate deployment method, such as Add Node wizard."; >&2 echo "See http://www.solarwinds.com/documentation/helpLoader.aspx?lang=en&topic=OrionAgentDeployAgentTop"; exit 2; fi; }; X=`x`||exit "$?";"'${AUTO_SHELL}'" -c "${X}"'

I don’t think this script will work inside Bigfix because it is pulling in source from outside locations which is generally a security risk, and therefore, not allowed in end point management systems.

It should run fine under BigFix even though you’re polling outside sources. Ideally, things go through BigFix Servers for caching purposes but there’s nothing stopping the machine from doing direct downloads. For example, the Patches for Oracle Linux content directly downloads packages to the endpoints.

I currently don’t have a BigFix environment to test this but when you create a custom Fixlet/Task/action, in the “Action Script” tab, you can change the action such that it runs a shell script instead of BigFix actionscript. The other option is just if you need to run a BigFix actionscript, then you can just use wait /bin/sh -c '<command>'. Just be sure that you escape any necessary quotations and to escape { with {{ to prevent it from being treated as relevance.

I’ve arrived at the following script which worked one time. Now I am getting and Exit Code 4 on other systems I am running it on. The install works manually, but not with the Bigfix fixlet below.

// Download all specified files
begin prefetch block
  add prefetch item name=9747fa8ac24845c22a9ac973d36b8bd8e4380a34      sha1=9747fa8ac24845c22a9ac973d36b8bd8e4380a34 size=11586721 url=SWDProtocol://127.0.0.1:52311/Uploads/9747fa8ac24845c22a9ac973d36b8bd8e4380a34/swiagent.tar.gz.bfswd sha256=1bc24b1e1976369272def878dcb86b1d61bf9c9abe653bdbffa4fd28402cfea7
end prefetch block

//Cleanup
delete /tmp/swiagent.tar.gz
delete /tmp/install.sh

// Move download to tmp

move "__Download/9747fa8ac24845c22a9ac973d36b8bd8e4380a34" /tmp/swiagent.tar.gz 

// Change directory to tmp, extract the source, and execute the install

wait sh -c "cd /tmp; tar -xf swiagent.tar.gz"

//wait tar -xvf swiagent.tar.gz

wait sh -c "chmod +x /tmp/install.sh"
wait sh -c "/tmp/install.sh"

parameter "__ExitCode" = "{if exist exit code of action then exit code of action as string else "404"}"
if {parameter "__ExitCode" != "0"}
    exit {parameter "__ExitCode"}
endif

Here is the last iteration, and it appears to be working! The last break through was to put the “./” in front of the install.sh.

// Download all specified files
begin prefetch block
  add prefetch item name=9747fa8ac24845c22a9ac973d36b8bd8e4380a34         sha1=9747fa8ac24845c22a9ac973d36b8bd8e4380a34 size=11586721 url=SWDProtocol://127.0.0.1:52311/Uploads/9747fa8ac24845c22a9ac973d36b8bd8e4380a34/swiagent.tar.gz.bfswd sha256=1bc24b1e1976369272def878dcb86b1d61bf9c9abe653bdbffa4fd28402cfea7

end prefetch block

// Rename sha1
move "__Download/9747fa8ac24845c22a9ac973d36b8bd8e4380a34" "__Download/swiagent.tar.gz"

// Change directory to tmp, extract the source, and execute the install
wait sh -c "cd __Download; tar -xf swiagent.tar.gz"

// Change shell script permissions to execute
wait /bin/sh -c "(cd __Download; chmod +x install.sh)"

// Run the script
wait /bin/sh -c "(cd __Download; ./install.sh)"

parameter "__ExitCode" = "{if exist exit code of action then exit code of action as string else "404"}"
if {parameter "__ExitCode" != "0"}
    exit {parameter "__ExitCode"}
endif
2 Likes