下载相关的innotop包;
http://code.google.com/p/innotop/downloads/list
安装;
[root@Slave02 local]# ls bin mysql cmake-2.8.5 mysqlsla-2.03 doc mysqlsla-2.03.tar.gz etc puppetlabs-release-6-1.noarch.rpm games sbin include share innotop-1.8.1.tar.gz software lib src libexec xtrabackup-1.6.2 man xtrabackup-1.6.2.tar.gz [root@Slave02 local]# tar -zxvf innotop-1.8.1.tar.gz innotop-1.8.1/ innotop-1.8.1/COPYING innotop-1.8.1/t/ innotop-1.8.1/t/innodb-status-005 innotop-1.8.1/t/innodb-status-002 innotop-1.8.1/t/InnoDBParser.t innotop-1.8.1/t/innodb-status-006 innotop-1.8.1/t/innodb-status-001 innotop-1.8.1/t/innodb-status-004 innotop-1.8.1/t/innodb-status-003 innotop-1.8.1/Makefile.PL innotop-1.8.1/innotop innotop-1.8.1/innotop.spec innotop-1.8.1/MANIFEST innotop-1.8.1/Changelog innotop-1.8.1/INSTALL [root@Slave02 local]# cd innotop-1.8.1 [root@Slave02 innotop-1.8.1]# perl Makefile.PL Checking if your kit is complete... Looks good Warning: prerequisite DBD::mysql 1 not found.--缺少相关的perl编译包 Warning: prerequisite Term::ReadKey 2.1 not found.--缺少相关的perl编译包 Writing Makefile for innotop [root@Slave02 innotop-1.8.1]#
[root@Slave02 innotop-1.8.1]# perl -MCPAN -e shell /usr/lib/perl5/5.8.8/CPAN/Config.pm initialized. CPAN is the world-wide archive of perl resources. It consists of about 100 sites that all replicate the same contents all around the globe. Many countries have at least one CPAN site already. The resources found on CPAN are easily accessible with the CPAN.pm module. If you want to use CPAN.pm, you have to configure it properly. If you do not want to enter a dialog now, you can answer 'no' to this question and I'll try to autoconfigure. (Note: you can revisit this dialog anytime later by typing 'o conf init' at the cpan prompt.) Are you ready for manual configuration? [yes] yes The following questions are intended to help you with the configuration. The CPAN module needs a directory of its own to cache important index files and maybe keep a temporary mirror of CPAN files. This may be a site-wide directory or a personal directory. First of all, I'd like to create this directory. Where? CPAN build and cache directory? [/root/.cpan] If you want, I can keep the source files after a build in the cpan home directory. If you choose so then future builds will take the files from there. If you don't want to keep them, answer 0 to the next question. How big should the disk cache be for keeping the build directories with all the intermediate files? Cache size for build directory (in MB)? [10] By default, each time the CPAN module is started, cache scanning is performed to keep the cache size in sync. To prevent from this, disable the cache scanning with 'never'. Perform cache scanning (atstart or never)? [atstart] To considerably speed up the initial CPAN shell startup, it is possible to use Storable to create a cache of metadata. If Storable is not available, the normal index mechanism will be used. Cache metadata (yes/no)? [yes] The next option deals with the charset your terminal supports. In general CPAN is English speaking territory, thus the charset does not matter much, but some of the aliens out there who upload their software to CPAN bear names that are outside the ASCII range. If your terminal supports UTF-8, you say no to the next question, if it supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it supports neither nor, your answer does not matter, you will not be able to read the names of some authors anyway. If you answer no, names will be output in UTF-8. Your terminal expects ISO-8859-1 (yes/no)? [yes] If you have one of the readline packages (Term::ReadLine::Perl, Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN shell will have history support. The next two questions deal with the filename of the history file and with its size. If you do not want to set this variable, please hit SPACE RETURN to the following question. File to save your history? [/root/.cpan/histfile] Number of lines to save? [100] The CPAN module can detect when a module that which you are trying to build depends on prerequisites. If this happens, it can build the prerequisites for you automatically ('follow'), ask you for confirmation ('ask'), or just ignore them ('ignore'). Please set your policy to one of the three values. Policy on building prerequisites (follow, ask or ignore)? [ask] The CPAN module will need a few external programs to work properly. Please correct me, if I guess the wrong path for a program. Don't panic if you do not have some of them, just press ENTER for those. To disable the use of a download program, you can type a space followed by ENTER. Where is your gzip program? [/bin/gzip] Where is your tar program? [/bin/tar] Where is your unzip program? [/usr/bin/unzip] Where is your make program? [/usr/bin/make] Where is your links program? [/usr/bin/links] Where is your wget program? [/usr/bin/wget] Warning: ncftpget not found in PATH Where is your ncftpget program? [] Warning: ncftp not found in PATH Where is your ncftp program? [] Where is your ftp program? [/usr/kerberos/bin/ftp] Where is your gpg program? [/usr/bin/gpg] What is your favorite pager program? [/usr/bin/less] What is your favorite shell? [/bin/bash] Every Makefile.PL is run by perl in a separate process. Likewise we run 'make' and 'make install' in processes. If you have any parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass to the calls, please specify them here. If you don't understand this question, just press ENTER. Parameters for the 'perl Makefile.PL' command? Typical frequently used settings: PREFIX=~/perl non-root users (please see manual for more hints) Your choice: [] Parameters for the 'make' command? Typical frequently used setting: -j3 dual processor system Your choice: [] Parameters for the 'make install' command? Typical frequently used setting: UNINST=1 to always uninstall potentially conflicting files Your choice: [] Sometimes you may wish to leave the processes run by CPAN alone without caring about them. As sometimes the Makefile.PL contains question you're expected to answer, you can set a timer that will kill a 'perl Makefile.PL' process after the specified time in seconds. If you set this value to 0, these processes will wait forever. This is the default and recommended setting. Timeout for inactivity during Makefile.PL? [0] If you're accessing the net via proxies, you can specify them in the CPAN configuration or via environment variables. The variable in the $CPAN::Config takes precedence. Your ftp_proxy? Your http_proxy? Your no_proxy? You have no /root/.cpan/sources/MIRRORED.BY I'm trying to fetch one CPAN: LWP::UserAgent loaded ok Fetching with LWP: ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY Now we need to know where your favorite CPAN sites are located. Push a few sites onto the array (just in case the first on the array won't work). If you are mirroring CPAN to your local workstation, specify a file: URL. First, pick a nearby continent and country (you can pick several of each, separated by spaces, or none if you just want to keep your existing selections). Then, you will be presented with a list of URLs of CPAN mirrors in the countries you selected, along with previously selected URLs. Select some of those URLs, or just keep the old list. Finally, you will be prompted for any extra URLs -- file:, ftp:, or http: -- that host a CPAN mirror. (1) Africa (2) Asia (3) Europe (4) North America (5) Oceania (6) South America Select your continent (or several nearby continents) [] 2 Sorry! since you don't have any existing picks, you must make a geographic selection. (1) China (2) India (3) Indonesia (4) Israel (5) Japan (6) Kazakhstan (7) Pakistan (8) Republic of Korea (9) Singapore (10) Taiwan (11) Thailand (12) Turkey (13) Viet Nam Select your country (or several nearby countries) [] 1 Sorry! since you don't have any existing picks, you must make a geographic selection. (1) ftp://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/ (2) ftp://mirror.communilink.net/CPAN/ (3) ftp://mirrors.neusoft.edu.cn/mirror/cpan/ (4) ftp://mirrors.ustc.edu.cn/CPAN/ (5) ftp://mirrors.xmu.edu.cn/CPAN/ (6) http://mirrors.163.com/cpan/ (7) http://mirrors.btte.net/CPAN/ (8) http://mirrors.devlib.org/cpan/ (9) http://mirrors.sohu.com/CPAN/ Select as many URLs as you like (by number), put them on one line, separated by blanks, e.g. '1 4 5' [] 9 Enter another URL or RETURN to quit: [] New set of picks: http://mirrors.sohu.com/CPAN/ commit: wrote /usr/lib/perl5/5.8.8/CPAN/Config.pm Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.7602) ReadLine support available (try 'install Bundle::CPAN') cpan> --在此编译perl缺少的相关包文件即可
cpan> install Term::ReadKey Running install for module Term::ReadKey Running make for J/JS/JSTOWE/TermReadKey-2.30.tar.gz Fetching with LWP: http://mirrors.sohu.com/CPAN/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz Fetching with LWP: http://mirrors.sohu.com/CPAN/authors/id/J/JS/JSTOWE/CHECKSUMS Checksum for /root/.cpan/sources/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz ok TermReadKey-2.30/ TermReadKey-2.30/genchars.pl TermReadKey-2.30/Makefile.PL TermReadKey-2.30/Configure.pm TermReadKey-2.30/test.pl TermReadKey-2.30/ReadKey.pm TermReadKey-2.30/META.yml TermReadKey-2.30/ReadKey.xs TermReadKey-2.30/ppport.h TermReadKey-2.30/MANIFEST TermReadKey-2.30/README CPAN.pm: Going to build J/JS/JSTOWE/TermReadKey-2.30.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Term::ReadKey cp ReadKey.pm blib/lib/Term/ReadKey.pm AutoSplitting blib/lib/Term/ReadKey.pm (blib/lib/auto/Term/ReadKey) /usr/bin/perl -I/usr/lib/perl5/5.8.8 genchars.pl Writing termio/termios section of cchars.h... Done. Checking for sgtty... Sgtty NOT found. Writing sgtty section of cchars.h... Done. /usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -noprototypes -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap ReadKey.xs > ReadKey.xsc && mv ReadKey.xsc ReadKey.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DVERSION=\"2.30\" -DXS_VERSION=\"2.30\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE" ReadKey.c In file included from ReadKey.xs:6: ppport.h:230:1: warning: "PERL_UNUSED_DECL" redefined In file included from ReadKey.xs:4: /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/perl.h:163:1: warning: this is the location of the previous definition In file included from ReadKey.xs:375: cchars.h: In function 釾S_Term__ReadKey_GetControlChars? cchars.h:244: warning: unused variable 鈏? ReadKey.xs: In function 釸eadMode? ReadKey.xs:770: warning: unused variable 釶erl___notused? ReadKey.c: In function 釾S_Term__ReadKey_SetTerminalSize? ReadKey.c:1999: warning: unused variable 鈚arg? Running Mkbootstrap for Term::ReadKey () chmod 644 ReadKey.bs rm -f blib/arch/auto/Term/ReadKey/ReadKey.so gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib ReadKey.o -o blib/arch/auto/Term/ReadKey/ReadKey.so \ \ chmod 755 blib/arch/auto/Term/ReadKey/ReadKey.so cp ReadKey.bs blib/arch/auto/Term/ReadKey/ReadKey.bs chmod 644 blib/arch/auto/Term/ReadKey/ReadKey.bs Manifying blib/man3/Term::ReadKey.3pm /usr/bin/make -- OK Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" -w test.pl 1 .. 8 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 ok 7 ok 8 /usr/bin/make test -- OK Running make install Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Term/ReadKey/ReadKey.bs Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Term/ReadKey/ReadKey.so Files found in blib/arch: installing files in blib/lib into architecture dependent library tree Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Term/ReadKey/autosplit.ix Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Term/ReadKey.pm Installing /usr/share/man/man3/Term::ReadKey.3pm Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Term/ReadKey/.packlist Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod /usr/bin/make install -- OK cpan>install DBIcpan>install DBD::mysql
[root@Slave02 innotop-1.8.1]# perl Makefile.PL Writing Makefile for innotop Writing MYMETA.yml and MYMETA.json [root@Slave02 innotop-1.8.1]# --再次编译不会出现任何错误信息提示;[root@Slave02 innotop-1.8.1]# make install --安装编译innotop cp innotop blib/script/innotop /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/innotop Manifying blib/man1/innotop.1 Installing /usr/share/man/man1/innotop.1 Installing /usr/bin/innotop Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod [root@Slave02 innotop-1.8.1]#[root@Slave02 innotop-1.8.1]# innotop --help Usage: innotop <options> <innodb-status-file> --[no]color -C Use terminal coloring (default) --config -c Config file to read --count Number of updates before exiting --delay -d Delay between updates in seconds --help Show this help message --host -h Connect to host --[no]inc -i Measure incremental differences --mode -m Operating mode to start in --nonint -n Non-interactive, output tab-separated fields --password -p Password to use for connection --port -P Port number to use for connection --skipcentral -s Skip reading the central configuration file --socket -S MySQL socket to use for connection --timestamp -t Print timestamp in -n mode (1: per iter; 2: per line) --user -u User for login if not current user --version Output version information and exit --write -w Write running configuration into home directory if no config files were loaded innotop is a MySQL and InnoDB transaction/status monitor, like 'top' for MySQL. It displays queries, InnoDB transactions, lock waits, deadlocks, foreign key errors, open tables, replication status, buffer information, row operations, logs, I/O operations, load graph, and more. You can monitor many servers at once with innotop. [root@Slave02 innotop-1.8.1]#然后输入innotop -uroot -proot 即可得到如下监控样式;When Load QPS Slow Se/In/Up/De% QCacheHit KCacheHit BpsIn BpsOut Now 0.77 3.08 0 0/ 0/ 0/ 0 0.00% 100.00% 135.44 13.71k Total 0.00 0.00 0 0/ 0/ 0/ 0 0.00% 100.00% 0.21 12.23 Cmd ID State User Host DB Time Query [RO] Query List (? for help) localhost, 01:04:23.616, 3.67 QPS, 1/1/0 con/run/ca When Load QPS Slow Se/In/Up/De% QCacheHit KCacheHit BpsIn BpsOut Now 0.92 3.67 0 0/ 0/ 0/ 0 0.00% 100.00% 161.42 16.34k Total 0.00 0.00 0 0/ 0/ 0/ 0 0.00% 100.00% 0.23 14.59 Cmd ID State User Host DB Time Query [RO] Query List (? for help) localhost, 01:04:24.182, 3.54 QPS, 1/1/0 con/run/ca When Load QPS Slow Se/In/Up/De% QCacheHit KCacheHit BpsIn BpsOut Now 0.88 3.54 0 0/ 0/ 0/ 0 0.00% 100.00% 155.55 15.75k Total 0.00 0.00 0 0/ 0/ 0/ 0 0.00% 100.00% 0.26 16.95各种模式的切换(注意大写键) Alt+大写字母13614125921 13614125921 13614125921 38048 0.00 [RO] InnoDB I/O Info (? for help) 192.168.0.6, 6+22:31:11.380, InnoDB 10s :-), 0.90 QPS, 30/0/0 con/run/cac thds, 5.5.25-log ____________________ I/O Threads ____________________ Thread Purpose Thread Status 0 insert buffer thread waiting for i/o request 1 log thread waiting for i/o request 2 read thread waiting for i/o request 3 read thread waiting for i/o request 4 read thread waiting for i/o request 5 read thread waiting for i/o request 6 write thread waiting for i/o request 7 write thread waiting for i/o request 8 write thread waiting for i/o request 9 write thread waiting for i/o request ____________________________ Pending I/O _____________________________ Async Rds Async Wrt IBuf Async Rds Sync I/Os Log Flushes Log I/Os 0 0 0 0 ________________________ File I/O Misc _________________________ OS Reads OS Writes OS fsyncs Reads/Sec Writes/Sec Bytes/Sec 10352106 101646 65043 0.00 0.00 0 _____________________ Log Statistics ______________________ Sequence No. Flushed To Last Checkpoint IO Done IO/Sec 13614125921 13614125921 13614125921 38048 0.00
help?[RO] InnoDB I/O Info (? for help) 192.168.0.6, 6+22:31:21.532, InnoDB 10s :-), 0.39 QPS, 30/0/0 con/run/cac thds, 5.5.25-log Switch to a different mode: B InnoDB Buffers L Locks R InnoDB Row Ops C Command Summary M Replication Status S Variables & Status D InnoDB Deadlocks O Open Tables T InnoDB Txns F InnoDB FK Err Q Query List U User Statistics I InnoDB I/O Info Actions: d Change refresh interval p Pause innotop i Toggle incremental status display q Quit innotop n Switch to the next connection Other: TAB Switch to the next server group / Quickly filter what you see ! Show license and warranty = Toggle aggregation # Select/create server groups @ Select/create server connections $ Edit configuration settings \ Clear quick-filters Press any key to continue