Skip to content

Instantly share code, notes, and snippets.

@acceptableEngineering
Created June 24, 2022 23:09
Show Gist options
  • Save acceptableEngineering/ed68c113bf2b61bc1e561b7d0dd18d6c to your computer and use it in GitHub Desktop.
Save acceptableEngineering/ed68c113bf2b61bc1e561b7d0dd18d6c to your computer and use it in GitHub Desktop.
#!/bin/bash
SPEEDTEST=$(/opt/homebrew/bin/speedtest -I en0 -f json)
RESULT=$(echo $SPEEDTEST | /opt/homebrew/bin/jq '.download.bandwidth')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name SpeedTest-Download --value ${RESULT} --region us-west-2
RESULT=$(echo $SPEEDTEST | /opt/homebrew/bin/jq '.upload.bandwidth')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name SpeedTest-Upload --value ${RESULT} --region us-west-2
RESULT=$(echo $SPEEDTEST | /opt/homebrew/bin/jq '.ping.latency')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name SpeedTest-Ping --value ${RESULT} --region us-west-2
RESULT=$(echo $SPEEDTEST | /opt/homebrew/bin/jq '.packetLoss')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name SpeedTest-Loss --value ${RESULT} --region us-west-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment