Crashplan Extension Attributes

NtivaOA
New Contributor II

@jake -Im trying to use one of the crashplan EA and can't seem to get it connected. Do these EAs still work, because I know Code42 has changes some of their ports.

Thanks

11 REPLIES 11

boberito
Valued Contributor

We're on the 6.5.0 server and they're working for me. However I've had to over the years change some of the parsing of the data.

CrashPlan - Last Backup

CP_ServerAddress="crashplanserver:4280" CP_AdminUsername="username" CP_AdminPassword='password' if [ "$CP_ServerAddress" == "" ] || [ "$CP_AdminUsername" == "" ] || [ "$CP_AdminPassword" == "" ];then echo "<result>Please ensure all variables are set in the extension attribute script.</result>" elif [ -f /Library/Application Support/CrashPlan/.identity ];then SERVER=$(echo $CP_ServerAddress | sed 's|/$||') GUID=$(cat /Library/Application Support/CrashPlan/.identity | sed -n 's/guid=//p') DATA=$(curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | awk 'BEGIN { FS = "," } ; { print $90 }' | cut -c 24-33) echo "<result>$DATA</result>" else echo "<result>Not installed</result>"

CrashPlan - Backup Perecnt Complete

CP_ServerAddress="crashplanserver:4280" CP_AdminUsername="username" CP_AdminPassword='password' if [ "$CP_ServerAddress" == "" ] || [ "$CP_AdminUsername" == "" ] || [ "$CP_AdminPassword" == "" ];then echo "<result>Please ensure all variables are set in the extension attribute script.</result>" elif [ -f /Library/Application Support/CrashPlan/.identity ];then SERVER=$(echo $CP_ServerAddress | sed 's|/$||') GUID=$(cat /Library/Application Support/CrashPlan/.identity | sed -n 's/guid=//p') DATA=$(curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | sed -n 's/.percentComplete":([^,]).*/1/p') echo "<result>$DATA%</result>" else echo "<result>Not installed</result>" fi

CrashPlan - Alert States

CP_ServerAddress="crashplanserver:4280" CP_AdminUsername="username" CP_AdminPassword='password' if [ "$CP_ServerAddress" == "" ] || [ "$CP_AdminUsername" == "" ] || [ "$CP_AdminPassword" == "" ];then echo "<result>Please ensure all variables are set in the extension attribute script.</result>" elif [ -f /Library/Application Support/CrashPlan/.identity ];then SERVER=$(echo $CP_ServerAddress | sed 's|/$||') GUID=$(cat /Library/Application Support/CrashPlan/.identity | sed -n 's/guid=//p') echo $GUID DATA=$(curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | awk 'BEGIN { FS = "," } ; { print $14 }' | awk 'BEGIN { FS = ":" } ; { print $2 }') echo "<result>$DATA</result>" else echo "<result>Not installed</result>" fi

CrashPlan - Status

#!/bin/sh CP_ServerAddress="CrashPlanServer" CP_ServerPort="4280" CP_AdminUsername="username" CP_AdminPassword='password' if [ "$CP_ServerAddress" == "" ] || [ "$CP_ServerPort" == "" ] || [ "$CP_AdminUsername" == "" ] || [ "$CP_AdminPassword" == "" ];then echo "<result>Please ensure all variables are set in the extension attribute script.</result>" else if [ -f /Library/Application Support/CrashPlan/.identity ];then GUID=$(/bin/cat /Library/Application Support/CrashPlan/.identity | grep guid | sed s/guid=//g) DATA=$(curl -s -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "http://$CP_ServerAddress:$CP_ServerPort/api/computer?guid=783576814425992657" | grep -w status | awk 'BEGIN { FS = "," } ; { print $9 }' | awk 'BEGIN { FS = ":" } ; { print $2 }') echo "<result>$DATA</result>" else echo "<result>Not installed</result>" fi fi

Hope that helps.

NtivaOA
New Contributor II

thanks, @boberito I'll give it a shot

NtivaOA
New Contributor II

@boberito all I get is a '%' output. I may be entering the server address incorrectly. Do I use a http or https before the address? Thanks

boberito
Valued Contributor

For example I just have

CP_ServerAddress="cp-a.saes.org:4280"

We don't have https enforced for our CP server, if you do, it may not work exactly the same.

NtivaOA
New Contributor II

hmmmm so if our server settings are

7d0c857f19bd456c9e5a809c633371f6

what would my connection string be.

thanks

boberito
Valued Contributor

I'm not sure....thinking about it maybe there's something different.

I'm not sure that what I posted will help you.

If you do the curl statement just in the terminal in one of the scripts, replace all the variables with what they should be. Will it work then? It may give you a large dump of data but that means it connected and got something. After that it'd just be figuring out the exact parsing.

NtivaOA
New Contributor II

ill give it a shot. thanks again

NtivaOA
New Contributor II

no dice, give me an output with all 0's. probably need a different API for the pro version. I'll work on finding documentation for it. thanks for the assist.

steve_summers
Contributor III

@ramitadrosOA at my company, they don't like me using an EA with the CrashPlan admin password in plain text. So, this one works for showing me when the last time a mac had a successful (100%) complete CP backup.

#!/bin/sh

cpLog="/Library/Logs/CrashPlan/history.log.0"

if [ -f "$cpLog" ]; then
    cpDate=$(/usr/bin/grep -e "Completed backup" $cpLog | /usr/bin/tail -n1 | /usr/bin/awk '{ print $2,$3 }')
    cpResult=$(/bin/date -j -f "%m/%d/%y %l:%M%p" "$cpDate" "+%Y-%m-%d %k:%M:%S")
else
    cpResult="1901-01-01 00:00:01"
fi

echo "<result>${cpResult}</result>"

NtivaOA
New Contributor II

@steve.summers - this works great, thank you. But i'm also looking for something that can give me users with 90% or more of a completed backup

sv264
New Contributor

@steve.summers - Do you know how I could update the script to account for history.log files named "history.log.1" "history.log.2" and so on?