I rewrote some of the EA's that weren't working for me anymore. I left out the PC part, since we don't use casper or crashplan for PC's...
Size of selected fileset:
#!/bin/sh
# Modified 5/17/16 by djdavetrouble for new API Calls
# Third-Party Product page for CrashPlan PROe - https://jamfnation.jamfsoftware.com/viewProduct.html?id=217
CP_ServerAddress="http://x.x.x.x: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'`
value=`curl -X GET -s -u ${CP_AdminUsername}:${CP_AdminPassword} -k "$SERVER/api/DeviceBackupReport?deviceUid=$GUID" | python -m json.tool | grep -w selectedBytes | awk '{print $2}' | sed -e 's/^"//g' | sed -e 's/",$//g'`
kilo=$(echo "scale=2; $value / 1024" | bc )
kiloint=$( echo "$value / 1024" | bc )
mega=$( echo "scale=2; $kilo / 1024" | bc )
megaint=$( echo "$kilo / 1024" | bc )
giga=$( echo "scale=2; $mega / 1024" | bc )
gigaint=$( echo "$mega / 1024" | bc )
if [ $kiloint -lt 1 ] ; then
result="$value bytes"
elif [ $megaint -lt 1 ] ; then
result="${kilo} KB"
elif [ $gigaint -lt 1 ] ; then
result="${mega} MB"
else
result="${giga} GB"
fi
echo "<result>$result</result>"
else
echo "<result>Not installed</result>"
fi
Date and Time of last connection:
#!/bin/sh
# Modified 5/17/16 by djdavetrouble for new API Calls
# Third-Party Product page for CrashPlan PROe - https://jamfnation.jamfsoftware.com/viewProduct.html?id=217
CP_ServerAddress="http://x.x.x.x: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 -X GET -s -u ${CP_AdminUsername}:${CP_AdminPassword} -k "$SERVER/api/DeviceBackupReport?deviceUid=$GUID" | python -m json.tool | grep -w lastConnectedDate | awk '{print $2}' | sed -e 's/^"//g' | sed -e 's/",$//g'`
FORMATTED=`date -j -f "%Y-%m-%dT%H:%M:%S" "$DATA" "+%Y-%m-%d %H:%M:%S"`
echo "<result>$FORMATTED</result>"
else
echo "<result>Not installed</result>"
fi
Date and Time of Last Completed Backup
#!/bin/sh
# Modified 5/17/16 by djdavetrouble for new API Calls
# Third-Party Product page for CrashPlan PROe - https://jamfnation.jamfsoftware.com/viewProduct.html?id=217
CP_ServerAddress="http://x.x.x.x: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 -X GET -s -u ${CP_AdminUsername}:${CP_AdminPassword} -k "$SERVER/api/DeviceBackupReport?deviceUid=$GUID" | python -m json.tool | grep -w lastCompletedBackupDate | awk '{print $2}' | sed -e 's/^"//g' | sed -e 's/",$//g'`
FORMATTED=`date -j -f "%Y-%m-%dT%H:%M:%S" "$DATA" "+%Y-%m-%d %H:%M:%S"`
echo "<result>$FORMATTED</result>"
else
echo "<result>Not installed</result>"
fi
Percentage Complete
#!/bin/sh
# Modified 5/17/16 by djdavetrouble for new API Calls
# Third-Party Product page for CrashPlan PROe - https://jamfnation.jamfsoftware.com/viewProduct.html?id=217
CP_ServerAddress="http://x.x.x.x: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 -X GET -s -u ${CP_AdminUsername}:${CP_AdminPassword} -k "$SERVER/api/DeviceBackupReport?deviceUid=$GUID" | python -m json.tool | grep -w backupCompletePercentage | awk '{print $2}' | sed -e 's/^"//g' | sed -e 's/",$//g'`
echo "<result>$DATA</result>"
else
echo "<result>Not installed</result>"
fi
Crashplan Alert States:
#!/bin/sh
# Modified 5/17/16 by djdavetrouble for new API Calls
# Third-Party Product page for CrashPlan PROe - https://jamfnation.jamfsoftware.com/viewProduct.html?id=217
CP_ServerAddress="http://x.x.x.x: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 -X GET -s -u ${CP_AdminUsername}:${CP_AdminPassword} -k "$SERVER/api/DeviceBackupReport?deviceUid=$GUID" | python -m json.tool | grep -w alertStates | awk '{print $2}' | sed -e 's/^"//g' | sed -e 's/",$//g'`
echo "<result>$DATA</result>"
else
echo "<result>Not installed</result>"
fi