monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Is this possible?


From: Pierrick Grasland
Subject: Re: [monit] Is this possible?
Date: Thu, 31 Jul 2008 17:19:03 +0200

Actually, like I said before, I don't have a monit installation at disposition for test.

But, like always, test smalls parts first

check process mysqld with pidfile /var/lib/mysql/brockton.pid
 start program = "/etc/rc.d/init.d/mysql start"
 stop program = "/etc/rc.d/init.d/mysql stop"
  if failed host 192.168.100.7 port 3306 type tcp then restart
 if 5 restarts within 5 cycles then timeout

Try this one first, and when it work, try the following

check file <nameOfTest> with path /var/lib/mysqld/brockton.pid
 if changed sha1 checksum
 then exec "mysql test1 < /root/restart.sql"

I don't see special syntax. If first one don't work, try to comment faulty lines (if failed host ... for example)

On Thu, Jul 31, 2008 at 4:54 PM, Dimitri Yioulos <address@hidden> wrote:
On Thursday 31 July 2008 9:55 am, Pierrick Grasland wrote:
> Hello,
>
> I hope to correctly understand your problem :
>
> *executing a script after mysql restart.*
>
> So, my first solution is below :
> >From the manual :
>
> ***IF CHANGED [MD5|SHA1] CHECKSUM [[<X>] <Y> CYCLES]
>       THEN action*
>
> or
>
> ***IF CHANGED TIMESTAMP [[<X>] <Y> CYCLES] THEN action*
>
>
> I think you can adapted this as follow :
>
>  check file mysqlpidfile path <path of pidfile>
>    if changed sha1 checksum
>          then exec "mysqlreload.sh"
>
>
> Add a simple :
>
> check process mysql with pidfile mysqlpidfile
> start = "..."
> stop = "..."
>
> And I think you have it.
>
> (when mysql restart, it will have a new pid, so a different checksum or
> timestamp
>
> I'm not sure of the syntax (can't test), but I think it will work.
>
> Regards,
>
>
> --
> Pierrick Grasland

Pierrick,

Thank you so much!

Not having a lot of experience creating monit directives, I'm not sure exactly
what to do with the directives you've shown me.  To accomplish what I want to
do, would my directives look like this?:

check process mysqld with pidfile /var/lib/mysql/brockton.pid
 start program = "/etc/rc.d/init.d/mysql start"
 stop program = "/etc/rc.d/init.d/mysql stop"
 if failed host 192.168.100.7 port 3306 type TCP then restart
 if 5 restarts within 5 cycles then timeout

check file /var/lib/mysqld/brockton.pid
 if changed sha1 checksum
 then exec "mysql test1 < /root/restart.sql"

If so, when I try to start monit, I get the follwing error:

Starting monit: /etc/monitrc:216: Error: syntax error 'if'
                                                          [FAILED]

Where am I going wrong?

Dimitri

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general



--
Pierrick Grasland


reply via email to

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