I wrote a script that handles this. I don't know that it's better than the linked stuff - I haven't looked at it.
However, it does several things I find useful.
Rather than simply up if any pings return, you can set the level of packet-loss that should result in a "practically" down pipe.
You can ping ANY IP/host - not just the gateway - which helps with the loss being upstream. [Just pick the IP/Host carefully - you'd like that host to be as good an indicator of problems as possible.
-Too far away and you'll drop the pipe when nothing's wrong, only the route to that host.
-Too close, and you'll still get to it when there are peering problems, for example - so it will keep the pipe "up" when things are really down.
I'm using it and I'm very happy.