debian/0000755000000000000000000000000012143463345007173 5ustar debian/watch0000644000000000000000000000007512143463076010227 0ustar version=3 http://www.mysqlfanboy.com/mytop/mytop-(.*).tar.gz debian/control0000644000000000000000000000122112143463076010573 0ustar Source: mytop Section: utils Priority: optional Maintainer: Werner Detter Build-Depends: debhelper (>= 7) Homepage: http://www.mysqlfanboy.com/mytop/ Standards-Version: 3.9.4 Package: mytop Architecture: all Depends: ${misc:Depends}, ${perl:Depends}, libdbi-perl, libdbd-mysql-perl, libterm-readkey-perl, libconfig-inifiles-perl Recommends: libtime-hires-perl Description: top like query monitor for MySQL Mytop is a console-based tool for monitoring queries and the performance of MySQL. It supports version 3.22.x, 3.23.x, 4.x and 5.x servers. It's written in Perl and support connections using TCP/IP and UNIX sockets. debian/rules0000755000000000000000000000176212143463076010262 0ustar #!/usr/bin/make -f # written by Werner Detter (C) 2010-2012, Mark Grennan License: GPL-2+ Files: debian/* Copyright: (C) 2002-2009, Philipp Matthias Hahn (C) 2013, Werner Detter License: GPL-2+ License: GPL-2+ 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; either version 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 file. debian/mytop.sample.conf0000644000000000000000000000154712143463076012502 0ustar # Copy this file to ~/.mytop and customize it to your own needs # Username to use when logging in to the MySQL server user=root # Password to use when logging in to the MySQL server pass= # Hostname of the MySQL server. host=localhost # Port number of the MySQL server. port=3306 # Connect to specific database by default. db=test # How long between display refreshes. delay=5 # Use direct socket instead of TCP/IP network to connect to the MySQL server. socket= # Run mytop only once and than exit. batchmode=0 # Display headers or not. header=1 # Use colors if available. color=1 # Display idle threads. idle=1 # Resolve IP addresses to names. resolve=1 # Compact large numbers for better readability, e.g. 10.000 -> 10.0k. long=0 # Reverse sort order from ascending to descending using Idle time. sort=0 # Use vt100 escape sequences to reduce screen flicker. vt100=0 debian/changelog0000644000000000000000000001102012143463345011037 0ustar mytop (1.9.1-1) unstable; urgency=low * New upstream release (Closes: #590505, #538164, #565759, #558100, #500078) * New Maintainer (Closes: #704450) * Updating standards version to 3.9.4 * Switch to dpkg-source 3.0 (quilt) format - Add debian/source/format * Checked and recreated patchs from old upstream against new version. Recreated necessary patches against new upstream version. - Add 01_fix_pod.patch - Add 02_remove_db_test.patch - Add 03_fix_newlines.patch - Add 04_fix_unitialized.patch - Add 05_prevent_ctrl_char_printing.patch - Add 06_fix_screenwidth.patch - Add 07_add_doc_on_missing_cli_options.patch - Add 08_add_mycnf.patch, contains now error handling (Closes: #627300, #694555) - Add 09_q_is_quit.patch * Add 10_fix_warnings.patch which fixes release detection and some perl warnings * Add 11_fix_url_manpage.patch which updates upstream url in manpage * Deleted README.Source * Update to debhelper 7 * debian/copyright revised for DEP5 specifications * Recreated debian/rules * Deleted debian/menu, debian/postrm, debian/postinst, debian/prerm * Renamed mytop.example to mytop.sample.conf -- Werner Detter Sat, 13 May 2013 17:41:05 +0100 mytop (1.6-6) unstable; urgency=low * Add patch from Tilman Koschnick handling ~/.my.cnf (Closes: #520421) * Widen ID (Closes: #517097) * Document --sort (Closes: #509464) * Fix line wrapping (Closes: #504501) * debian/control - Bump Standards-Version: 3.8.1 - Depends: +libconfig-inifiles-perl -- Philipp Matthias Hahn Mon, 06 Apr 2009 23:28:58 +0200 mytop (1.6-5) unstable; urgency=low * A newline should be replaced by a space, not just deleted (Closes: #502179) * debian/patches/q_is_quit.diff: 'q' quits mytop and does not change back to 't'hread mode. * debian/control - Bump Standards-Version: 3.8.0 - quilt patch management changes: debian/rules, debian/README.source -- Philipp Matthias Hahn Thu, 23 Oct 2008 22:47:58 +0200 mytop (1.6-4) unstable; urgency=low * FTBFS: rmdir: failed to remove `debian/tmp/usr/lib': No such file or directory (Closes: #479931) Thanks to Dmitry E. Oboukhov. -- Philipp Matthias Hahn Thu, 08 May 2008 06:59:20 +0200 mytop (1.6-3) unstable; urgency=low * Don't print control chars to the terminal (Closes: #477822) Based on path by "Dmitry E. Oboukhov". Thanks again. * Update 475140.flicker.diff from "Dmitry E. Oboukhov" -- Philipp Matthias Hahn Sun, 27 Apr 2008 23:39:31 +0200 mytop (1.6-2) unstable; urgency=low * Big thanks to "Dmitry E. Oboukhov" for his work. * debian/control: - Bumped Standards-Version to 3.7.3 - Add Homepage:-field - Build-Depends: quilt * debian/menu: Move to "Applications/Data Management" * debian/rules: - add Quilt support - fix clean and binary-arch targets * A newline should be replaced by a space, not just deleted (Closes: #434625) * Unknown database 'test', use '' instead (Closes: #424063) * Use of uninitialized value in substitution (s///) at /usr/bin/mytop line 958. (Closes: #455901) * apply patch for removing the terminal flicker (Closes: #475140) -- Philipp Matthias Hahn Fri, 25 Apr 2008 00:45:46 +0200 mytop (1.6-1) unstable; urgency=medium * New upstream version: Fixes use of blanks in password. * Fix case of 'H' for header. (closes: #334509) * Warn about passwords-on-commandline. (closes: #357150) * Give advice to use two dashes with long options. (closes: #411055) * Add 5.x servers to Description in debian/control. (closes: #348222) * Bumped Standards-Version to 3.7.2.2 - /usr/{lib,share}/menu transition. * Added debian/watch. -- Philipp Matthias Hahn Tue, 20 Feb 2007 18:21:29 +0100 mytop (1.4-1) unstable; urgency=low * New upstream version. * Bumped Standards-Version to 3.6.1.0. - Remove /usr/doc/mytop link. - Update menu-file. -- Philipp Matthias Hahn Thu, 29 Jul 2004 20:55:27 +0200 mytop (1.2-1) unstable; urgency=low * New upstream version. * Change email to d.o address. * Bumped Standards-Version to 3.5.7. - Build package in binary-indep target -- Philipp Matthias Hahn Tue, 12 Nov 2002 09:23:53 +0100 mytop (1.0-1) unstable; urgency=low * Initial release. (closes: #138066) * Minor cleanup. -- Philipp Matthias Hahn Sun, 14 Jul 2002 21:49:16 +0200 debian/source/0000755000000000000000000000000012143463076010474 5ustar debian/source/format0000644000000000000000000000001412143463076011702 0ustar 3.0 (quilt) debian/patches/0000755000000000000000000000000012143463205010615 5ustar debian/patches/06_fix_screenwidth.patch0000644000000000000000000000247712143463076015350 0ustar Description: Fix width Origin: old upstream version Author: Philipp Matthias Hahn --- a/mytop +++ b/mytop @@ -904,7 +904,7 @@ my $current_time = sprintf "[%02d:%02d:%02d]", $t[2], $t[1], $t[0]; - my $host_width = 75; + my $host_width = 80; my $up_width = $width - $host_width; Clear() unless $config{batchmode}; @@ -916,7 +916,7 @@ $lines_left--; - printf " Queries: %-6s qps: %4.0f Slow: %7s Se/In/Up/De(%%): %02.0f/%02.0f/%02.0f/%02.0f \n", + printf " Queries: %-7s qps: %4.0f Slow: %7s Se/In/Up/De(%%): %02.0f/%02.0f/%02.0f/%02.0f \n", make_short( $STATUS{Questions} ), # q total $STATUS{Questions} / $STATUS{Uptime}, # qps, average make_short( $STATUS{Slow_queries} ), # slow @@ -977,7 +977,7 @@ print RED() if ($Ratio < 50.0); print MAGENTA() if ($Ratio < 20.0); } - printf("%4.1f%% ",$Ratio); + printf("%4.1f%%$/",$Ratio); if ($HAS_COLOR) { print RESET(); @@ -1001,8 +1001,8 @@ { print RESET(); } + $lines_left--; } - $lines_left--; printf(" Key Efficiency: %2.1f%% Bps in/out: %5s/%5s ", debian/patches/09_q_is_quit.patch0000644000000000000000000000157712143463076014163 0ustar Description: 'q' quits mytop, and does not changes back to 't'hread mode. Origin: old upstream version Author: Philipp Matthias Hahn DEP: 3 --- a/mytop +++ b/mytop @@ -439,7 +439,7 @@ { $config{mode} = 'qps'; Clear() unless $config{batchmode}; - print "Queries Per Second [hit q to exit this mode]\n"; + print "Queries Per Second\n"; next; } @@ -449,8 +449,8 @@ { $config{mode} = 'cmd'; Clear() unless $config{batchmode}; - print "Command Summary [hit q to exit this mode]\n"; - next; + print "Command Summary\n"; + next; } ## C - change Color on and off @@ -599,7 +599,7 @@ { $config{mode} = 'innodb'; Clear() unless $config{batchmode}; - print "InnoDB Status [hit q to exit this mode]\n"; + print "InnoDB Status\n"; next; } debian/patches/10_fix_perl_warnings.patch0000644000000000000000000000241512143463076015666 0ustar Description: fixes perl warning and version detection Author: Werner Detter DEP: 3 --- a/mytop +++ b/mytop @@ -316,8 +316,13 @@ { if ($_->{Variable_name} eq "version") { + if($_->{Value} =~ m/-/) + { + my @tmp_db_version = split(/-/,$_->{Value}); + $_->{Value} = $tmp_db_version[0]; + } $db_version = $_->{Value}; - $db_release = int(sprintf("%d",$db_version)); + $db_release = int(substr($db_version, 0, 1)); next; } if ($_->{Variable_name} eq "have_query_cache") @@ -1028,7 +1033,7 @@ ) || 1) : 0; if ($HAS_COLOR) { - print GREEN() if ($Ratio_now => 80.0); + print GREEN() if ($Ratio_now >= 80.0); print YELLOW() if ($Ratio_now < 80.0); print RED() if ($Ratio_now < 50.0); print MAGENTA() if ($Ratio_now < 20.0); @@ -1062,8 +1067,13 @@ RESET() if ($HAS_COLOR); } - my($data) = Hashes('SHOW SLAVE STATUS'); - if (defined($data->{Master_Host})) + if(not defined $data) + { + my($data); + } + + $data = Hashes('SHOW SLAVE STATUS'); + if ($data != 0 and defined($data->{Master_Host})) { if (defined($data->{Seconds_Behind_Master})) { debian/patches/11_fix_url_manpage.patch0000644000000000000000000000060012143463163015276 0ustar Description: fix homepage url in manpage Author: Werner Detter DEP: 3 --- a/mytop +++ b/mytop @@ -1812,7 +1812,7 @@ =head1 AVAILABILITY The latest version of B is available from -http://jeremy.zawodny.com/mysql/mytop/ it B also be on CPAN as +http://www.mysqlfanboy.com/mytop/ it B also be on CPAN as well. =head1 REQUIREMENTS debian/patches/03_fix_newlines.patch0000644000000000000000000000221312143463076014636 0ustar Description: A newline should be replaced by a space, not just deleted (Closes:#434625, #502179) Origin: old upstream version Author: Philipp Matthias Hahn DEP: 3 --- a/mytop +++ b/mytop @@ -1143,18 +1143,16 @@ ## break EXPLAIN if you try to explain a mangled query. It ## may be re-enabled later as an option. - ## leading space removal - $thread->{Info} =~ s/^\s*//; - if (1) { - ## remove newlines and carriage returns - $thread->{Info} =~ s/[\n\r]//g; - - ## collpase whitespace - $thread->{Info} =~ s/\s+/ /g; + ## collapse newlines and carriage returns and whitespaces + $thread->{Info} =~ s/[\n\r\s]+/ /g; } + ## leading and trailing space removal + $thread->{Info} =~ s/^\s+//; + $thread->{Info} =~ s/\s+$//; + ## stow it in the cache $qcache{$thread->{Id}} = $thread->{Info}; @@ -1709,6 +1707,9 @@ sub Execute($) { my $sql = shift; + + $sql and $sql =~ s/\n/ /sg; + my $sth = $dbh->prepare($sql); if (not $sth) { ReadMode($RM_RESET); die $DBI::errstr; } debian/patches/01_fix_pod.patch0000644000000000000000000000744112143463076013602 0ustar Description: Some fixes within documentation, Advice about passwords-on-commandline Origin: old upstream version Author: Philipp Matthias Hahn DEP: 3 --- a/mytop +++ b/mytop @@ -1907,30 +1907,33 @@ =over -=item B<-u> or B<-user> username +=item B<-u> or B<--user> I -Username to use when logging in to the MySQL server. Default: ``root''. +Username to use when logging in to the MySQL server. Default: ``B''. -=item B<-p> or B<-pass> or B<-password> password +=item B<-p> or B<--pass> or B<--password> I Password to use when logging in to the MySQL server. Default: none. -=item B<-h> or B<--host> hostname[:port] +WARNING: This is insecure as the password is visible for anyone. +See B<--prompt> instead! + +=item B<-h> or B<--host> I[B<:>I] Hostname of the MySQL server. The hostname may be followed by an option port number. Note that the port is specified separate from the -host when using a config file. Default: ``localhost''. +host when using a config file. Default: ``B''. -=item B<--port> or B<-P> port +=item B<--port> or B<-P> I If you're running MySQL on a non-standard port, use this to specify -the port number. Default: 3306. +the port number. Default: B<3306>. -=item B<-s> or B<--delay> seconds +=item B<-s> or B<--delay> I -How long between display refreshes. Default: 5 +How long between display refreshes. Default: B<5> -=item B<-d> or B<--db> or B<--database> database +=item B<-d> or B<--db> or B<--database> I Use if you'd like B to connect to a specific database by default. Default: ``test''. @@ -1939,14 +1942,14 @@ In batch mode, mytop runs only once, does not clear the screen, and places no limit on the number of lines it will print. This is suitable -for running periodically (perhaps from cron) to capture the +for running periodically (perhaps from B) to capture the information into a file for later viewing. You might use batch mode in a CGI script to occasionally display your MySQL server status on the web. Default: unset. -=item B<-S> or B<--socket> /path/to/socket +=item B<-S> or B<--socket> I If you're running B on the same host as MySQL, you may wish to have it use the MySQL socket directly rather than a standard TCP/IP @@ -1961,7 +1964,7 @@ =item B<--header> or B<--noheader> -Sepcify if you want the header to display or not. You can toggle this +Specify if you want the header to display or not. You can toggle this with the B key while B is running. Default: header. @@ -1987,7 +1990,7 @@ Specify if you want to be prompted to type in your database password. This provides a little bit more security since it not only prevents the password from viewable in a process list, but also doesn't require -the password to be stored in plain text in your ~/.mytop config file. +the password to be stored in plain text in your C<~/.mytop> config file. You will B be prompted if a password has not been specified in your config file or through another command line option. @@ -2145,8 +2148,8 @@ The B key has a command-line counterpart: B<-s>. -The B key has two command-line counterparts: B<-header> and -B<-noheader>. +The B key has two command-line counterparts: B<--header> and +B<--noheader>. =head1 BUGS @@ -2300,12 +2303,12 @@ =item jon r. luini -Supplied a patch that formed the basis for C<-prompt> support. Sean +Supplied a patch that formed the basis for C<--prompt> support. Sean Leach submitted a similar patch. =item Yogish Baliga -Supplied a patch that formed the basis for C<-resolve> support. +Supplied a patch that formed the basis for C<--resolve> support. =item Per Andreas Buer debian/patches/05_prevent_ctrl_char_printing.patch0000644000000000000000000000075212143463076017572 0ustar Description: Don't print control chars to the terminal (Closes: #477822), Based on path by Dmitry E. Oboukhov Origin: old upstream version Author: Philipp Matthias Hahn DEP: 3 --- a/mytop +++ b/mytop @@ -1152,6 +1152,9 @@ { ## collapse newlines and carriage returns and whitespaces $thread->{Info} =~ s/[\n\r\s]+/ /g; + + # control symbols + $thread->{Info} =~ s/[[:cntrl:]]/?/g; } ## leading and trailing space removal debian/patches/08_add_mycnf.patch0000644000000000000000000000737112143463076014107 0ustar Description: Add Support for reading mytop config from standard ~/.my.cnf file. Origin: old upstream version Author: Philipp Matthias Hahn --- a/mytop +++ b/mytop @@ -15,6 +15,7 @@ use 5.005; use strict; use DBI; +use Config::IniFiles; use Getopt::Long; use DBD::mysql; use Socket; @@ -76,6 +77,7 @@ batchmode => 0, color => 1, db => '', + database => '', delay => 5, filter_user => qr/.?/, filter_db => qr/.?/, @@ -90,6 +92,7 @@ mode => 'top', prompt => 0, pass => '', + password => '', port => 3306, resolve => 0, slow => 10, # slow query time @@ -112,6 +115,37 @@ my $RM_RESET = 0; my $RM_NOBLKRD = 3; ## using 4 traps Ctrl-C :-( +## Try ~/.my.cnf first + +my $mycnf = "$ENV{HOME}/.my.cnf"; + +if (-e $mycnf) +{ + my $cfgini = new Config::IniFiles( -file => $mycnf ); + if ( not defined $cfgini ) + { + foreach my $error (@Config::IniFiles::errors) + { + print $error; + print "\n"; + } + exit; + } + + my @sections = ('client', 'mytop'); + + foreach my $section (@sections) { + foreach my $param ($cfgini->Parameters ($section)) + { + $config{$param} = $cfgini->val($section, $param) if exists $config{$param}; + } + } + ## map database/password onto db/pass (long version gets precedence in .my.cnf) + $config{'db'} = $config{'database'} if $config{'database'}; + $config{'pass'} = $config{'password'} if $config{'password'}; +} + + ## Read the user's config file, if it exists. my $config = "$ENV{HOME}/.mytop"; @@ -134,6 +168,9 @@ } close CFG; } + ## map database/password onto db/pass (short version gets precedence for historical reasons) + $config{'db'} = $config{'database'} unless $config{'db'}; + $config{'pass'} = $config{'password'} unless $config{'pass'}; } ## Command-line args. @@ -251,8 +288,8 @@ * port you specified "$config{port}" (default is 3306) * socket you specified "$config{socket}" (default is "") -The options my be specified on the command-line or in a ~/.mytop -config file. See the manual (perldoc mytop) for details. +The options my be specified on the command-line or in a ~/.mytop or +~/.my.cnf config file. See the manual (perldoc mytop) for details. Here's the exact error from DBI. It might help you debug: @@ -1774,6 +1811,7 @@ following: * Perl 5.005 or newer + * Config::IniFiles; * Getopt::Long * DBI and DBD::mysql * Term::ReadKey from CPAN @@ -2073,6 +2111,13 @@ You may have white space on either side of the C<=> in lines of the config file. +If present, mytop will also read mysql's default config file C<~/.my.cnf>. +Values from both the [client] and [mytop] section are read, in this order. +The long options I and I are preferred over the short +versions I and I to match mysql's syntax. +These settings take lowest precedence and will be overwritten by either +values in C<~/.mytop> or command-line options. + =head2 Shortcut Keys The following keys perform various actions while B is @@ -2212,9 +2257,6 @@ may appear odd. I have no good idea as to how best to deal with that yet. Suggestions are welcome. -It'd be nice if you could just add B configuration directives -in your C file instead of having a separate config file. - You should be able to specify the columns you'd like to see in the display and the order in which they appear. If you only have one username that connects to your database, it's probably not worth debian/patches/series0000644000000000000000000000042712143463205012035 0ustar 01_fix_pod.patch 02_remove_db_test.patch 03_fix_newlines.patch 04_fix_unitialized.patch 05_prevent_ctrl_char_printing.patch 06_fix_screenwidth.patch 07_add_doc_on_missing_cli_options.patch 08_add_mycnf.patch 09_q_is_quit.patch 10_fix_perl_warnings.patch 11_fix_url_manpage.patch debian/patches/07_add_doc_on_missing_cli_options.patch0000644000000000000000000000155212143463076020361 0ustar Description: Add documentation os missing command line options. Document need for --sort when using --idle to get same sort order as when pressing 'i' during runtime. Origin: old upstream version Author: Philipp Matthias Hahn --- a/mytop +++ b/mytop @@ -2013,6 +2013,27 @@ Default: noresolve +=item B<--long> or B<--nolong> + +For large numbers print all digits (e.g. 10.000) instead of using a more +compact approximation (e.g. 10.0k). + +Default: nolong. + +=item B<-m> or B<--mode> I + +Specify initial mode B(queries/second), B(overview), +B(command summary), B(InnoDB status) or B(). + +Default: B + +=item B<--sort> or B<--nosort> + +Reverse sort order from ascending to descending using Idle time. + +Default: nosort. + + =back Command-line arguments will always take precedence over config file debian/patches/04_fix_unitialized.patch0000644000000000000000000000101112143463076015327 0ustar Description: Use of uninitialized value in substitution (s///) at /usr/bin/mytop, (Closes: #455901) Origin: old upstream version Author: Philipp Matthias Hahn DEP: 3 --- a/mytop +++ b/mytop @@ -1121,6 +1121,11 @@ # my $host = $thread->{Host}; my $host = gethostbyaddr(inet_aton($thread->{Host}), AF_INET); # $host =~ s/^([^.]+).*/$1/; + if ($host) + { + $host =~ s/^([^.]+).*/$1/; + $thread->{Host} = $host; + } $thread->{Host} = $host; } debian/patches/02_remove_db_test.patch0000644000000000000000000000204612143463076015150 0ustar Description: Unknown database 'test', use '' instead (Closes: #424063) Origin: old upstream version Author: Philipp Matthias Hahn DEP: 3 --- a/mytop +++ b/mytop @@ -75,7 +75,7 @@ my %config = ( batchmode => 0, color => 1, - db => 'test', + db => '', delay => 5, filter_user => qr/.?/, filter_db => qr/.?/, @@ -244,7 +244,7 @@ my $Error = < or B<--db> or B<--database> I Use if you'd like B to connect to a specific database by -default. Default: ``test''. +default. Default: none. =item B<-b> or B<--batch> or B<--batchmode>