[collectd] MySQL Slave

Sebastian Harl sh at tokkee.org
Fri Mar 20 22:37:42 CET 2009


Hi Kaushal and Florian,

On Tue, Jun 17, 2008 at 08:53:10PM +0200, Florian Forster wrote:
> On Tue, Jun 17, 2008 at 05:07:54PM +0530, Kaushal Shriyan wrote:
> > Can i Monitor MySQL Slave using collectd. Just to know how much it is
> > behind its Master( Seconds_Behind_Master: Variable in the below
> > output.) in the form of plot
> 
> no, that's not yet possible.

Since I'm going to need this at work, I've implemented it today ...

> If you want to implement that, I'd do it as a configurable option,
> something like:
>   <Plugin mysql>
>     ...
>     ServerIsMaster true
>   </Plugin>

I've called the config options "MasterStats" and "SlaveStats". The first
enables the use of the "SELECT MASTER STATUS" command to collect the
position in the master's binlog. The latter enables the use of "SELECT
SLAVE STATUS" to collectd the slave's read and exec positions in the
replay log as well as the value of Seconds_Behind_Master.

> >            Slave_IO_Running: Yes
> >           Slave_SQL_Running: Yes
> fields can be avaluated and a notification may be dispatched for each
> field, so that a status change can be actet upon.

That's implemented as well and can be enabled using the
"SlaveNotifications" option.

> Other than that, I think the following fields have integer values and
> may thus be of interest for performance measurement:
> >         Read_Master_Log_Pos: 359455147

Even though this might not really be interesting, it might provide
further measures when compared to the master's position in the binlog.
I've seen another tool called mysqlard which collects this information
only, so, I guess, it's of interest to some people ;-)

> >               Relay_Log_Pos: 236

Not included - this corresponds to Exec_Master_Log_Pos, so does not add
any further information.

> >                  Last_Errno: 0

Not included - imho, this does not include any useful information. It
provides the error number of the last executed statement. Since there
might be thousands of statements each interval or none at all, it
doesn't provide any meaningful information.

> >                Skip_Counter: 0

Not included - this is a configuration setting.

> >         Exec_Master_Log_Pos: 359455147

Same as for Read_Master_Log_Pos - see above.

> >             Relay_Log_Space: 236

Not included - I'm not really sure what, exactly, that means but it did
not sound useful to me.

> >               Until_Log_Pos: 0

Not included - again, this is a configuration setting.

> >       Seconds_Behind_Master: 0

The most useful information, I guess ;-)

The patches can currently be found in the sh/next branch at
git://git.tokkee.org/collectd.git.

Comments and feedback would be very appreciated. So far, I've only done
some very basic tests in a small test setup, so some more testing would
also be appreciated.

Cheers,
Sebastian

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090320/596edab2/attachment.pgp 


More information about the collectd mailing list