monit-general
[Top][All Lists]
Advanced

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

Re: {Disarmed} Re: [monit] Is this possible?


From: Dimitri Yioulos
Subject: Re: {Disarmed} Re: [monit] Is this possible?
Date: Thu, 31 Jul 2008 12:23:18 -0400
User-agent: KMail/1.9.3

(I'm not sure if I should be top-posting, but to keep the thread consistent, 
I'm top-posting)

The command is mysql start, and not mysqld start.  The restart of MySQl works 
fine.  I created an simple bash script to execute "myfile.sql", which I 
tested and know works. So, the second directive looks like this:

check file brockton.pid path /var/lib/mysql/brockton.pid
  if changed checksum
  then exec "/root/restart.sh"

However, the script doesn't seem to fire off.  So, I'm almost there, but the 
most important part (the MySQL table work) isn't happening.  Any ideas as to 
why?

Dimitri


On Thursday 31 July 2008 11:34 am, Pierrick Grasland wrote:
> just in case :
>
> mysql or mysqld ?
>
> if it's the second, then your error is here :
>
> start program = "/etc/rc.d/init.d/mysql*d* start"
>  stop program = "/etc/rc.d/init.d/mysql*d* stop"
>
> On Thu, Jul 31, 2008 at 5:20 PM, Dimitri Yioulos 
<address@hidden>wrote:
> > 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.
> >
> >
> >
> > --
> > To unsubscribe:
> > http://lists.nongnu.org/mailman/listinfo/monit-general
>
> --
> Pierrick Grasland

-- 
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]