Menu Close

Jamf Pro Performance Tuning: Extension Attribute Audit

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
  1. View the API Documentation options by appending /api after your Jamf Pro server address
  2. Locate the Classic API option and click View
  1. Enter your Jamf Pro server credentials and click Authorize
  1. Confirm you observe Authorized. Token successfully generated!
A.1.B. Download your Extension Attribute list
  1. From the alphabetical list of endpoints, locate computerextensionattributes, click its disclosure triangle, then click Try it out

  1. Click Execute to run the selected command

  1. Click Download to save the results as XML

  1. 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:

  1. Jamf Pro >
  2. Settings >
  3. Jamf Pro Summary >
  4. Select All >
  5. Unselect All >
  6. Computer Management – Management Framework >
  7. Computer Extension Attributes >
  8. Create >
  9. 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:

  1. touch ~/Downloads/eaTest.sh
  2. chmod a+x ~/Downloads/eaTest.sh
  3. Hold down the Option key to “Split Down” the current editor
  1. Open ~/Downloads/eaTest.sh in the split window
B.3. Test Extension Attribute script
  1. For each Extension Attribute, copy-pasta the Mac Script code from the Jamf Pro Summary to the eaTest.sh file and save
  2. In Code’s integrated Terminal, execute the following command:
    clear ; time -p ~/Downloads/eaTest.sh
  3. 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:

  1. Assign a Criticality value for each Extension Attribute (i.e., How critical* is this Extension Attribute to your Jamf Pro policies?)
    • High
    • Med
    • Low
  2. Record the value of real in the Original Time column
  3. After you’ve “tuned” your Extension Attribute script, record the value of real in the Tuned Time column
  4. 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
  5. Review the impact of completely disabling a script-based Extension Attribute and update the Disabled column:
    • • In Process
    • √ Complete
    • X Delete
  6. 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

Posted in Extension Attributes, Jamf Pro, macOS, Scripts, Tips & Tricks

Related Posts