Apply Sir Dave Brailsford’s “aggregation of marginal gains” to your Jamf Pro Extension Attributes
Background
Computer Extension Attributes — which allow a Mac Admin to collect extra inventory information — are one of my favorite features of Jamf Pro and I was honored to present with Timothy Noffke at JNUC 2017.
Using the Script input type, almost any client-side setting can be collected and acted on by a Jamf Pro administrator.
After having our internal opt-in Beta Testers report their experience with the new swiftDialog Inventory Update Progress
script, we realized an Extension Attribute audit was overdue.
Following Graham Pugh’s suggestion immediately provided a more than
230x
reduction in execution time, the best we observed for a single “tuned” Extension Attribute script during this audit.
Software Update Deferrals Extension Attribute: 230x
Improvement
Before
The initial value of real
was slightly more than 21
seconds for our Software Update Deferrals Extension Attribute script:
User dan is logged in No new software available; Reset deferral counter <result>1; No new software available.</result> real 0m21.099s user 0m0.027s sys 0m0.071s
“Tuned” Snippet
We followed Graham’s recommendation, assigning the value of LastRecommendedUpdatesAvailable
to the availableUpdates
variable:
availableUpdates=$( defaults read /Library/Preferences/com.apple.SoftwareUpdate.plist LastRecommendedUpdatesAvailable ) if [ "$availableUpdates" = "0" ]; then # No new software available … else # Kickstart Software Update process launchctl kickstart -k system/com.apple.softwareupdated … fi
After
During this run, the macOS-generated value of LastRecommendedUpdatesAvailable
is zero, so execution time is improved by more than 234
times (i.e., reading the value of a client-side .plist
vs. executing softwareupdate --list
).
User dan is logged in No new software available; Reset deferral counter <result>1; No new software available.</result> real 0m0.090s user 0m0.006s sys 0m0.032s
A. Setup
A.1. Download Extension Attribute List
Use the Classic API to download a list of your Extension Attributes (or use Leslie’s newly released Object Info v3.0.0
):
A.1.A. Login to the Classic API
- View the API Documentation options by appending
/api
after your Jamf Pro server address - Locate the Classic API option and click View
- Enter your Jamf Pro server credentials and click Authorize
- Confirm you observe
Authorized. Token successfully generated!
A.1.B. Download your Extension Attribute list
- From the alphabetical list of endpoints, locate
computerextensionattributes
, click its disclosure triangle, then click Try it out
- Click Execute to run the selected command
- Click Download to save the results as XML
- Right-click the downloaded file and select Open With > Microsoft Excel.
A.2. Establish Inital Baseline
With your list of Extension Attributes in-hand, an easy first-step when auditing Extension Attribute execution time is to use Terminal and the jamf
binary to manually update computer inventory.
A.2.A. Manual Inventory Update
Observe the output of the following command — which requires elevated privileges — and take note of any Extension Attribute scripts which appear to have long execution times (i.e., “Running script for the extension attribute …” is displayed for multiple seconds).
time -p jamf recon -verbose
When the command completes, record the value of real
as your initial baseline.
time -p jamf recon -verbose … verbose: Running script for the extension attribute … … verbose: Gatekeeper status: App Store and identified developers … real 369.14 user 125.40 sys 62.48
A.3. Determine Average Baseline
Enable debug mode for the swiftDialog Inventory Update Progress
policy for your opt-in Beta Testers.
Once several have executed the policy, search the Policy Logs for Elapsed Time
and average the values for your pre-audit baseline.
B. Audit
The auditing workflow leverages Visual Studio Code and Microsoft Excel:
B.1. Jamf Pro Summary
Generate a Jamf Pro Summary for only Computer Extension Attributes:
- Jamf Pro >
- Settings >
- Jamf Pro Summary >
- Select All >
- Unselect All >
- Computer Management – Management Framework >
- Computer Extension Attributes >
- Create >
- Download
Open the dowloaded file in Visual Studio Code.
B.2. eaTest.sh
script
Use Visual Studio Code’s integrated Terminal to create a temporary eaTest.sh
script in your Downloads folder, which you’ll use to test each of your Extension Attribute scripts:
touch ~/Downloads/eaTest.sh
chmod a+x ~/Downloads/eaTest.sh
- Hold down the Option key to “Split Down” the current editor
- Open
~/Downloads/eaTest.sh
in the split window
B.3. Test Extension Attribute script
- For each Extension Attribute, copy-pasta the
Mac Script
code from the Jamf Pro Summary to theeaTest.sh
file and save - In Code’s integrated Terminal, execute the following command:
clear ; time -p ~/Downloads/eaTest.sh
- Note the value of
real
B.4. Record & Evaluate
After downloading and populating the Jamf Pro Extension Attribute Audit Excel Template with your list of Extension Attributes, complete the following steps:
- Assign a Criticality value for each Extension Attribute (i.e., How critical* is this Extension Attribute to your Jamf Pro policies?)
- High
- Med
- Low
- Record the value of
real
in the Original Time column - After you’ve “tuned” your Extension Attribute script, record the value of
real
in the Tuned Time column - Consider the risks and rewards of reducing the execution frequency for an Extension Attribute and assign one of three options in the Reduced Frequency column:
- • In Process
- √ Complete
- X Delete
- Review the impact of completely disabling a script-based Extension Attribute and update the Disabled column:
- • In Process
- √ Complete
- X Delete
- Use the Deleted column to ask yourself: “Would deleting this Extension Attribute — and any associated Smart Groups — negatively impact my Jamf Pro policies?”
- • In Process
- √ Complete
- X Delete
Repeat Steps 1 through 6 for each Extension Attribute.
*In theory, every Extension Attribute is highly critical to your Jamf Pro environment — at least all of them were when you first created them.
In practice, regularly auditing your Extension Attributes comes with the gift of hindsight and allows you to make informed decisions about what you actually need and what you can do without.
C. Findings & Conclusion
Oddly enough, two Extension Attribute included on our API-generated list were missing the actual scripts on the Jamf Pro Summary, requiring us to manually copy-and-paste from the Jamf Pro server during testing.
Luckily, all of our time-intensive Extension Attributes were of a low criticality and we simply disabled them while we continue to evaluate any impact.
Once your performance tuning is complete, ask your opt-in Beta Testers to again run your “debug mode” computer inventory update policy and record the Elapsed Time
.
While we observed 18x
and even 24x
improvements for some edge-cases, 7x
is our average improvement for this audit.
D. Additional Reading
- This Coach Improved Every Tiny Thing by 1 Percent and Here’s What Happened, James Clear
- One Percent Better, Elder Michael A. Dunn