Skip to main content
Question

EA for CrashPlan PROe (the 'e' matters...)

  • November 13, 2012
  • 36 replies
  • 110 views

Forum|alt.badge.img+13

The available, pre-made Extension Attribute for CPP does not seem to work with PROe servers. I was wondering if anybody else had noticed this and tweaked their EA(s) to pull data from a PROe server. I'll buy you a beer!

36 replies

Forum|alt.badge.img+4
  • Contributor
  • November 15, 2012

+ 1


Forum|alt.badge.img+7
  • Contributor
  • December 12, 2012

bump


Forum|alt.badge.img+13
  • Author
  • Valued Contributor
  • December 12, 2012

For those still tuned in, I don't know if this ever got resolved. The API is different...


stevewood
Forum|alt.badge.img+38
  • Hall of Fame
  • December 12, 2012

I've been working on this some this morning, and yes, the API was changed. To get to the API viewer that shows the methods you can call, you can issue the following in a browser:

http://crashplanserver:4280/apidocviewer

The following article on the support site shows how to get there: http://www.crashplan.com/enterprise/support/doku.php/api

I've been able to fix the Status EA:

#!/bin/sh
CP_ServerAddress="your.crashplanserver.com"
CP_ServerPort="4280"
CP_AdminUsername="youradmin"
CP_AdminPassword="youradminpassword"

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`
        echo "<result>`/usr/bin/curl -u "$CP_AdminUsername":"$CP_AdminPassword" -k http://"$CP_ServerAddress":"$CP_ServerPort"/api/computers?guid="$GUID" | grep -w status | awk '{print $2}' | sed s/,//g | sed 's/.(.*)/1/' | sed 's/(.*)./1/'`</result>"
    else
        echo "<result>Not installed</result>"
    fi
fi

If you want to use HTTPS, just change the port number to 4285 and the curl line to https.

And the GUID EA should work as is since it is reading from a local file and not curling data from the server.

The rest of the EAs I've had problems getting to work. Code42 changed some of the method calls and it's difficult to get info like backupPercent, etc. I've got an email in to my sales rep to see if he can give me some help.


Forum|alt.badge.img+9
  • Employee
  • January 23, 2013

Just wanted to let you guys know that we will be posting a set of EAs for CrashPlan PROe in the very near future.

Also, is anyone planning on using the Windows CrashPlan PROe scripts?


Forum|alt.badge.img+13
  • Valued Contributor
  • January 23, 2013
Just wanted to let you guys know that we will be posting a set of EAs for CrashPlan PROe in the very near future.

Amazing, can't wait for that!


Forum|alt.badge.img+6
  • Contributor
  • January 24, 2013

Here are my scripts for this. Not to hard to change the current scripts to work with the new API. Enjoy and contribute!

Show state/status:
Shows Crashplan Pro E state. Shows additional error states.

#!/bin/sh
CP_ServerAddress="SERVERADDRESS
CP_ServerPort="4285"
CP_AdminUsername="ADMINUSER"
CP_AdminPassword="ADMINPASSWORD"

