Installing the new (June 2016+) Samanage agent

pmcgurn
New Contributor III

Samanage shipped a new installer for their agent, and the structure is completely different than the PKG-based install they previously had. Here's how I deployed it.

  1. Download the new DMG from your Setup area in Samanage
  2. Extract to /tmp/samanage
  3. Create a new DMG-based package in Composer, and upload in Casper Admin
  4. Create a policy with the script below as an "after" script, plus the package you uploaded in step 3.

This script should be version-safe, as long as they don't change the structure again. Note, there's an options file that extracts alongside the .app, where you can set the agent to auto-update. I'd recommend this, to avoid having to keep repackaging their agent every time they ship a new release.

#!/bin/sh

#In the latest version, Samanage changed from a PKG install to DMG+script
#This means we no longer have the ability to pull the installer on-demand with cURL

echo "Running Samanage agent install"

# Uninstall current SAManage agent
echo "Trying to remove old Samanage agent"
/Applications/Samanage*.app/Contents/Resources/uninstaller.sh

# Install the SAManage Mac agent from /tmp/samanage copied by Casper
echo "Running the installer"
/tmp/samanage/Samanage_Agent_*.app/Contents/MacOS/installbuilder.sh --mode unattended

# Clean-up
# Remove the samanage files from /tmp
rm -rf /tmp/samanage/

echo "Exiting with success"
exit 0
7 REPLIES 7

joshua
New Contributor

Works like a champ. Thanks for posting!

According to Samanage as long as you have all the files in the orginal DMG you moved into the /tmp directory the Agent should always auto-update unless you tell it not to. Which I agree with you, it doesn't really provide much value that way.

Good work @pmcgurn

SoundCloud
New Contributor II

We ended up having to use this method to deploy.
/private/tmp/samange/./Samange_Agent_/Contents/MacOS/osx-intel --mode unattended

uoscasper
New Contributor

Hi.

Could you possibly give a bit more detail with regards to building the DMG-based package? I've tried snapshots/editing current ones, but I can't come up with an installer that creates the samanage folder in /tmp. The package reports that it installed, but no files are copied.

Copying the files with ARD and then running the script above works, but we'd like to automate the whole process.

Are you able to help at all?

Regards.

kirahman2
New Contributor II

@uoscasper I've recreated the steps above to get this working along with a bit more detail. Thanks @pmcgurn your steps were super helpful.

Creating the DMG in Composer
1. Download the new DMG from your Setup area in Samanage (Setup > Deployment > Mac > click Download)
2. Open Composer > click New > Normal Snapshot 3. Navigate to /library/ (press cmd shift g for file path window)
4. Create tmp folder in library so you now have /library/tmp/
5. Mount/open SAManage-Agent-for-Mac.dmg > drag contents to /library/tmp/
6. In Composer, Create Package Source > Build as DMG
7. Upload new DMG to the JSS

Adding the Script
1. Go to your JSS > Settings > Computer Management > Scripts
2. Create new script called "Samanage" > click Options tab > under Priority select "after"
3. Upload the script below (note: I did not create the script with the dmg in Composer because this did not work for me)
4. Create a policy that includes the new Samanage dmg you've created along with the script created in step 3.

echo "Running Samanage agent install"

# Uninstall current SAManage agent
echo "Trying to remove old Samanage agent"
/Applications/Samanage*.app/Contents/Resources/uninstaller.sh

# Install the SAManage Mac agent from /tmp/samanage copied by Casper
echo "Running the installer"
/library/tmp/Samanage_Agent_*.app/Contents/MacOS/installbuilder.sh --mode unattended

# Clean-up
# Remove the samanage files from /tmp
rm -rf /library/tmp/

echo "Exiting with success"
exit 0

pdaswani
New Contributor

Hello,

Do you include the DMG / Script on the image or just let the policy install it?

Thanks

joshua
New Contributor

You can include the DMG and script all in one policy.

TBBB
New Contributor

I have problem with using this. I get this error. Please help

Script result: Running Samanage agent install
Trying to remove old Samanage agent /Library/Application Support/JAMF/tmp/Install or Update Solarwinds Discovery Agent: line 7: /Applications/Samanage*.app/Contents/Resources/uninstaller.sh: No such file or directory /Library/Application Support/JAMF/tmp/Install or Update Solarwinds Discovery Agent: line 8: /Applications/Solarwinds Discovery Agent_*.app/Contents/Resources/uninstaller.sh: No such file or directory Running the installer There has been an error. No origin file found that matched /Library/tmp/data/Solarwinds Discovery Agent.app Exiting with success