This recipe runs a quick LAN throughput test with iperf3, updates a TerminalWidget target, and also prints the measured Mbps to STDOUT.
It is designed for a Synology host running iperf3 (default host alias: syn), but it also works on other Linux/Unix systems with minimal changes to host and binary paths.
Script path: - ~/bin/widget-network-perf.sh
1) Requirements
Install and verify:
- ssh access to the remote host alias (default: syn)
- iperf3 on the remote host at /usr/local/bin/iperf3 (this path is common on Synology; adjust on other systems)
- local client binary iperf3-darwin in PATH
- terminal-widget CLI in PATH
Quick checks:
command -v ssh
command -v iperf3-darwin
command -v terminal-widget
ssh syn 'command -v /usr/local/bin/iperf3'
2) Make It Executable
chmod +x ~/scripts/widget-network-perf.sh
3) Configure Variables
Open the script and edit the variables at the top if needed:
- SSH_HOST
- IPERF_SERVER_BIN
- IPERF_CLIENT_BIN
- IPERF_CLIENT_TARGET
- REMOTE_SERVER_LOG
- WIDGET_TARGET
- WIDGET_TITLE
- WIDGET_BG
- WIDGET_FG
This is intentionally grouped at the top so sharing/customization is easy.
4) Run Manually
~/scripts/widget-network-perf.sh
Expected behavior:
- Starts a one-shot iperf3 server remotely
- Runs local iperf client against IPERF_CLIENT_TARGET
- Updates widget target network_perf with multiline text:
- LAN Performance
- <mbps>Mb/s
- timestamp (%m/%d %H:%M)
- Prints raw Mbps value to STDOUT
5) Use As a TerminalWidget Recipe
Use your existing TerminalWidget recipe mechanism and set the command to:
~/scripts/widget-network-perf.sh
Recommended:
- Refresh interval: 5-15 minutes for a stable signal
- Keep widget target as network_perf unless you want a different widget ID
6) Troubleshooting
If the widget does not update:
- Confirm terminal-widget is installed and in PATH
- Run script directly in Terminal to see STDERR output
- Confirm remote host alias resolves and allows SSH
If throughput cannot be parsed: - iperf output format may differ; run:
iperf3-darwin -c Cyberzerk.local
- verify output includes
Mbits/secon sender or receiver summary lines