if [ "$CP_ServerAddress" == "" ] || [ "$CP_ServerPort" == "" ] || [ "$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
    GUID=`/bin/cat /Library/Application Support/CrashPlan/.identity | grep guid | sed s/guid=//g`
    theReply=`/usr/bin/curl -s -u "$CP_AdminUsername":"$CP_AdminPassword" -G -d guid="$GUID" -k https://"$CP_ServerAddress":"$CP_ServerPort"/api/Computer`
    isActive=`echo "$theReply" | grep -w active | awk '{print $2}' | sed s/,//g`
    theState=`echo "$theReply" | grep -w alertStates | awk '{print $2}' | sed s/,//g | sed 's/..(.*)/1/' | sed 's/(.*)../1/'`
    theProcessList=`ps awx | grep CrashPlanService | grep -v grep`

    if [ "$GUID" == "" ]; then
        theResult="No GUID"
    elif [ "$theReply" == "" ]; then
        theResult="No reply"
    elif [ "$isActive" == "" ]; then
        theResult="Not registered"
    elif [ "$isActive" == "false" ]; then
        theResult="Not active"
    elif [ "$theState" == "" ]; then
        theResult="No state"
    elif [ "$theProcessList" == "" ]; then
        theResult="Not running"
    else
        theResult="$theState"
    fi
    echo "<result>$theResult</result>"
else
    echo "<result>Not installed</result>"
fi

Percentage complete:

#!/bin/sh
CP_ServerAddress="SERVERADDRESS"
CP_ServerPort="4285"
CP_AdminUsername="ADMINUSER"
CP_AdminPassword="ADMINPASSWORD"

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`
        server=`/usr/bin/curl -s -u "$CP_AdminUsername":"$CP_AdminPassword" -k -G -d websiteHost=https://"$CP_ServerAddress":"$CP_ServerPort" https://"$CP_ServerAddress":"$CP_ServerPort"/api/Server | grep destinationId | head -1 | awk '{print $2}' | sed s/,//g`
        totalSize=`/usr/bin/curl -s -u "$CP_AdminUsername":"$CP_AdminPassword" -G -d guid="$GUID" -d targetComputerId="$server" -k https://"$CP_ServerAddress":"$CP_ServerPort"/api/Archive | grep selectedBytes | head -1 | awk '{print $2}' | sed s/,//g`
        todo=`/usr/bin/curl -s -u "$CP_AdminUsername":"$CP_AdminPassword"  -G -d guid="$GUID" -d targetComputerId="$server" -k https://"$CP_ServerAddress":"$CP_ServerPort"/api/Archive | grep todoBytes | head -1 | awk '{print $2}' | sed s/,//g`
        if [ "$totalSize" == "" ] || [ "$todo" == "" ]; then
            echo "<result>Unknown.</result>"
            exit 0;
        fi
        done=`expr "$totalSize" - "$todo"`

        result=$( echo "scale=4; ($done / $totalSize) * 100" | bc | sed 's/(.*)../1/' )

        echo "<result>$result</result>"
    else
        echo "<result>Not installed</result>"
    fi
fi

Last connected:

#!/bin/sh
CP_ServerAddress="SERVERADDRESS"
CP_ServerPort="4285"
CP_AdminUsername="ADMINUSER"
CP_AdminPassword="ADMINPASSWORD"

if [ "$CP_ServerAddress" == "" ] || [ "$CP_ServerPort" == "" ] || [ "$CP_AdminUsername" == "" ] || [ "$CP_AdminPassword" == "" ];then
echo "Please ensure all variables are set in the extension attribute script."
else
if [ -f /Library/Application Support/CrashPlan/.identity ];then
    GUID=`/bin/cat /Library/Application Support/CrashPlan/.identity | grep guid | sed s/guid=//g`
    value=`/usr/bin/curl -s -u "$CP_AdminUsername":"$CP_AdminPassword" -G -d guid="$GUID" -k https://"$CP_ServerAddress":"$CP_ServerPort"/api/Computer | grep -w lastConnected | awk '{print $2}' | sed s/,//g | sed 's/.(.*)/1/'`
    result=`/bin/date -j -f "%Y-%m-%dT%H:%M:%S" "$value" "+%Y-%m-%d %H:%M:%S"`
    echo "<result>$result</result>"
else
    echo "<result>Not installed</result>"
fi
fi

Selected Files Size (GB)
I'm only showing in GB for sorting purposes. Just comment the final result and uncomment the if block otherwise.

#!/bin/sh
CP_ServerAddress="SERVERADDRESS"
CP_ServerPort="4285"
CP_AdminUsername="ADMINUSER"
CP_AdminPassword="ADMINPASSWORD"

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`
    server=`/usr/bin/curl -s -u "$CP_AdminUsername":"$CP_AdminPassword" -G -d websiteHost=https://"$CP_ServerAddress":"$CP_ServerPort" -k https://"$CP_ServerAddress":"$CP_ServerPort"/api/Server | grep destinationId | awk '{print $2}' | sed s/,//g`
    value=`/usr/bin/curl -s -u "$CP_AdminUsername":"$CP_AdminPassword" -G -d guid="$GUID" -d targetComputerId="$server" -k https://"$CP_ServerAddress":"$CP_ServerPort"/api/Archive | grep selectedBytes |  awk '{print $2}' | sed 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

    result="${giga}"

    echo "<result>$result</result>"
else
    echo "<result>Not installed</result>"
fi
fi

GUID

#!/bin/sh
if [ -f /Library/Application Support/CrashPlan/.identity ];then
echo "<result>`/bin/cat /Library/Application Support/CrashPlan/.identity | grep guid | sed s/guid=//g`</result>"
else
echo "<result>Not installed</result>"
fi

jhbush
Forum|alt.badge.img+27
  • Esteemed Contributor
  • January 25, 2013

I'm not having any luck with these EA's. I either get bad date formats or no useful information at all. The old one versions always worked well for me. Any ideas like bad forum text formatting?


Forum|alt.badge.img+9
  • Employee
  • January 25, 2013

JAMF's CrashPlan PROe extension attributes have been upload to the nation.
You can check them out over here:https://jamfnation.jamfsoftware.com/viewProduct.html?id=217&view=extensionAttributes


jhbush
Forum|alt.badge.img+27
  • Esteemed Contributor
  • January 25, 2013

Eric, most of those new EA's aren't working for me. Only the GUID which worked before.


stevewood
Forum|alt.badge.img+38
  • Hall of Fame
  • January 25, 2013

Jason you are running CrashPlanPROe and not CrashPlanPRO, right? I've got them loaded up and they are working great for me (thanks Eric!).


jhbush
Forum|alt.badge.img+27
  • Esteemed Contributor
  • January 25, 2013

Steve, we are running the latest and greatest CrashPlan PROe. I get:

Failed conversion of ``'' using format ``%Y-%m-%dT%H:%M:%S''
date: illegal time format

and other strange errors.


Forum|alt.badge.img+9
  • Employee
  • January 25, 2013

Hey Jason, I'd be interested in checking out the errors you're getting. Would you be up for a Web-ex on Monday?


jhbush
Forum|alt.badge.img+27
  • Esteemed Contributor
  • January 25, 2013

Eric, I can do a webex Monday.


John_Wetter
Forum|alt.badge.img+33
  • Hall of Fame
  • January 29, 2013

Eric, will there be a self-service plug-in coming also? Thanks for the EA's!


Forum|alt.badge.img+9
  • Employee
  • January 29, 2013

John - There will indeed be a self-service plug-in. The code might be complete, and is perhaps going though some final testing...maybe...


Forum|alt.badge.img+9
  • Employee
  • February 15, 2013

Just wanted everyone know that I've posted the CrashPlan PROe Self Service Plug-in over here:https://jamfnation.jamfsoftware.com/discussion.html?id=6592

... and here: https://jamfnation.jamfsoftware.com/discussion.html?id=6593

-10 for double post


Forum|alt.badge.img+7
  • Contributor
  • March 22, 2013

First post.

I too had issues with the "JAMF CrashPlan PROe extension attributes" posted by @eric.hutter. However, the ones in this thread posted by @pereljon work fine (though he gave us fewer of them). Looking through the differences, I noticed that @pereljon provided port numbers on his versions. The JAMF versions assume your server is running on Port 443 and if it's not, or if you have a redirect, they fail.

I'd love to get the official ones supported with a port number (4285 is the default for SSL on CrashPlan PROe). It's a trickier curl syntax, but would be a lot more flexible for different environments, like mine and others.

Thanks to @pereljon for taking the time to modify them in the first place to work with the new PROe API syntax, I may use his command syntax and the other non-working-for-me JAMF EAs and update them and post here.


Forum|alt.badge.img+9
  • Employee
  • May 15, 2013

@pickerin

It's actually curl assuming port 443 because one wasn't provided. You can use 4285 by entering https://your-proe-sever:4285 as the address.

If you're having issues with redirects you can add '--location-trusted' to the curl command. This is the only way i know how to get curl to pass along the authentication information over a redirect. But according to curl's man page 'this may or may not introduce a security breach', so I didn't add it to the posted versions.


Forum|alt.badge.img+13
  • Valued Contributor
  • September 20, 2013

Looks like the latest CrashPlan update (3.5.5 to 3.6.1.2) broke most of the EAs...
For example,

curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | sed -n 's/.*archiveBytes": ([^,]*).*/1/p'

doesn't return anything.
Any sed wizards out there able to fix it? ;)


