Create and Enable Jamf Pro Extensions for Backblaze (Mac)
    • Dark
      Light

    Create and Enable Jamf Pro Extensions for Backblaze (Mac)

    • Dark
      Light

    Article summary

    This article describes how to create and enable Jamf extension attributes.

    Create Backblaze Extension Attributes in Jamf

    1. In Jamf Pro, select Settings > Computer Management > Extension Attributes > New.

    2. Enter the required information:

      • Display Name: For example, “Backblaze Last Backup Date”

      • Data Type: Depends on the Backblaze Extension Attribute

      • Inventory Display: Extension Attributes (Default)

      • Platform: Mac

      • Input Type: Script

    3. Paste the script from your extension attribute file into the Script field. The script parses Backblaze’s report XML file located at /Library/Backblaze.bzpkg/bzdata/bzreports/bzstat_lastbackupcompleted.xml and prints a single <result>…</result> line (for example, Backblaze Last Backup Date).

    4. Click Save.

    Test the Script

    1. On a Mac, open Terminal and run the following command to trigger an inventory update and run the extension attribute:

      sudo jamf recon
    2. In Jamf Pro, locate the Mac that ran the command.

    3. Select Inventory > Extension Attributes.

    4. Confirm that the expected value (for example, a backup date or Backblaze Not Installed) is displayed.

    Tip

    If your environment requires additional permissions to access the Backblaze report path, deploy a PPPC or FDA profile that grants the Jamf agent read access. This ensures the script can access the log or report file reliably.

    After testing, you can upload that extension attribute using the Jamf UI.

    Add a New Script

    1. In Jamf Pro, select Settings in the sidebar.

    2. Under Computer Management, select Extension Attributes.

    3. Click Upload, then upload the extension attribute file.

    4. Click Save.

    Backblaze Extension Attributes

    Backblaze currently provides four attributes that you can add in Jamf Pro.

    Backup Selected

    This attribute shows the total size of the files selected for backup.

    Note

    The Backup Selected value can be larger than Backup Size if the backup is in progress and not yet complete.

    For this extension attribute, the Data Type is integer.

    #!/bin/bash
    
    SELBYTES=$(xmllint --xpath "string(//contents/bzvolume/@pervol_sel_for_backup_numbytes)" /Library/Backblaze.bzpkg/bzdata/bzreports/bzstat_totalbackup.xml)
    
    SELMB=$((SELBYTES / 1024 / 1024))
    
    if [ -f /Library/Backblaze.bzpkg/bzdata/bzreports/bzstat_totalbackup.xml ] ; then
    
    echo "<result>$SELMB</result>"
    
    else
    
    echo "<result>no backup found</result>"
    
    fi

    Backup Size

    This attribute reports the total size of data being backed up. This information helps teams understand storage usage and anticipate growth trends.

    For this extension attribute, the Data Type is integer.

    #!/bin/bash
    
    BACKUPBYTES=$(xmllint --xpath "string(//contents/totals/@totnumbytesforbackup)" /Library/Backblaze.bzpkg/bzdata/bzreports/bzstat_totalbackup.xml)
    
    BACKUPMB=$((BACKUPBYTES / 1024 / 1024 ))
    
    if [ -f /Library/Backblaze.bzpkg/bzdata/bzreports/bzstat_totalbackup.xml ] ; then
    
    echo "<result>$BACKUPMB</result>"
    
    else
    
    echo "<result>no backup found</result>"
    
    fi

    Last Backup Date

    This attribute identifies when a device last completed a backup.

    For this extension attribute, the Data Type is Date (YYYY-MM-DD hh:mm:ss) .

    #!/bin/bash
    
    BACKUPMIL=$(xmllint --xpath "string(//contents/lastbackupcompleted/@gmt_millis)" /Library/Backblaze.bzpkg/bzdata/bzreports/bzstat_lastbackupcompleted.xml)
    
    BACKUPSEC=$((BACKUPMIL / 1000))
    
    BACKUPDATE=$(perl -e "use POSIX qw(strftime); print strftime('%Y-%m-%d %H:%M:%S', localtime($BACKUPSEC));")
    
    if [ -f /Library/Backblaze.bzpkg/bzdata/bzreports/bzstat_lastbackupcompleted.xml ] ; then
    
    echo "<result>$BACKUPDATE</result>"
    
    else
    
    echo "<result>no backup found</result>"
    
    fi

    Safety Frozen Status

    This attribute shows whether the Backblaze Safety Freeze feature is active on a device. Safety Freeze prevents accidental or malicious backup changes.

    For this extension attribute, the Data Type is string.

    #!/bin/bash
    
    if [ -f /Library/Backblaze.bzpkg/bzdata/bzreports/bzdc_synchostinfo.xml ] ; then
    
    var=$(xmllint --xpath "string(//content/response/@safety_frozen)" /Library/Backblaze.bzpkg/bzdata/bzreports/bzdc_synchostinfo.xml)
    
    else
    
    var="no backup found"
    
    fi
    
    echo "<result>$var</result>"


    Was this article helpful?