Deploy your favorite from a trio of Jamf Pro Extension Attributes which leverage macOS Monterey’s (and later)
networkQuality
binary to help you better understand your users’ Internet connection
Background
After reviewing Brock Walter’s The networkQuality Is Not Strained post and observing fairly consistent download failures for just a handful of users, the time was right to leverage the networkQuality
binary introduced in macOS Monterey to better understand our users’ Internet connection.
networkQuality -h
The built-in help for networkQuality
can be viewed by entering: networkQuality -h
.
% networkQuality -h USAGE: networkQuality [-C <configuration_url>] [-c] [-h] [-I <interfaceName>] [-s] [-v] -C: override Configuration URL -c: Produce computer-readable output -h: Show help (this message) -I: Bind test to interface (e.g., en0, pdp_ip0,...) -s: Run tests sequentially instead of parallel upload/download -v: Verbose output
man networkQuality
Be certain to capitalize the Q
to review the man
page (thanks, Brock!):
% man networkQuality networkQuality(8) System Manager's Manual NAME networkQuality – Network quality testing tool SYNOPSIS networkQuality [-chsv] [-I interface] [-C configuration URL] DESCRIPTION networkQuality allows for measuring the different aspects of Network Quality, including: Maximal capacity (often described as speed) The responsiveness of the connection. Responsiveness measures the quality of your network by the number of roundtrips completed per minute (RPM) under working conditions. See https://support.apple.com/kb/HT212313 Other aspects of the connection that affect the quality of experience. NOTE: This tool will connect to the Internet to perform its tests. This will use data on your Internet service plan. For more details about the RPM score and the methodology around the testing, see https://datatracker.ietf.org/doc/draft-cpaasch-ippm-responsiveness/ The following options are available: -C configuration URL Use custom configuration URL. See https://github.com/network-quality/server for server implementation details. -I interface Bind test to interface (e.g., en0, pdp_ip0,...) If not specified, the default interface will be used. -c Produce computer-readable output -h Show help -s Run tests sequentially instead of parallel upload/download -v Verbose output
1. Download Capacity
A script to determine the download capacity of the Mac’s Internet connection.
Initially, we started with Download capacity because it’s the most user-friendly. (Nearly all users know the amount of bandwidth for which they’re paying their ISP and seeing Jamf Pro report a number close to this value made the most sense.)
#!/bin/sh ################################################################################# # A script to determine the download capacity of the Mac's Internet connection. # ################################################################################# osProductVersion=$( /usr/bin/sw_vers -productVersion ) case "${osProductVersion}" in 10* | 11* ) echo "<result>N/A; macOS ${osProductVersion}</result>" ;; 12* ) downloadCapacity=$( /usr/bin/networkQuality | /usr/bin/awk '/Download capacity:/{print $3, $4}' ) echo "<result>${downloadCapacity}</result>" ;; 13* ) downlinkCapacity=$( /usr/bin/networkQuality | /usr/bin/awk '/Downlink capacity:/{print $3, $4}' ) echo "<result>${downlinkCapacity}</result>" ;; esac exit 0
Output
Adding any Extension Attribute to Jamf Pro will increase the time required for a complete inventory update, so we’ll include time
at the start of our command to both validate the EA’s output and get a sense for the additional overhead:
time sh ./networkQuality-download-capacity.sh <result>950.450 Mbps</result> real 0m16.771s user 0m1.290s sys 0m1.241s
2. Download Responsiveness
A script to determine the download responsiveness of the Mac’s Internet connection.
While knowing the download capacity of users’ Internet connection is interesting, since we’re troubleshooting random download failures in Jamf Pro policies, we really want to know download responsiveness, which measures the quality of the network by the number of roundtrips per minute (RPM); see: Understanding your results.
#!/bin/sh ####################################################################################### # A script to determine the download responsiveness of the Mac's Internet connection. # ####################################################################################### osProductVersion=$( /usr/bin/sw_vers -productVersion ) case "${osProductVersion}" in 10* | 11* ) echo "<result>N/A; macOS ${osProductVersion}</result>" ;; 12* ) downloadResponsiveness=$( /usr/bin/networkQuality -s -v | /usr/bin/awk '/Download Responsiveness:/{print $3, $4, $5}' ) echo "<result>${downloadResponsiveness}</result>" ;; 13* ) downlinkResponsiveness=$( /usr/bin/networkQuality -s -v | /usr/bin/awk '/Downlink Responsiveness:/{print $3, $4, $5}' ) echo "<result>${downlinkResponsiveness}</result>" ;; esac exit 0
Output
time sh ./networkQuality-download-responsiveness.sh <result>High (1114 RPM)</result> real 0m32.474s user 0m1.678s sys 0m1.890s
3. Network Quality
A script to determine the network quality of the Mac’s Internet connection.
We ended up using a “hybrid” EA which includes both download capacity and download responsiveness.
#!/bin/sh ############################################################################### # A script to determine the network quality of the Mac's Internet connection. # ############################################################################### osProductVersion=$( /usr/bin/sw_vers -productVersion ) case "${osProductVersion}" in 10* | 11* ) echo "<result>N/A; macOS ${osProductVersion}</result>" ;; 12* ) networkQualityTest=$( /usr/bin/networkQuality -s -v ) downloadCapacity=$( echo "${networkQualityTest}" | /usr/bin/awk '/Download capacity:/{print $3, $4}' ) downloadResponsiveness=$( echo "${networkQualityTest}" | /usr/bin/awk '/Download Responsiveness:/{print $3, $4, $5}' ) echo "<result>${downloadCapacity} | ${downloadResponsiveness}</result>" ;; 13* ) networkQualityTest=$( /usr/bin/networkQuality -s -v ) downlinkCapacity=$( echo "${networkQualityTest}" | /usr/bin/awk '/Downlink capacity:/{print $3, $4}' ) downlinkResponsiveness=$( echo "${networkQualityTest}" | /usr/bin/awk '/Downlink Responsiveness:/{print $3, $4, $5}' ) echo "<result>${downlinkCapacity} | ${downlinkResponsiveness}</result>" ;; esac exit 0
Output
time sh ./networkquality.sh <result>956.120 Mbps | High (1132 RPM)</result> real 0m31.202s user 0m1.842s sys 0m2.087s