monit-general
[Top][All Lists]
Advanced

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

Re: How to test threads for a service


From: Jaakko Heusala
Subject: Re: How to test threads for a service
Date: Tue, 10 Jan 2006 17:51:20 +0200 (EET)

Hi,

On Tue, 10 Jan 2006, Jan-Henrik Haukeland wrote:

My only idea for now would be to use pid testing with exec to change symbolic links on filesystem to /proc/pid/status, so file content testing could be used to check /path/to/link with regex (at least on Linux 2.6.14). I don't really like this hack...

This is actually not a bad idea and a fine workaround in my book if I understood this correctly. Care to submit your setup to this list? This may be of interest to others.

Here it is but I am only testing it right now. Changing symbolic link seem to work well but I'm not sure does that file content match work as I intended.

Script update-pid-link.sh can be found from http://isleo.kapsi.fi/pub/monit/update-pid-link.sh. It just changes the link.

The regex matches if there are more than 100 threads and then restarts mysql server. It also executes directly init.d-script. Is there better way to do that?

# MySQL
check process mysql with pidfile /var/run/mysqld/mysqld.pid
    start program = "/etc/init.d/mysql start"
    stop program  = "/etc/init.d/mysql stop"
    if changed pid
        then exec "/usr/local/sbin/update-pid-link.sh /var/run/mysqld/mysqld.pid 
/srv-proc/mysql"
    if 3 restarts within 5 cycles then timeout
    group database

check file mysql-status with path /srv-proc/mysql/status
    start program = "/usr/local/sbin/update-pid-link.sh /var/run/mysqld/mysqld.pid 
/srv-proc/mysql"
    if match "^Threads:[^0-9]+[0-9]{3}" then
        exec "/etc/init.d/mysql restart"
    depends mysql

--
Jaakko H. Heusala
(08) 5566104 / 040 70 99 704
http://www.isleo.kapsi.fi/





reply via email to

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