Rabu, 07 November 2018

How to Install Mytop from source on Centos 6

  Tidak ada komentar
Mytop is an open source and free monitoring program for MySQL and MariaDB databases was written by Jeremy Zawodny using Perl language. It is much similar in look and feel of the most famous Linux system monitoring tool called top.

Mytop program provides a command-line shell interface to monitor real time MySQL/MariaDB threads, queries per second, process list and performance of databases and gives a idea for the database administrator to better optimize the server to handle heavy load.

Download mytop package source from official website : http://jeremy.zawodny.com/mysql/mytop/
[root@cloud ~]# curl -O http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 19720  100 19720    0     0   5852      0  0:00:03  0:00:03 --:--:--  5862
[root@cloud ~]#
[root@cloud ~]# ls
anaconda-ks.cfg   apr-util-1.6.1.tar.gz  httpd-2.4.28.tar.gz  install.log         mysql80-community-release-el6-1.noarch.rpm  php-5.5.17
apr-1.6.5.tar.gz  db_bak                 httpd-2.4.36         install.log.syslog  mytop-1.6.tar.gz                            php-5.5.17.tar.gz
[root@cloud ~]#
.Extract the mytop package
[root@cloud ~]# tar xzf mytop-1.6.tar.gz
[root@cloud ~]# ls
anaconda-ks.cfg        db_bak               install.log                                 mytop-1.6         php-5.5.17.tar.gz
apr-1.6.5.tar.gz       httpd-2.4.28.tar.gz  install.log.syslog                          mytop-1.6.tar.gz
apr-util-1.6.1.tar.gz  httpd-2.4.36         mysql80-community-release-el6-1.noarch.rpm  php-5.5.17
[root@cloud ~]#

Install perl TermReadKey to avoid error Warning: prerequisite Term::ReadKey 2.1 not found.
[root@cloud ~]# yum install perl-TermReadKey
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.biz.net.id
 * epel: del-repos.extreme-ix.org
 * extras: centos.biz.net.id
 * updates: centos.biz.net.id
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package perl-TermReadKey.x86_64 0:2.30-13.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                                   Arch                            Version                               Repository                     Size
 perl-TermReadKey                          x86_64                          2.30-13.el6                           base                           31 k

Transaction Summary
Install       1 Package(s)

Total download size: 31 k
Installed size: 62 k
Is this ok [y/N]: y
Downloading Packages:
perl-TermReadKey-2.30-13.el6.x86_64.rpm                                                                                       |  31 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : perl-TermReadKey-2.30-13.el6.x86_64                                                                                               1/1
  Verifying  : perl-TermReadKey-2.30-13.el6.x86_64                                                                                               1/1

  perl-TermReadKey.x86_64 0:2.30-13.el6

[root@cloud ~]#
Change working directory to mytop
[root@cloud ~]# cd mytop-1.6
[root@cloud mytop-1.6]# ls
Changes  INSTALL  Makefile  Makefile.PL  MANIFEST  META.yml  mytop  README  test.pl
[root@cloud mytop-1.6]#
Execute the makefile with perl
[root@cloud mytop-1.6]# perl Makefile.PL
Writing Makefile for mytop
[root@cloud mytop-1.6]#
Compile the mytop
[root@cloud mytop-1.6]# make
cp mytop blib/script/mytop
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/mytop
Manifying blib/man1/mytop.1
[root@cloud mytop-1.6]#
Testing before install
[root@cloud mytop-1.6]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
ok 1
[root@cloud mytop-1.6]#
Install mytop
[root@cloud mytop-1.6]# make install
Installing /usr/local/share/man/man1/mytop.1
Installing /usr/local/bin/mytop
Appending installation info to /usr/lib64/perl5/perllocal.pod
[root@cloud mytop-1.6]#
Edit mytop binary
[root@cloud ~]# vi /usr/local/bin/mytop
[root@cloud ~]#
Mark the "long|!" => \$config{long_nums}, To solve error Error in option spec: "long|!"
    "color!"              => \$config{color},
    "user|u=s"            => \$config{user},
    "pass|password|p=s"   => \$config{pass},
    "database|db|d=s"     => \$config{db},
    "host|h=s"            => \$config{host},
    "port|P=i"            => \$config{port},
    "socket|S=s"          => \$config{socket},
    "delay|s=i"           => \$config{delay},
    "batch|batchmode|b"   => \$config{batchmode},
    "header!"             => \$config{header},
    "idle|i"              => \$config{idle},
    "resolve|r"           => \$config{resolve},
    "prompt!"             => \$config{prompt},
#    "long|!"              => \$config{long_nums},
    "mode|m=s"            => \$config{mode},
    "sort=s"              => \$config{sort},
Run mytop with following command
[root@cloud ~]# mytop --prompt -u root -d portal
The output of running mytop
MySQL on localhost (5.5.62)                                                                                                 up 11+10:06:05 [22:11:18]
 Queries: 5.0    qps:    0 Slow:     0.0         Se/In/Up/De(%):    00/00/00/00
             qps now:    0 Slow qps: 0.0  Threads:    1 (   1/   0) 00/00/00/00
 Key Efficiency: 100.0%  Bps in/out:   0.0/  0.0   Now in/out:   8.3/ 1.7k

      Id      User         Host/IP         DB      Time    Cmd Query or State
      --      ----         -------         --      ----    --- ----------
      12      root       localhost     portal         0  Query show full processlist

[root@cloud ~]#

Tidak ada komentar :

Posting Komentar