Skip to content

Instantly share code, notes, and snippets.

@moregeek
Last active December 31, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moregeek/8013622 to your computer and use it in GitHub Desktop.
Save moregeek/8013622 to your computer and use it in GitHub Desktop.
Check Edis RPi Colocation Range for online/offline RPi's (if FW blocks ICMP => offline)
#!/usr/bin/env bash
# q&d; WTFPL;
count_off=0;
count_onl=0;
for n in {1..254}; do
ip="151.236.12.${n}";
ping -c1 -t1 ${ip} > /dev/null 2>&1
if [ $? -eq 0 ]; then
$[count_onl+=1] 2> /dev/null;
echo -e "${ip}:\tONLINE";
else
$[count_off+=1] 2> /dev/null;
echo -e "${ip}:\tOFFLINE";
fi
done
echo "====== STATS ======"
echo "ONLINE: ${count_onl}"
echo "OFFLINE: ${count_off}"
echo "==================="

2013/12/17:

  • ONLINE: 71
  • OFFLINE: 183

2013/12/18:

  • ONLINE: 85
  • OFFLINE: 169
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment