After a long period of not integrating patches, I've released the newest version of mytop.
mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of MySQL 3.22.x, 3.23.x, and 4.x servers. It runs on most Unix systems (including Mac OS X) which have Perl, DBI, and Term::ReadKey installed. And with Term::ANSIColor installed you even get color. If you install Time::HiRes, you'll get good real-time queries/second stats.
Version 1.4 contains several new features, including a revamped display at the top of the screen. See the Changes file for a details about what's new.
Give it a whirl and let me know of bugs or feature requests. To discuss, hop on the mailing list.
Posted by jzawodn at August 04, 2003 10:45 AM
Thanks, keep up the good work! Two things:
The "Download" link on top of the mytop page still points to the 1.3 tarball
RPMs for SuSE Linux 8.2 can be downloaded from here: http://www.lenzg.org/RPMs/8.2-i386/
Very nice tool indeed. I installed it successfully on both Solaris 2.8 and Mac OS X 10.2.6.
Looking forward to reading this book ;-)
I like it. I had been using mtop by Marc Prewitt. I think when I last tried mytop I gave up because it segfaulted on me. This version did too, but I tracked it down to the mysql_read_default_group in $dns. Upgrading my DBD::mysql didn't help, but I got mytop running by removing mysql_read_default_group from the dsn.
I've noticed two things that you might consider bugs.
1) After pressing 'm' to get a scrolling view of querries per second the intructions are to hit q to exit this mode. q actually exits mytop and drops the user to the command line.
2) Switching off the header also appears to switch off the clearing of the screen between refreshes.
Odd. I haven't heard of *that* causing a segfault before.
Anyway, I'll get the other bugs fixed. They should be easy. :-)
Thanks!
Hmm, I keep meaning to try mysqltop. I wrote something similar-ish a while back, but much simpler. It seems when I have difficulty on my site I'm always banging at w, pstree and mysqles (mysqlextendedstatus--my version), to see what's what. (Typically, it's the FT search swapping its indices out to disk, yay.) Anyhow, perhaps other folks might want to try my script. I've only tested this on linux, so no idea if it works elsewhere, but should as it's plain ugly perl. It gives similar types of info as mysqltop, but in a slightly more compact way, well, in a way I'm used to, anyhow. See if you like it. (BTW yes I know this isn't the prettiest thing.)
Typical output:
Server up 457.0 hours
Bytes I/O: 3608.2 / 2692.6 (MB)
Keycache hit rate: 99.9999%
Threads connected: 40, running: 2 (5.0%)
Command profile:
admin_commands 3771823 (11.5%)
alter_table 6 ( 0.0%)
change_db 6750774 (20.6%)
check 11 ( 0.0%)
delete 45436 ( 0.1%)
flush 19 ( 0.0%)
insert 439441 ( 1.3%)
insert_select 7652 ( 0.0%)
lock_tables 58 ( 0.0%)
optimize 38 ( 0.0%)
repair 3 ( 0.0%)
replace 606630 ( 1.8%)
select 17203467 (52.5%)
show_databases 11 ( 0.0%)
show_fields 398 ( 0.0%)
show_keys 8 ( 0.0%)
show_processlist 1 ( 0.0%)
show_slave_hosts 6 ( 0.0%)
show_status 5485 ( 0.0%)
show_tables 13 ( 0.0%)
unlock_tables 58 ( 0.0%)
update 3963950 (12.1%)
Total commands processed: 32795288
Users:
ben 1 0 s
jaiba_slurp 1 0 s
loquo_bcn_user 4 26 s
loquo_madrid_user 1 4 s
princeorg 16 27 s
sessions 16 27 s
stage_bcn_user 1 5 s
Running requests:
ben/1440095: show processlist
You can download the script from http://www.homiez.com/mysqles
Neateo! I learn or find something new all the time around here. MyTop will be put to use.
Jeremy,
It's many years later and I'm still a fan of this tool. I'm not sure what others are using but this is simple and does the trick for me. I made a couple of changes so that it works with MySQL 5 -- use show global status when the version is 5 or greater. This resolves the issue with Cache hit data not showing up. If you are interested I'd be glad to send it over to you.
-Los
Jeremy,
First, thanks bunches for mytop – it’s been my monitoring friend for years.
I found that changing line 955 of mytop to this got rid of uninitialized value warnings from Perl. You may want to do something similar in all the places where it’s possible to do a regex replace on an undefined variable like this.
$host =~ s/^([^.]+).*/$1/ if defined $host;
The only change was to add the if defined $host part
To put it into context:
else
{
$thread->{Host} =~ s/^([^.]+).*/$1/;
}
## Otherwise, look up the IP (if resolve is set) and strip the
## name
if ($is_ip and $config{resolve})
{
$thread->{Host} =~ s/:\d+$//;
my $host = gethostbyaddr(inet_aton($thread->{Host}), AF_INET);
$host =~ s/^([^.]+).*/$1/ if defined $host;
$thread->{Host} = $host;
}
## Fix possible undefs
$thread->{db} ||= '';
$thread->{Info} ||= '';
$thread->{Time} ||= 0 ;
$thread->{Id} ||= 0 ;
$thread->{User} ||= '';
$thread->{Command} ||= '';
$thread->{Host} ||= '';
## Normalize spaces -- mostly disabled for now. This can
## break EXPLAIN if you try to explain a mangled query. It
FYI - I tried sending you a private email, but both the emails I used bounced.
Hi Los,
We'd love to get mytop to work on MySQL 5.
Any directions, or links appreciated.
Thanks,
-GB