Forum|alt.badge.img+4
  • Contributor
  • October 27, 2013

Ya mine ended up breaking too. I am still trying different things to sort out why it broke.

Anyone else have this issue?


Forum|alt.badge.img+13
  • Valued Contributor
  • December 3, 2013

Finally had some time to look into this.
Only AFTER i had built my own sed statement,
i figured out that there's just one extra space that has to be removed in the original EA.

For example in the Last Backup EA:

DATA=`curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | sed -n 's/.*lastBackup": "([^"]*).*/1/p'`

has to be changed to

DATA=`curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | sed -n 's/.*lastBackup":"([^"]*).*/1/p'`

Notice the space in lastBackup": " has to be removed: lastBackup":"
The other EAs need to be adjusted accordingly
This works with our CPPe 3.6.1.5 server.


Forum|alt.badge.img+11
  • Contributor
  • December 4, 2013

FWIW, getting very mixed results with these EAs, even after removing the colon space issue cited above or using pereljon's version or the official JN ones. For example:

Backup Percent Complete EA listed at https://jamfnation.jamfsoftware.com/viewProductFile.html?id=217&fid=623 with a CURL command listed below simply kicks back a blank $DATA value:

`curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | sed -n 's/.*percentComplete":"([^"]*).*/1/p'`

