Skip to content

Instantly share code, notes, and snippets.

@MikeeI
Last active May 31, 2022 02:14
Show Gist options
  • Save MikeeI/237bf7ed81c3e77004fca26a9ce4ea12 to your computer and use it in GitHub Desktop.
Save MikeeI/237bf7ed81c3e77004fca26a9ce4ea12 to your computer and use it in GitHub Desktop.
#!/bin/bash
STATS=$(speedtest -s 3926 -f json | jq '.ping.latency,.download.bandwidth,.upload.bandwidth')
PING=$(echo $STATS | awk '{printf "%d", $1}')
DOWNLOAD=$(echo $STATS | awk '{printf "%d", $2}')
UPLOAD=$(echo $STATS | awk '{printf "%d", $3}')
echo "rp1_office.ping:${PING}|g" | nc -w 1 -4u localhost 8125
echo "rp1_office.download:${DOWNLOAD}|g" | nc -w 1 -4u localhost 8125
echo "rp1_office.upload:${UPLOAD}|g" | nc -w 1 -4u localhost 8125
echo "rp1_office.ping:${PING}|g"
echo "rp1_office.download:${DOWNLOAD}|g"
echo "rp1_office.upload:${UPLOAD}|g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment