Crossfire Ping Monitoring Part 1: The Setup
I garnered some justified flack at Low End Talk with my last article, Cheap VPS Showdown: Waveride vs VPS Database vs Iniz vs Prometeus vs domVPS, because a simple single-source ping monitor is not going to take into account routing issues that are not necessarily the provider's fault.
OK. Challenge accepted.
Taking your valid criticism into account, and seeing how the major DNS failover providers ping from more than one location, I could monitor all VPSes from each other. Taking a traceroute snapshot every five minutes is not reasonable but would it bear the burden of proof if four VPSes all over Europe agree one is down?
Voici crossfire.sh - a much simpler version of the monitor.sh script used in Quick and Dirty (and Free!) Host Monitoring for DNS Failover and Round-Robin:
#!/bin/bash #HOSTS="10.0.0.10 10.0.0.11 10.0.0.12 10.0.0.13 10.0.0.14" HOSTS="10.0.0.11 10.0.0.12 10.0.0.13 10.0.0.14" COUNT=4 for myHost in $HOSTS do count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') if [ $count -lt $COUNT ]; then echo "$(date) $myHost is down $count of $COUNT packets succeeded." >> /var/www/crossfire/crossfire.log fi done
Slap an executable bit on there and add it to crontab:
*/5 * * * * root /root/crossfire.sh
Now we have all of our VPSes ping monitoring each other. Let's drop in a tidy little nginx vhost so we can pull these logs for comparison remotely:
server { listen 80; server_name my.vps.net; access_log off; error_log /var/www/crossfire/error_log; root /var/www/crossfire; index index.html; }
In part 2 we'll cover collecting the logs and importing them into a database for comparison.
Comments
There are no comments for this item.