I no longer recommend the below method. For my updated recommendation, see this gist
The linux watchdog service can be configured to run certain 'liveness' tests periodically, and then take some action (such as reboot) if a test fails (and doesn't recover) for some period of time.
There is a built-in test for pinging an IP address (i.e. 'ping' directive), but you may instead need to test access to a hostname