[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom mysql monitoring

From: Vincent Rivellino
Subject: Re: custom mysql monitoring
Date: Wed, 10 May 2006 01:34:35 -0400 (EDT)
User-agent: SquirrelMail/1.5.1

Hash: SHA1

Yup, my predecessor configured monit to hit PHP scripts he wrote to
essentially do MySQL testing.  However, I feel like this solution is a bit
of a hack.  Why should I have to utilize the web server in order to
monitor my MySQL database?  It's just adding complexity.

I'd much rather have monit either hit MySQL directly, or fork and execute
a script.  In the meantime, I'll probably end up going with a cronjob that
dumps a report to a file that monit content-checks.  That seems like the
best near term solution to me.

- -Vince

On Tue, May 9, 2006 23:15, Paul Monaghan wrote:
> Believe it or not, and I'm sure the monit developers aren't going to
> believe this, but YES IT DOES! Sort of. ;)
> You can fake this ability by using monit to connect to a web server
> which queries the database.  For example on my website I have monit grab a
> nice big HTTP GET of a PHP script.  In case PHP crashes (FastCGI under
> Zeus) I'll get a "Bad Gateway" error from Zeus, if monit ever gets this
> HTTP error it will restart Zeus which in turn restarts PHP. There is no
> reason you couldn't build your SQL test queries in PHP and have monit use
> the HTTP test, if you can't connect to the database return a "500 internal
> server error" or something.  Just change your stop and start program to be
> you init script for mysql.
> check process mysql with pidfile /usr/local/zeus/web/internal/pid group
> web start program = "/etc/init.d/mysql start" stop program =
> "/etc/init.d/mysql stop"
> if failed URL then
restart if
> 5 restarts within 5 cycles then timeout
> Where "query=1" would be a predefined query in your mysqltest.php
> script.  If you can CGI/PHP/Perl it and serve it from a web server monit
> can check it. :)
> The only draw back to this would be the reliability of the web server in
> front of the database testing this but there is no reason why the above
> wouldn't work since monit's HTTP checks are far more complete than the
> MySQL checks.
> Regards,
> Paul

Version: GnuPG v1.4.1 (GNU/Linux)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]