Knowledgebase: Dedicated & VPS Servers
How to install Mytop
Posted by Daniel Scope on 04 December 2011 11:12 AM

MyTop can be hard to configure and setup due to many errors and bugs related to the software, below is a guide that should work on most CentOS servers

rpm -Uhv ftp://ftp.muug.mb.ca/mirror/fedora/epel/5/x86_64/perl-TermReadKey-2.30-4.el5.x86_64.rpm
rpm -Uvh ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el5/en/x86_64/extras/RPMS/perl-DBI-1.616-1.el5.rfx.x86_64.rpm
rpm -Uvh ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el5/en/x86_64/extras/RPMS/perl-DBD-MySQL-4.014-1.el5.rfx.x86_64.rpm
yum -y install mytop
chmod 755 /usr/bin/mytop
nano -w /usr/bin/mytop

Search for this line:

“long|!”              => \$config{long_nums},

Add a # sign in front of it, so it should look like this:

#”long|!”              => \$config{long_nums},

Save Changes and try running "mytop" now. If it gives you the following error you will need to make another change to the configuration

----------------
Cannot connect to MySQL server. Please check the:
* database you specified "test" (default is "test")
* username you specified "root" (default is "root")
* password you specified "" (default is "")
* hostname you specified "localhost" (default is "localhost")
* port you specified "3306" (default is 3306)
* socket you specified "" (default is "")
The options my be specified on the command-line or in a ~/.mytop
config file. See the manual (perldoc mytop) for details.
Here's the exact error from DBI. It might help you debug:
Unknown database 'test'---------------
nano -w /usr/bin/mytop

After you have it open, search for the following in the configuration file:

my %config = (
delay => 5,
host => 'localhost',
db => 'test',
user => 'root',
pass => '',
port => 3306,
socket => '',
batchmode => 0,
header => 1,
color => 1,
idle => 1,
prompt => 0,
mode => 'top',
sort => 0, # default or reverse sort ("s")
filter_user => qr/.?/,
filter_db => qr/.?/,
filter_host => qr/.?/,
long_nums => 0,
);

Replace it with this and save changes:

my %config = (
delay => 5,
host => 'localhost',
db => 'mysql',
user => 'root',
pass => '',
port => 3306,
socket => '',
batchmode => 0,
header => 1,
color => 1,
idle => 1,
prompt => 0,
mode => 'top',
sort => 0, # default or reverse sort ("s")
filter_user => qr/.?/,
filter_db => qr/.?/,
filter_host => qr/.?/,
long_nums => 0,
);

Now running "mytop" should work.

(1 vote(s))
Helpful
Not helpful

Comments (0)