Skip to content

Instantly share code, notes, and snippets.

@drankard
Created December 12, 2016 13:35
Show Gist options
  • Save drankard/e2384a87146b1e19015c9bb056bde8cb to your computer and use it in GitHub Desktop.
Save drankard/e2384a87146b1e19015c9bb056bde8cb to your computer and use it in GitHub Desktop.
total 1608
#!/bin/bash
host=$1
ping $host | while read pong; do
echo $pong | grep --line-buffered -o 'time=\S*' | \
sed -e 's/time=//' | \
xargs -I {} aws cloudwatch put-metric-data --namespace wifi-ping --metric-name ping-latency --dimensions "host=$host" --timestamp "$(date)" --unit Milliseconds --value {}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment