[X-POST] PHP script to make sure MySQL is up?
| From: | Brian Dunning | Date: | Thu, 01 Mar 2007 19:37:57 +0000 |
| Subject: | [X-POST] PHP script to make sure MySQL is up? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-249669@lists.php.net to get a copy of this message | ||
I host at Rackspace, and one thing that their monitoring service does NOT catch is a problem when too many connections hit MySQL, and for some reason it remains hung up until the service is manually restarted. In the meantime, this is happening to us once or twice a month. It gets hammered with a huge number of brief connections from other Apache servers.
Slow queries and mysql_close() are NOT the problem. It's just too many connections, even though they're super fast.
Is there such a thing as a PHP script that I can put on a cron job to run every minute and make a test query, and upon failure, restart the service and maybe send an email to Rackspace support? I don't know how you'd check that the query was refused due to too many connections, and I also don't know how PHP would restart the MySQL service.
Thanks... :)