- Print
- DarkLight
Create and Enable Jamf Pro Extensions for Backblaze (Mac)
- Print
- DarkLight
This article describes how to create and enable Jamf extension attributes.
Create Backblaze Extension Attributes in Jamf
In Jamf Pro, select Settings > Computer Management > Extension Attributes > New.
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
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.xmland prints a single<result>…</result>line (for example,Backblaze Last Backup Date).Click Save.
Test the Script
On a Mac, open Terminal and run the following command to trigger an inventory update and run the extension attribute:
sudo jamf reconIn Jamf Pro, locate the Mac that ran the command.
Select Inventory > Extension Attributes.
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
In Jamf Pro, select Settings in the sidebar.
Under Computer Management, select Extension Attributes.
Click Upload, then upload the extension attribute file.
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>"
fiBackup 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>"
fiLast 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>"
fiSafety 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>"