Created
September 17, 2016 16:25
-
-
Save cransom/9772c0dd791aee06fb99907473e6f1f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nix-shell | |
#!nix-shell -p fping -i bash | |
while true; do | |
arp -an | grep -v incomplete | cut -f2 -d" "| egrep -o '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | sudo fping -C 30 -D -n -r 0 | tr -d '[]()' | awk '{ print $1, $2, $7 }' | | |
while read -e line; do | |
ts=$(echo $line | awk '{ print $1 }' | tr -d '.')000 | |
host=$(echo $line | awk '{ print $2 }' | tr . _ ) | |
ms=$(echo $line | awk '{ print $3 }' ) | |
curl -X POST 'http://ogre.mad.hubns.net:8086/write?db=mad' \ | |
--data-binary "latency,hostname=$(hostname),pingtarget=$host value=$ms $ts" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment