InnoDBParser.3pm

Langue: en

Version: 2007-11-09 (fedora - 05/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

InnoDBParser - Parse InnoDB monitor text.

DESCRIPTION

InnoDBParser tries to parse the output of the InnoDB monitor. One way to get this output is to connect to a MySQL server and issue the command SHOW ENGINE INNODB STATUS (omit 'ENGINE' on earlier versions of MySQL). The goal is to turn text into data that something else (e.g. innotop) can use.

The output comes from all over, but the place to start in the source is innobase/srv/srv0srv.c.

SYNOPSIS

    use InnoDBParser;
    use DBI;
 
    # Get the status text.
    my $dbh = DBI->connect(
       "DBI::mysql:test;host=localhost",
       'user',
       'password'
    );
    my $query = 'SHOW /*!5 ENGINE */ INNODB STATUS';
    my $text  = $dbh->selectcol_arrayref($query)->[0];
 
    # 1 or 0
    my $debug = 1;
 
    # Choose sections of the monitor text you want.  Possible values:
    # TRANSACTIONS                          => tx
    # BUFFER POOL AND MEMORY                => bp
    # SEMAPHORES                            => sm
    # LOG                                   => lg
    # ROW OPERATIONS                        => ro
    # INSERT BUFFER AND ADAPTIVE HASH INDEX => ib
    # FILE I/O                              => io
    # LATEST DETECTED DEADLOCK              => dl
    # LATEST FOREIGN KEY ERROR              => fk
 
    my $required_sections = {
       tx => 1,
    };
 
    # Parse the status text.
    my $parser = InnoDBParser->new;
    $innodb_status = $parser->parse_status_text(
       $text,
       $debug,
       # Omit the following parameter to get all sections.
       $required_sections,
    );
 
 

COPYRIGHT, LICENSE AND WARRANTY

This package is copyright (c) 2006 Baron Schwartz, baron at xaprb dot com. Feedback and improvements are gratefully received.

THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2; OR the Perl Artistic License. On UNIX and similar systems, you can issue `man perlgpl' or `man perlartistic' to read these licenses.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

AUTHOR

Baron Schwartz, baron at xaprb dot com.

BUGS

None known, but I bet there are some. The InnoDB monitor text wasn't really designed to be parsable.

SEE ALSO

innotop - a program that can format the parsed status information for humans to read and enjoy.