monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Is this possible?


From: Dimitri Yioulos
Subject: Re: [monit] Is this possible?
Date: Thu, 31 Jul 2008 11:20:36 -0400
User-agent: KMail/1.9.3

On Thursday 31 July 2008 10:54 am, Dimitri Yioulos 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

Sorry to respond to my own post, but I corrected one of the directives (should 
have followed Pierrick's directions explicitly :-) ) to read:

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

and the error I quoted in my last post went away.  However, it's been replaced 
by:

Starting monit: /etc/monitrc:217: Error: the executable does not exist 'mysql'
                                                           [FAILED]

The script I'm using to do the table changes in MySQL is in the 
form "myfile.sql", and is executed with the command "mysql databasename < 
myfile.sql".  Monit seems to be tripping over this.  Am I not able to execute 
this command via monit?

Dimitri

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





reply via email to

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