Meanwhile the Last Backup EA listed at: https://jamfnation.jamfsoftware.com/viewProductFile.html?id=217&fid=625 seems like more of just a basic formatting issue since it generates an "illegal time format" error on run with a CURL command below:

DATA=`curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | sed -n 's/.*lastBackup":"([^"]*).*/1/p'`        
        FORMATTED=`date -j -f "%Y-%m-%dT%H:%M:%S" "$DATA" "+%Y-%m-%d %H:%M:%S"`
        echo "<result>$FORMATTED</result>"

Forum|alt.badge.img+13
  • Valued Contributor
  • December 4, 2013

For Backup Percent Complete, try

`curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1" | sed -n 's/.*percentComplete":([^,]*).*/1/p'`

The Last Backup EA works for me as you quoted it.
Which version is your CPPe server?


Forum|alt.badge.img+11
  • Contributor
  • December 4, 2013

Thanks Chris. We're running v3.6.1.5.

Backup Complete seems to be working with that edit (which I could have sworn I had tried before), but other EAs may actually be related to some other kind of issue going on, since dumping out the entire GUID record via:

curl -q -u "$CP_AdminUsername:$CP_AdminPassword" -k "$SERVER/api/Computer?guid=$GUID&incBackupUsage=1"

Generates a variety of incorrect record values. For example here's what I'm seeing for last Backup/Completed/Connected:

"lastBackup":null,"lastCompletedBackup":null,"lastConnected":null,"lastMaintenanceDate":"2013-10-31T10:53:49.646-04:00","lastCompactDate":null