| 1 |
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) |
| 2 |
.\" |
| 3 |
.\" Standard preamble: |
| 4 |
.\" ======================================================================== |
| 5 |
.de Sp \" Vertical space (when we can't use .PP) |
| 6 |
.if t .sp .5v |
| 7 |
.if n .sp |
| 8 |
.. |
| 9 |
.de Vb \" Begin verbatim text |
| 10 |
.ft CW |
| 11 |
.nf |
| 12 |
.ne \\$1 |
| 13 |
.. |
| 14 |
.de Ve \" End verbatim text |
| 15 |
.ft R |
| 16 |
.fi |
| 17 |
.. |
| 18 |
.\" Set up some character translations and predefined strings. \*(-- will |
| 19 |
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
| 20 |
.\" double quote, and \*(R" will give a right double quote. \*(C+ will |
| 21 |
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and |
| 22 |
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, |
| 23 |
.\" nothing in troff, for use with C<>. |
| 24 |
.tr \(*W- |
| 25 |
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
| 26 |
.ie n \{\ |
| 27 |
. ds -- \(*W- |
| 28 |
. ds PI pi |
| 29 |
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
| 30 |
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
| 31 |
. ds L" "" |
| 32 |
. ds R" "" |
| 33 |
. ds C` "" |
| 34 |
. ds C' "" |
| 35 |
'br\} |
| 36 |
.el\{\ |
| 37 |
. ds -- \|\(em\| |
| 38 |
. ds PI \(*p |
| 39 |
. ds L" `` |
| 40 |
. ds R" '' |
| 41 |
. ds C` |
| 42 |
. ds C' |
| 43 |
'br\} |
| 44 |
.\" |
| 45 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 46 |
.ie \n(.g .ds Aq \(aq |
| 47 |
.el .ds Aq ' |
| 48 |
.\" |
| 49 |
.\" If the F register is turned on, we'll generate index entries on stderr for |
| 50 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 51 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 52 |
.\" output yourself in some meaningful fashion. |
| 53 |
.\" |
| 54 |
.\" Avoid warning from groff about undefined register 'F'. |
| 55 |
.de IX |
| 56 |
.. |
| 57 |
.nr rF 0 |
| 58 |
.if \n(.g .if rF .nr rF 1 |
| 59 |
.if (\n(rF:(\n(.g==0)) \{ |
| 60 |
. if \nF \{ |
| 61 |
. de IX |
| 62 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 63 |
.. |
| 64 |
. if !\nF==2 \{ |
| 65 |
. nr % 0 |
| 66 |
. nr F 2 |
| 67 |
. \} |
| 68 |
. \} |
| 69 |
.\} |
| 70 |
.rr rF |
| 71 |
.\" |
| 72 |
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
| 73 |
.\" Fear. Run. Save yourself. No user-serviceable parts. |
| 74 |
. \" fudge factors for nroff and troff |
| 75 |
.if n \{\ |
| 76 |
. ds #H 0 |
| 77 |
. ds #V .8m |
| 78 |
. ds #F .3m |
| 79 |
. ds #[ \f1 |
| 80 |
. ds #] \fP |
| 81 |
.\} |
| 82 |
.if t \{\ |
| 83 |
. ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
| 84 |
. ds #V .6m |
| 85 |
. ds #F 0 |
| 86 |
. ds #[ \& |
| 87 |
. ds #] \& |
| 88 |
.\} |
| 89 |
. \" simple accents for nroff and troff |
| 90 |
.if n \{\ |
| 91 |
. ds ' \& |
| 92 |
. ds ` \& |
| 93 |
. ds ^ \& |
| 94 |
. ds , \& |
| 95 |
. ds ~ ~ |
| 96 |
. ds / |
| 97 |
.\} |
| 98 |
.if t \{\ |
| 99 |
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
| 100 |
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
| 101 |
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
| 102 |
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
| 103 |
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
| 104 |
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
| 105 |
.\} |
| 106 |
. \" troff and (daisy-wheel) nroff accents |
| 107 |
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
| 108 |
.ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
| 109 |
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
| 110 |
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
| 111 |
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
| 112 |
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
| 113 |
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
| 114 |
.ds ae a\h'-(\w'a'u*4/10)'e |
| 115 |
.ds Ae A\h'-(\w'A'u*4/10)'E |
| 116 |
. \" corrections for vroff |
| 117 |
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
| 118 |
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
| 119 |
. \" for low resolution devices (crt and lpr) |
| 120 |
.if \n(.H>23 .if \n(.V>19 \ |
| 121 |
\{\ |
| 122 |
. ds : e |
| 123 |
. ds 8 ss |
| 124 |
. ds o a |
| 125 |
. ds d- d\h'-1'\(ga |
| 126 |
. ds D- D\h'-1'\(hy |
| 127 |
. ds th \o'bp' |
| 128 |
. ds Th \o'LP' |
| 129 |
. ds ae ae |
| 130 |
. ds Ae AE |
| 131 |
.\} |
| 132 |
.rm #[ #] #H #V #F C |
| 133 |
.\" ======================================================================== |
| 134 |
.\" |
| 135 |
.IX Title "INNOTOP 1" |
| 136 |
.TH INNOTOP 1 "2017-01-23" "perl v5.20.2" "User Contributed Perl Documentation" |
| 137 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 138 |
.\" way too many mistakes in technical documents. |
| 139 |
.if n .ad l |
| 140 |
.nh |
| 141 |
.SH "NAME" |
| 142 |
innotop \- MySQL and InnoDB transaction/status monitor. |
| 143 |
.SH "SYNOPSIS" |
| 144 |
.IX Header "SYNOPSIS" |
| 145 |
To monitor servers normally: |
| 146 |
.PP |
| 147 |
.Vb 1 |
| 148 |
\& innotop |
| 149 |
.Ve |
| 150 |
.PP |
| 151 |
To monitor InnoDB status information from a file: |
| 152 |
.PP |
| 153 |
.Vb 1 |
| 154 |
\& innotop /var/log/mysql/mysqld.err |
| 155 |
.Ve |
| 156 |
.PP |
| 157 |
To run innotop non-interactively in a pipe-and-filter configuration: |
| 158 |
.PP |
| 159 |
.Vb 1 |
| 160 |
\& innotop \-\-count 5 \-d 1 \-n |
| 161 |
.Ve |
| 162 |
.PP |
| 163 |
To monitor a database on another system using a particular username and password: |
| 164 |
.PP |
| 165 |
.Vb 1 |
| 166 |
\& innotop \-u <username> \-p <password> \-h <hostname> |
| 167 |
.Ve |
| 168 |
.SH "DESCRIPTION" |
| 169 |
.IX Header "DESCRIPTION" |
| 170 |
innotop monitors MySQL servers. Each of its modes shows you a different aspect |
| 171 |
of what's happening in the server. For example, there's a mode for monitoring |
| 172 |
replication, one for queries, and one for transactions. innotop refreshes its |
| 173 |
data periodically, so you see an updating view. |
| 174 |
.PP |
| 175 |
innotop has lots of features for power users, but you can start and run it with |
| 176 |
virtually no configuration. If you're just getting started, see |
| 177 |
\&\*(L"QUICK-START\*(R". Press '?' at any time while running innotop for |
| 178 |
context-sensitive help. |
| 179 |
.SH "QUICK-START" |
| 180 |
.IX Header "QUICK-START" |
| 181 |
To start innotop, open a terminal or command prompt. If you have installed |
| 182 |
innotop on your system, you should be able to just type \*(L"innotop\*(R" and press |
| 183 |
Enter; otherwise, you will need to change to innotop's directory and type \*(L"perl |
| 184 |
innotop\*(R". |
| 185 |
.PP |
| 186 |
With no options specified, innotop will attempt to connect to a MySQL server on |
| 187 |
localhost using mariadb_read_default_group=client for other connection |
| 188 |
parameters. If you need to specify a different username and password, use the |
| 189 |
\&\-u and \-p options, respectively. To monitor a MySQL database on another |
| 190 |
host, use the \-h option. |
| 191 |
.PP |
| 192 |
After you've connected, innotop should show you something like the following: |
| 193 |
.PP |
| 194 |
.Vb 1 |
| 195 |
\& [RO] Query List (? for help) localhost, 01:11:19, 449.44 QPS, 14/7/163 con/run |
| 196 |
\& |
| 197 |
\& CXN When Load QPS Slow QCacheHit KCacheHit BpsIn BpsOut |
| 198 |
\& localhost Total 0.00 1.07k 697 0.00% 98.17% 476.83k 242.83k |
| 199 |
\& |
| 200 |
\& CXN Cmd ID User Host DB Time Query |
| 201 |
\& localhost Query 766446598 test 10.0.0.1 foo 00:02 INSERT INTO table ( |
| 202 |
.Ve |
| 203 |
.PP |
| 204 |
(This sample is truncated at the right so it will fit on a terminal when running |
| 205 |
\&'man innotop') |
| 206 |
.PP |
| 207 |
If your server is busy, you'll see more output. Notice the first line on the |
| 208 |
screen, which tells you that readonly is set to true ([\s-1RO\s0]), what mode you're |
| 209 |
in and what server you're connected to. You can change to other modes with |
| 210 |
keystrokes; press 'T' to switch to a list of InnoDB transactions, for example. |
| 211 |
.PP |
| 212 |
Press the '?' key to see what keys are active in the current mode. You can |
| 213 |
press any of these keys and innotop will either take the requested action or |
| 214 |
prompt you for more input. If your system has Term::ReadLine support, you can |
| 215 |
use \s-1TAB\s0 and other keys to auto-complete and edit input. |
| 216 |
.PP |
| 217 |
To quit innotop, press the 'q' key. |
| 218 |
.SH "OPTIONS" |
| 219 |
.IX Header "OPTIONS" |
| 220 |
innotop is mostly configured via its configuration file, but some of the |
| 221 |
configuration options can come from the command line. You can also specify a |
| 222 |
file to monitor for InnoDB status output; see \*(L"\s-1MONITORING A FILE\*(R"\s0 for more |
| 223 |
details. |
| 224 |
.PP |
| 225 |
You can negate some options by prefixing the option name with \-\-no. For |
| 226 |
example, \-\-noinc (or \-\-no\-inc) negates \*(L"\-\-inc\*(R". |
| 227 |
.IP "\-\-color" 4 |
| 228 |
.IX Item "--color" |
| 229 |
Enable or disable terminal coloring. Corresponds to the \*(L"color\*(R" config file |
| 230 |
setting. |
| 231 |
.IP "\-\-config" 4 |
| 232 |
.IX Item "--config" |
| 233 |
Specifies a configuration file to read. This option is non-sticky, that is to |
| 234 |
say it does not persist to the configuration file itself. |
| 235 |
.IP "\-\-count" 4 |
| 236 |
.IX Item "--count" |
| 237 |
Refresh only the specified number of times (ticks) before exiting. Each refresh |
| 238 |
is a pause for \*(L"interval\*(R" seconds, followed by requesting data from MySQL |
| 239 |
connections and printing it to the terminal. |
| 240 |
.IP "\-\-delay" 4 |
| 241 |
.IX Item "--delay" |
| 242 |
Specifies the amount of time to pause between ticks (refreshes). Corresponds to |
| 243 |
the configuration option \*(L"interval\*(R". |
| 244 |
.IP "\-\-help" 4 |
| 245 |
.IX Item "--help" |
| 246 |
Print a summary of command-line usage and exit. |
| 247 |
.IP "\-\-host" 4 |
| 248 |
.IX Item "--host" |
| 249 |
Host to connect to. |
| 250 |
.IP "\-\-inc" 4 |
| 251 |
.IX Item "--inc" |
| 252 |
Specifies whether innotop should display absolute numbers or relative numbers |
| 253 |
(offsets from their previous values). Corresponds to the configuration option |
| 254 |
\&\*(L"status_inc\*(R". |
| 255 |
.IP "\-\-mode" 4 |
| 256 |
.IX Item "--mode" |
| 257 |
Specifies the mode in which innotop should start. Corresponds to the |
| 258 |
configuration option \*(L"mode\*(R". |
| 259 |
.IP "\-\-nonint" 4 |
| 260 |
.IX Item "--nonint" |
| 261 |
Enable non-interactive operation. See \*(L"NON-INTERACTIVE \s-1OPERATION\*(R"\s0 for more. |
| 262 |
.IP "\-\-password" 4 |
| 263 |
.IX Item "--password" |
| 264 |
Password to use for connection. |
| 265 |
.IP "\-\-port" 4 |
| 266 |
.IX Item "--port" |
| 267 |
Port to use for connection. |
| 268 |
.IP "\-\-skipcentral" 4 |
| 269 |
.IX Item "--skipcentral" |
| 270 |
Don't read the central configuration file. |
| 271 |
.IP "\-\-timestamp" 4 |
| 272 |
.IX Item "--timestamp" |
| 273 |
In \-n mode, write a timestamp either before every screenful of output, or if |
| 274 |
the option is given twice, at the start of every line. The format is controlled |
| 275 |
by the timeformat config variable. |
| 276 |
.IP "\-\-user" 4 |
| 277 |
.IX Item "--user" |
| 278 |
User to use for connection. |
| 279 |
.IP "\-\-version" 4 |
| 280 |
.IX Item "--version" |
| 281 |
Output version information and exit. |
| 282 |
.IP "\-\-write" 4 |
| 283 |
.IX Item "--write" |
| 284 |
Sets the configuration option \*(L"readonly\*(R" to 0, making innotop write the |
| 285 |
running configuration to ~/.innotop/innotop.conf on exit, if no configuration |
| 286 |
file was loaded at start-up. |
| 287 |
.SH "HOTKEYS" |
| 288 |
.IX Header "HOTKEYS" |
| 289 |
innotop is interactive, and you control it with key-presses. |
| 290 |
.IP "\(bu" 4 |
| 291 |
Uppercase keys switch between modes. |
| 292 |
.IP "\(bu" 4 |
| 293 |
Lowercase keys initiate some action within the current mode. |
| 294 |
.IP "\(bu" 4 |
| 295 |
Other keys do something special like change configuration or show the |
| 296 |
innotop license. |
| 297 |
.PP |
| 298 |
Press '?' at any time to see the currently active keys and what they do. |
| 299 |
.SH "MODES" |
| 300 |
.IX Header "MODES" |
| 301 |
Each of innotop's modes retrieves and displays a particular type of data from |
| 302 |
the servers you're monitoring. You switch between modes with uppercase keys. |
| 303 |
The following is a brief description of each mode, in alphabetical order. To |
| 304 |
switch to the mode, press the key listed in front of its heading in the |
| 305 |
following list: |
| 306 |
.IP "A: Health Dashboard" 4 |
| 307 |
.IX Item "A: Health Dashboard" |
| 308 |
This mode displays a single table with one row per monitored server. The |
| 309 |
columns show essential overview information about the server's health, and |
| 310 |
coloration rules show whether replication is running or if there are any very |
| 311 |
long-running queries or excessive replication delay. |
| 312 |
.IP "B: InnoDB Buffers" 4 |
| 313 |
.IX Item "B: InnoDB Buffers" |
| 314 |
This mode displays information about the InnoDB buffer pool, page statistics, |
| 315 |
insert buffer, and adaptive hash index. The data comes from \s-1SHOW INNODB STATUS.\s0 |
| 316 |
.Sp |
| 317 |
This mode contains the \*(L"buffer_pool\*(R", \*(L"page_statistics\*(R", |
| 318 |
\&\*(L"insert_buffers\*(R", and \*(L"adaptive_hash_index\*(R" tables by default. |
| 319 |
.IP "C: Command Summary" 4 |
| 320 |
.IX Item "C: Command Summary" |
| 321 |
This mode is similar to mytop's Command Summary mode. It shows the |
| 322 |
\&\*(L"cmd_summary\*(R" table, which looks something like the following: |
| 323 |
.Sp |
| 324 |
.Vb 8 |
| 325 |
\& Command Summary (? for help) localhost, 25+07:16:43, 2.45 QPS, 3 thd, 5.0.40 |
| 326 |
\& _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ Command Summary _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ |
| 327 |
\& Name Value Pct Last Incr Pct |
| 328 |
\& Select_scan 3244858 69.89% 2 100.00% |
| 329 |
\& Select_range 1354177 29.17% 0 0.00% |
| 330 |
\& Select_full_join 39479 0.85% 0 0.00% |
| 331 |
\& Select_full_range_join 4097 0.09% 0 0.00% |
| 332 |
\& Select_range_check 0 0.00% 0 0.00% |
| 333 |
.Ve |
| 334 |
.Sp |
| 335 |
The command summary table is built by extracting variables from |
| 336 |
\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. The variables must be numeric and must match the prefix |
| 337 |
given by the \*(L"cmd_filter\*(R" configuration variable. The variables are then |
| 338 |
sorted by value descending and compared to the last variable, as shown above. |
| 339 |
The percentage columns are percentage of the total of all variables in the |
| 340 |
table, so you can see the relative weight of the variables. |
| 341 |
.Sp |
| 342 |
The example shows what you see if the prefix is \*(L"Select_\*(R". The default |
| 343 |
prefix is \*(L"Com_\*(R". You can choose a prefix with the 's' key. |
| 344 |
.Sp |
| 345 |
It's rather like running \s-1SHOW VARIABLES LIKE \s0\*(L"prefix%\*(R" with memory and |
| 346 |
nice formatting. |
| 347 |
.Sp |
| 348 |
Values are aggregated across all servers. The Pct columns are not correctly |
| 349 |
aggregated across multiple servers. This is a known limitation of the grouping |
| 350 |
algorithm that may be fixed in the future. |
| 351 |
.IP "D: InnoDB Deadlocks" 4 |
| 352 |
.IX Item "D: InnoDB Deadlocks" |
| 353 |
This mode shows the transactions involved in the last InnoDB deadlock. A second |
| 354 |
table shows the locks each transaction held and waited for. A deadlock is |
| 355 |
caused by a cycle in the waits-for graph, so there should be two locks held and |
| 356 |
one waited for unless the deadlock information is truncated. |
| 357 |
.Sp |
| 358 |
InnoDB puts deadlock information before some other information in the \s-1SHOW |
| 359 |
INNODB STATUS\s0 output. If there are a lot of locks, the deadlock information can |
| 360 |
grow very large, and there is a limit on the size of the \s-1SHOW INNODB |
| 361 |
STATUS\s0 output. A large deadlock can fill the entire output, or even be |
| 362 |
truncated, and prevent you from seeing other information at all. If you are |
| 363 |
running innotop in another mode, for example T mode, and suddenly you don't see |
| 364 |
anything, you might want to check and see if a deadlock has wiped out the data |
| 365 |
you need. |
| 366 |
.Sp |
| 367 |
If it has, you can create a small deadlock to replace the large one. Use the |
| 368 |
\&'w' key to 'wipe' the large deadlock with a small one. This will not work |
| 369 |
unless you have defined a deadlock table for the connection (see \*(L"\s-1SERVER |
| 370 |
CONNECTIONS\*(R"\s0). |
| 371 |
.Sp |
| 372 |
You can also configure innotop to automatically detect when a large deadlock |
| 373 |
needs to be replaced with a small one (see \*(L"auto_wipe_dl\*(R"). |
| 374 |
.Sp |
| 375 |
This mode displays the \*(L"deadlock_transactions\*(R" and \*(L"deadlock_locks\*(R" tables |
| 376 |
by default. |
| 377 |
.IP "F: InnoDB Foreign Key Errors" 4 |
| 378 |
.IX Item "F: InnoDB Foreign Key Errors" |
| 379 |
This mode shows the last InnoDB foreign key error information, such as the |
| 380 |
table where it happened, when and who and what query caused it, and so on. |
| 381 |
.Sp |
| 382 |
InnoDB has a huge variety of foreign key error messages, and many of them are |
| 383 |
just hard to parse. innotop doesn't always do the best job here, but there's |
| 384 |
so much code devoted to parsing this messy, unparsable output that innotop is |
| 385 |
likely never to be perfect in this regard. If innotop doesn't show you what |
| 386 |
you need to see, just look at the status text directly. |
| 387 |
.Sp |
| 388 |
This mode displays the \*(L"fk_error\*(R" table by default. |
| 389 |
.IP "I: InnoDB I/O Info" 4 |
| 390 |
.IX Item "I: InnoDB I/O Info" |
| 391 |
This mode shows InnoDB's I/O statistics, including the I/O threads, pending I/O, |
| 392 |
file I/O miscellaneous, and log statistics. It displays the \*(L"io_threads\*(R", |
| 393 |
\&\*(L"pending_io\*(R", \*(L"file_io_misc\*(R", and \*(L"log_statistics\*(R" tables by default. |
| 394 |
.IP "K: InnoDB Lock Waits" 4 |
| 395 |
.IX Item "K: InnoDB Lock Waits" |
| 396 |
This mode shows information from InnoDB plugin's transaction and locking tables. |
| 397 |
You can use it to find when a transaction is waiting for another, and kill the |
| 398 |
blocking transaction. It displays the "innodb_blocked_blocker" table. |
| 399 |
.IP "L: Locks" 4 |
| 400 |
.IX Item "L: Locks" |
| 401 |
This mode shows information about current locks. At the moment only InnoDB |
| 402 |
locks are supported, and by default you'll only see locks for which transactions |
| 403 |
are waiting. This information comes from the \s-1TRANSACTIONS\s0 section of the InnoDB |
| 404 |
status text. If you have a very busy server, you may have frequent lock waits; |
| 405 |
it helps to be able to see which tables and indexes are the \*(L"hot spot\*(R" for |
| 406 |
locks. If your server is running pretty well, this mode should show nothing. |
| 407 |
.Sp |
| 408 |
You can configure MySQL and innotop to monitor not only locks for which a |
| 409 |
transaction is waiting, but those currently held, too. You can do this with the |
| 410 |
InnoDB Lock Monitor (<http://dev.mysql.com/doc/en/innodb\-monitor.html>). It's |
| 411 |
not documented in the MySQL manual, but creating the lock monitor with the |
| 412 |
following statement also affects the output of \s-1SHOW INNODB STATUS,\s0 which innotop |
| 413 |
uses: |
| 414 |
.Sp |
| 415 |
.Vb 1 |
| 416 |
\& CREATE TABLE innodb_lock_monitor(a int) ENGINE=INNODB; |
| 417 |
.Ve |
| 418 |
.Sp |
| 419 |
This causes InnoDB to print its output to the MySQL file every 16 seconds or so, |
| 420 |
as stated in the manual, but it also makes the normal \s-1SHOW INNODB STATUS\s0 output |
| 421 |
include lock information, which innotop can parse and display (that's the |
| 422 |
undocumented feature). |
| 423 |
.Sp |
| 424 |
This means you can do what may have seemed impossible: to a limited extent |
| 425 |
(InnoDB truncates some information in the output), you can see which transaction |
| 426 |
holds the locks something else is waiting for. You can also enable and disable |
| 427 |
the InnoDB Lock Monitor with the key mappings in this mode. |
| 428 |
.Sp |
| 429 |
This mode displays the \*(L"innodb_locks\*(R" table by default. Here's a sample of |
| 430 |
the screen when one connection is waiting for locks another connection holds: |
| 431 |
.Sp |
| 432 |
.Vb 7 |
| 433 |
\& _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ InnoDB Locks _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ |
| 434 |
\& CXN ID Type Waiting Wait Active Mode DB Table Index |
| 435 |
\& localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY |
| 436 |
\& localhost 12 TABLE 0 00:10 00:10 IX test t1 |
| 437 |
\& localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY |
| 438 |
\& localhost 11 TABLE 0 00:00 00:25 IX test t1 |
| 439 |
\& localhost 11 RECORD 0 00:00 00:25 X test t1 PRIMARY |
| 440 |
.Ve |
| 441 |
.Sp |
| 442 |
You can see the first connection, \s-1ID 12,\s0 is waiting for a lock on the \s-1PRIMARY\s0 |
| 443 |
key on test.t1, and has been waiting for 10 seconds. The second connection |
| 444 |
isn't waiting, because the Waiting column is 0, but it holds locks on the same |
| 445 |
index. That tells you connection 11 is blocking connection 12. |
| 446 |
.IP "M: Master/Slave Replication Status" 4 |
| 447 |
.IX Item "M: Master/Slave Replication Status" |
| 448 |
This mode shows the output of \s-1SHOW SLAVE STATUS\s0 and \s-1SHOW MASTER STATUS\s0 in three |
| 449 |
tables. The first two divide the slave's status into \s-1SQL\s0 and I/O thread status, |
| 450 |
and the last shows master status. Filters are applied to eliminate non-slave |
| 451 |
servers from the slave tables, and non-master servers from the master table. |
| 452 |
.Sp |
| 453 |
This mode displays the \*(L"slave_sql_status\*(R", \*(L"slave_io_status\*(R", and |
| 454 |
\&\*(L"master_status\*(R" tables by default. |
| 455 |
.IP "O: Open Tables" 4 |
| 456 |
.IX Item "O: Open Tables" |
| 457 |
This section comes from MySQL's \s-1SHOW OPEN TABLES\s0 command. By default it is |
| 458 |
filtered to show tables which are in use by one or more queries, so you can |
| 459 |
get a quick look at which tables are 'hot'. You can use this to guess which |
| 460 |
tables might be locked implicitly. |
| 461 |
.Sp |
| 462 |
This mode displays the \*(L"open_tables\*(R" mode by default. |
| 463 |
.IP "U: User Statistics" 4 |
| 464 |
.IX Item "U: User Statistics" |
| 465 |
This mode displays data that's available in Percona's enhanced version of MySQL |
| 466 |
(also known as Percona Server with XtraDB). Specifically, it makes it easy to |
| 467 |
enable and disable the so-called \*(L"user statistics.\*(R" This feature gathers stats |
| 468 |
on clients, threads, users, tables, and indexes and makes them available as |
| 469 |
\&\s-1INFORMATION_SCHEMA\s0 tables. These are invaluable for understanding what your |
| 470 |
server is doing. They are also available in MariaDB. |
| 471 |
.Sp |
| 472 |
The statistics supported so far are only from the \s-1TABLE_STATISTICS\s0 and |
| 473 |
\&\s-1INDEX_STATISTICS\s0 tables added by Percona. There are three views: one of table stats, |
| 474 |
one of index stats (which can be aggregated with the = key), and one of both. |
| 475 |
.Sp |
| 476 |
The server doesn't gather these stats by default. You have to set the variable |
| 477 |
userstat_running to turn it on. You can do this easily with innotop from U mode, |
| 478 |
with the 's' key. |
| 479 |
.IP "Q: Query List" 4 |
| 480 |
.IX Item "Q: Query List" |
| 481 |
This mode displays the output from \s-1SHOW FULL PROCESSLIST,\s0 much like \fBmytop\fR's |
| 482 |
query list mode. This mode does \fBnot\fR show InnoDB-related information. This |
| 483 |
is probably one of the most useful modes for general usage. |
| 484 |
.Sp |
| 485 |
There is an informative header that shows general status information about |
| 486 |
your server. You can toggle it on and off with the 'h' key. By default, |
| 487 |
innotop hides inactive processes and its own process. You can toggle these on |
| 488 |
and off with the 'i' and 'a' keys. |
| 489 |
.Sp |
| 490 |
You can \s-1EXPLAIN\s0 a query from this mode with the 'e' key. This displays the |
| 491 |
query's full text, the results of \s-1EXPLAIN,\s0 and in newer MySQL versions, even |
| 492 |
the optimized query resulting from \s-1EXPLAIN EXTENDED. \s0 innotop also tries to |
| 493 |
rewrite certain queries to make them EXPLAIN-able. For example, \s-1INSERT/SELECT\s0 |
| 494 |
statements are rewritable. |
| 495 |
.Sp |
| 496 |
This mode displays the \*(L"q_header\*(R" and \*(L"processlist\*(R" tables by default. |
| 497 |
.IP "R: InnoDB Row Operations and Semaphores" 4 |
| 498 |
.IX Item "R: InnoDB Row Operations and Semaphores" |
| 499 |
This mode shows InnoDB row operations, row operation miscellaneous, semaphores, |
| 500 |
and information from the wait array. It displays the \*(L"row_operations\*(R", |
| 501 |
\&\*(L"row_operation_misc\*(R", \*(L"semaphores\*(R", and \*(L"wait_array\*(R" tables by default. |
| 502 |
.IP "S: Variables & Status" 4 |
| 503 |
.IX Item "S: Variables & Status" |
| 504 |
This mode calculates statistics, such as queries per second, and prints them out |
| 505 |
in several different styles. You can show absolute values, or incremental values |
| 506 |
between ticks. |
| 507 |
.Sp |
| 508 |
You can switch between the views by pressing a key. The 's' key prints a |
| 509 |
single line each time the screen updates, in the style of \fBvmstat\fR. The 'g' |
| 510 |
key changes the view to a graph of the same numbers, sort of like \fBtload\fR. |
| 511 |
The 'v' key changes the view to a pivoted table of variable names on the left, |
| 512 |
with successive updates scrolling across the screen from left to right. You can |
| 513 |
choose how many updates to put on the screen with the \*(L"num_status_sets\*(R" |
| 514 |
configuration variable. |
| 515 |
.Sp |
| 516 |
Headers may be abbreviated to fit on the screen in interactive operation. You |
| 517 |
choose which variables to display with the 'c' key, which selects from |
| 518 |
predefined sets, or lets you create your own sets. You can edit the current set |
| 519 |
with the 'e' key. |
| 520 |
.Sp |
| 521 |
This mode doesn't really display any tables like other modes. Instead, it uses |
| 522 |
a table definition to extract and format the data, but it then transforms the |
| 523 |
result in special ways before outputting it. It uses the \*(L"var_status\*(R" table |
| 524 |
definition for this. |
| 525 |
.IP "T: InnoDB Transactions" 4 |
| 526 |
.IX Item "T: InnoDB Transactions" |
| 527 |
This mode shows transactions from the InnoDB monitor's output, in \fBtop\fR\-like |
| 528 |
format. This mode is the reason I wrote innotop. |
| 529 |
.Sp |
| 530 |
You can kill queries or processes with the 'k' and 'x' keys, and \s-1EXPLAIN\s0 a query |
| 531 |
with the 'e' or 'f' keys. InnoDB doesn't print the full query in transactions, |
| 532 |
so explaining may not work right if the query is truncated. |
| 533 |
.Sp |
| 534 |
The informational header can be toggled on and off with the 'h' key. By |
| 535 |
default, innotop hides inactive transactions and its own transaction. You can |
| 536 |
toggle this on and off with the 'i' and 'a' keys. |
| 537 |
.Sp |
| 538 |
This mode displays the \*(L"t_header\*(R" and \*(L"innodb_transactions\*(R" tables by |
| 539 |
default. |
| 540 |
.SH "INNOTOP STATUS" |
| 541 |
.IX Header "INNOTOP STATUS" |
| 542 |
The first line innotop displays is a \*(L"status bar\*(R" of sorts. What it contains |
| 543 |
depends on the mode you're in, and what servers you're monitoring. The first |
| 544 |
few words are always [\s-1RO\s0] (if readonly is set to 1), the innotop mode, such as |
| 545 |
\&\*(L"InnoDB Txns\*(R" for T mode, followed by a reminder to press '?' for help at any |
| 546 |
time. |
| 547 |
.SS "\s-1ONE SERVER\s0" |
| 548 |
.IX Subsection "ONE SERVER" |
| 549 |
The simplest case is when you're monitoring a single server. In this case, the |
| 550 |
name of the connection is next on the status line. This is the name you gave |
| 551 |
when you created the connection \*(-- most likely the MySQL server's hostname. |
| 552 |
This is followed by the server's uptime. |
| 553 |
.PP |
| 554 |
If you're in an InnoDB mode, such as T or B, the next word is \*(L"InnoDB\*(R" followed |
| 555 |
by some information about the \s-1SHOW INNODB STATUS\s0 output used to render the |
| 556 |
screen. The first word is the number of seconds since the last \s-1SHOW INNODB |
| 557 |
STATUS,\s0 which InnoDB uses to calculate some per-second statistics. The next is |
| 558 |
a smiley face indicating whether the InnoDB output is truncated. If the smiley |
| 559 |
face is a :\-), all is well; there is no truncation. A :^| means the transaction |
| 560 |
list is so long, InnoDB has only printed out some of the transactions. Finally, |
| 561 |
a frown :\-( means the output is incomplete, which is probably due to a deadlock |
| 562 |
printing too much lock information (see \*(L"D: InnoDB Deadlocks\*(R"). |
| 563 |
.PP |
| 564 |
The next two words indicate the server's queries per second (\s-1QPS\s0) and how many |
| 565 |
threads (connections) exist. Finally, the server's version number is the last |
| 566 |
thing on the line. |
| 567 |
.SS "\s-1MULTIPLE SERVERS\s0" |
| 568 |
.IX Subsection "MULTIPLE SERVERS" |
| 569 |
If you are monitoring multiple servers (see \*(L"\s-1SERVER CONNECTIONS\*(R"\s0), the status |
| 570 |
line does not show any details about individual servers. Instead, it shows the |
| 571 |
names of the connections that are active. Again, these are connection names you |
| 572 |
specified, which are likely to be the server's hostname. A connection that has |
| 573 |
an error is prefixed with an exclamation point. |
| 574 |
.PP |
| 575 |
If you are monitoring a group of servers (see \*(L"\s-1SERVER GROUPS\*(R"\s0), the status |
| 576 |
line shows the name of the group. If any connection in the group has an |
| 577 |
error, the group's name is followed by the fraction of the connections that |
| 578 |
don't have errors. |
| 579 |
.PP |
| 580 |
See \*(L"\s-1ERROR HANDLING\*(R"\s0 for more details about innotop's error handling. |
| 581 |
.SS "\s-1MONITORING A FILE\s0" |
| 582 |
.IX Subsection "MONITORING A FILE" |
| 583 |
If you give a filename on the command line, innotop will not connect to \s-1ANY\s0 |
| 584 |
servers at all. It will watch the specified file for InnoDB status output and |
| 585 |
use that as its data source. It will always show a single connection called |
| 586 |
\&'file'. And since it can't connect to a server, it can't determine how long the |
| 587 |
server it's monitoring has been up; so it calculates the server's uptime as time |
| 588 |
since innotop started running. |
| 589 |
.SH "SERVER ADMINISTRATION" |
| 590 |
.IX Header "SERVER ADMINISTRATION" |
| 591 |
While innotop is primarily a monitor that lets you watch and analyze your |
| 592 |
servers, it can also send commands to servers. The most frequently useful |
| 593 |
commands are killing queries and stopping or starting slaves. |
| 594 |
.PP |
| 595 |
You can kill a connection, or in newer versions of MySQL kill a query but not a |
| 596 |
connection, from \*(L"Q: Query List\*(R" and \*(L"T: InnoDB Transactions\*(R" modes. |
| 597 |
Press 'k' to issue a \s-1KILL\s0 command, or 'x' to issue a \s-1KILL QUERY\s0 command. |
| 598 |
innotop will prompt you for the server and/or connection \s-1ID\s0 to kill (innotop |
| 599 |
does not prompt you if there is only one possible choice for any input). |
| 600 |
innotop pre-selects the longest-running query, or the oldest connection. |
| 601 |
Confirm the command with 'y'. |
| 602 |
.PP |
| 603 |
In \*(L"Slave Replication Status\*(R"\*(L" in \*(R"M: Master mode, you can start and stop slaves |
| 604 |
with the 'a' and 'o' keys, respectively. You can send these commands to many |
| 605 |
slaves at once. innotop fills in a default command of \s-1START SLAVE\s0 or \s-1STOP SLAVE\s0 |
| 606 |
for you, but you can actually edit the command and send anything you wish, such |
| 607 |
as \s-1SET GLOBAL\s0 SQL_SLAVE_SKIP_COUNTER=1 to make the slave skip one binlog event |
| 608 |
when it starts. |
| 609 |
.PP |
| 610 |
You can also ask innotop to calculate the earliest binlog in use by any slave |
| 611 |
and issue a \s-1PURGE MASTER LOGS\s0 on the master. Use the 'b' key for this. innotop |
| 612 |
will prompt you for a master to run the command on, then prompt you for the |
| 613 |
connection names of that master's slaves (there is no way for innotop to |
| 614 |
determine this reliably itself). innotop will find the minimum binlog in use by |
| 615 |
these slave connections and suggest it as the argument to \s-1PURGE MASTER LOGS.\s0 |
| 616 |
.PP |
| 617 |
in \*(L"U: User Statistics\*(R" mode, you can use the 's' key to start and stop |
| 618 |
the collection of the statistics data for \s-1TABLE_STATISTICS\s0 and similar. |
| 619 |
.SH "SERVER CONNECTIONS" |
| 620 |
.IX Header "SERVER CONNECTIONS" |
| 621 |
When you create a server connection using '@', innotop asks you for a series of |
| 622 |
inputs, as follows: |
| 623 |
.IP "\s-1DSN\s0" 4 |
| 624 |
.IX Item "DSN" |
| 625 |
A \s-1DSN\s0 is a Data Source Name, which is the initial argument passed to the \s-1DBI\s0 |
| 626 |
module for connecting to a server. It is usually of the form |
| 627 |
.Sp |
| 628 |
.Vb 1 |
| 629 |
\& DBI:MariaDB:;mariadb_read_default_group=mysql;host=HOSTNAME |
| 630 |
.Ve |
| 631 |
.Sp |
| 632 |
Since this \s-1DSN\s0 is passed to the DBD::MariaDB driver, you should read the driver's |
| 633 |
documentation at <https://metacpan.org/pod/DBD::MariaDB> for |
| 634 |
the exact details on all the options you can pass the driver in the \s-1DSN. \s0 You |
| 635 |
can read more about \s-1DBI\s0 at <http://dbi.perl.org/docs/>, and especially at |
| 636 |
<http://search.cpan.org/~timb/DBI/DBI.pm>. |
| 637 |
.Sp |
| 638 |
The mariadb_read_default_group=mysql option lets the \s-1DBD\s0 driver read your MySQL |
| 639 |
options files, such as ~/.my.cnf on UNIX-ish systems. You can use this to avoid |
| 640 |
specifying a username or password for the connection. |
| 641 |
.IP "InnoDB Deadlock Table" 4 |
| 642 |
.IX Item "InnoDB Deadlock Table" |
| 643 |
This optional item tells innotop a table name it can use to deliberately create |
| 644 |
a small deadlock (see \*(L"D: InnoDB Deadlocks\*(R"). If you specify this option, |
| 645 |
you just need to be sure the table doesn't exist, and that innotop can create |
| 646 |
and drop the table with the InnoDB storage engine. You can safely omit or just |
| 647 |
accept the default if you don't intend to use this. |
| 648 |
.IP "Username" 4 |
| 649 |
.IX Item "Username" |
| 650 |
innotop will ask you if you want to specify a username. If you say 'y', it will |
| 651 |
then prompt you for a user name. If you have a MySQL option file that specifies |
| 652 |
your username, you don't have to specify a username. |
| 653 |
.Sp |
| 654 |
The username defaults to your login name on the system you're running innotop on. |
| 655 |
.IP "Password" 4 |
| 656 |
.IX Item "Password" |
| 657 |
innotop will ask you if you want to specify a password. Like the username, the |
| 658 |
password is optional, but there's an additional prompt that asks if you want to |
| 659 |
save the password in the innotop configuration file. If you don't save it in |
| 660 |
the configuration file, innotop will prompt you for a password each time it |
| 661 |
starts. Passwords in the innotop configuration file are saved in plain text, |
| 662 |
not encrypted in any way. |
| 663 |
.PP |
| 664 |
Once you finish answering these questions, you should be connected to a server. |
| 665 |
But innotop isn't limited to monitoring a single server; you can define many |
| 666 |
server connections and switch between them by pressing the '@' key. See |
| 667 |
\&\*(L"\s-1SWITCHING BETWEEN CONNECTIONS\*(R"\s0. |
| 668 |
.SH "SERVER GROUPS" |
| 669 |
.IX Header "SERVER GROUPS" |
| 670 |
If you have multiple MySQL instances, you can put them into named groups, such |
| 671 |
as 'all', 'masters', and 'slaves', which innotop can monitor all together. |
| 672 |
.PP |
| 673 |
You can choose which group to monitor with the '#' key, and you can press the |
| 674 |
\&\s-1TAB\s0 key to switch to the next group. If you're not currently monitoring a |
| 675 |
group, pressing \s-1TAB\s0 selects the first group. |
| 676 |
.PP |
| 677 |
To create a group, press the '#' key and type the name of your new group, then |
| 678 |
type the names of the connections you want the group to contain. |
| 679 |
.SH "SWITCHING BETWEEN CONNECTIONS" |
| 680 |
.IX Header "SWITCHING BETWEEN CONNECTIONS" |
| 681 |
innotop lets you quickly switch which servers you're monitoring. The most basic |
| 682 |
way is by pressing the '@' key and typing the name(s) of the connection(s) you |
| 683 |
want to use. This setting is per-mode, so you can monitor different connections |
| 684 |
in each mode, and innotop remembers which connections you choose. |
| 685 |
.PP |
| 686 |
You can quickly switch to the 'next' connection in alphabetical order with the |
| 687 |
\&'n' key. If you're monitoring a server group (see \*(L"\s-1SERVER GROUPS\*(R"\s0) this will |
| 688 |
switch to the first connection. |
| 689 |
.PP |
| 690 |
You can also type many connection names, and innotop will fetch and display data |
| 691 |
from them all. Just separate the connection names with spaces, for example |
| 692 |
\&\*(L"server1 server2.\*(R" Again, if you type the name of a connection that doesn't |
| 693 |
exist, innotop will prompt you for connection information and create the |
| 694 |
connection. |
| 695 |
.PP |
| 696 |
Another way to monitor multiple connections at once is with server groups. You |
| 697 |
can use the \s-1TAB\s0 key to switch to the 'next' group in alphabetical order, or if |
| 698 |
you're not monitoring any groups, \s-1TAB\s0 will switch to the first group. |
| 699 |
.PP |
| 700 |
innotop does not fetch data in parallel from connections, so if you are |
| 701 |
monitoring a large group or many connections, you may notice increased delay |
| 702 |
between ticks. |
| 703 |
.PP |
| 704 |
When you monitor more than one connection, innotop's status bar changes. See |
| 705 |
\&\*(L"\s-1INNOTOP STATUS\*(R"\s0. |
| 706 |
.SH "ERROR HANDLING" |
| 707 |
.IX Header "ERROR HANDLING" |
| 708 |
Error handling is not that important when monitoring a single connection, but is |
| 709 |
crucial when you have many active connections. A crashed server or lost |
| 710 |
connection should not crash innotop. As a result, innotop will continue to run |
| 711 |
even when there is an error; it just won't display any information from the |
| 712 |
connection that had an error. Because of this, innotop's behavior might confuse |
| 713 |
you. It's a feature, not a bug! |
| 714 |
.PP |
| 715 |
innotop does not continue to query connections that have errors, because they |
| 716 |
may slow innotop and make it hard to use, especially if the error is a problem |
| 717 |
connecting and causes a long time-out. Instead, innotop retries the connection |
| 718 |
occasionally to see if the error still exists. If so, it will wait until some |
| 719 |
point in the future. The wait time increases in ticks as the Fibonacci series, |
| 720 |
so it tries less frequently as time passes. |
| 721 |
.PP |
| 722 |
Since errors might only happen in certain modes because of the \s-1SQL\s0 commands |
| 723 |
issued in those modes, innotop keeps track of which mode caused the error. If |
| 724 |
you switch to a different mode, innotop will retry the connection instead of |
| 725 |
waiting. |
| 726 |
.PP |
| 727 |
By default innotop will display the problem in red text at the bottom of the |
| 728 |
first table on the screen. You can disable this behavior with the |
| 729 |
\&\*(L"show_cxn_errors_in_tbl\*(R" configuration option, which is enabled by default. |
| 730 |
If the \*(L"debug\*(R" option is enabled, innotop will display the error at the |
| 731 |
bottom of every table, not just the first. And if \*(L"show_cxn_errors\*(R" is |
| 732 |
enabled, innotop will print the error text to \s-1STDOUT\s0 as well. Error messages |
| 733 |
might only display in the mode that caused the error, depending on the mode and |
| 734 |
whether innotop is avoiding querying that connection. |
| 735 |
.SH "NON-INTERACTIVE OPERATION" |
| 736 |
.IX Header "NON-INTERACTIVE OPERATION" |
| 737 |
You can run innotop in non-interactive mode, in which case it is entirely |
| 738 |
controlled from the configuration file and command-line options. To start |
| 739 |
innotop in non-interactive mode, give the L\*(L"<\-\-nonint\*(R"> command-line option. |
| 740 |
This changes innotop's behavior in the following ways: |
| 741 |
.IP "\(bu" 4 |
| 742 |
Certain Perl modules are not loaded. Term::Readline is not loaded, since |
| 743 |
innotop doesn't prompt interactively. Term::ANSIColor and Win32::Console::ANSI |
| 744 |
modules are not loaded. Term::ReadKey is still used, since innotop may have to |
| 745 |
prompt for connection passwords when starting up. |
| 746 |
.IP "\(bu" 4 |
| 747 |
innotop does not clear the screen after each tick. |
| 748 |
.IP "\(bu" 4 |
| 749 |
innotop does not persist any changes to the configuration file. |
| 750 |
.IP "\(bu" 4 |
| 751 |
If \*(L"\-\-count\*(R" is given and innotop is in incremental mode (see \*(L"status_inc\*(R" |
| 752 |
and \*(L"\-\-inc\*(R"), innotop actually refreshes one more time than specified so it |
| 753 |
can print incremental statistics. This suppresses output during the first |
| 754 |
tick, so innotop may appear to hang. |
| 755 |
.IP "\(bu" 4 |
| 756 |
innotop only displays the first table in each mode. This is so the output can |
| 757 |
be easily processed with other command-line utilities such as awk and sed. To |
| 758 |
change which tables display in each mode, see \*(L"\s-1TABLES\*(R"\s0. Since \*(L"Q: Query |
| 759 |
List\*(R" mode is so important, innotop automatically disables the \*(L"q_header\*(R" |
| 760 |
table. This ensures you'll see the \*(L"processlist\*(R" table, even if you have |
| 761 |
innotop configured to show the q_header table during interactive operation. |
| 762 |
Similarly, in \*(L"T: InnoDB Transactions\*(R" mode, the \*(L"t_header\*(R" table is |
| 763 |
suppressed so you see only the \*(L"innodb_transactions\*(R" table. |
| 764 |
.IP "\(bu" 4 |
| 765 |
All output is tab-separated instead of being column-aligned with whitespace, and |
| 766 |
innotop prints the full contents of each table instead of only printing one |
| 767 |
screenful at a time. |
| 768 |
.IP "\(bu" 4 |
| 769 |
innotop only prints column headers once instead of every tick (see |
| 770 |
\&\*(L"hide_hdr\*(R"). innotop does not print table captions (see |
| 771 |
\&\*(L"display_table_captions\*(R"). innotop ensures there are no empty lines in the |
| 772 |
output. |
| 773 |
.IP "\(bu" 4 |
| 774 |
innotop does not honor the \*(L"shorten\*(R" transformation, which normally shortens |
| 775 |
some numbers to human-readable formats. |
| 776 |
.IP "\(bu" 4 |
| 777 |
innotop does not print a status line (see \*(L"\s-1INNOTOP STATUS\*(R"\s0). |
| 778 |
.SH "CONFIGURING" |
| 779 |
.IX Header "CONFIGURING" |
| 780 |
Nearly everything about innotop is configurable. Most things are possible to |
| 781 |
change with built-in commands, but you can also edit the configuration file. |
| 782 |
.PP |
| 783 |
While running innotop, press the '$' key to bring up the configuration editing |
| 784 |
dialog. Press another key to select the type of data you want to edit: |
| 785 |
.IP "S: Statement Sleep Times" 4 |
| 786 |
.IX Item "S: Statement Sleep Times" |
| 787 |
Edits \s-1SQL\s0 statement sleep delays, which make innotop pause for the specified |
| 788 |
amount of time after executing a statement. See \*(L"\s-1SQL STATEMENTS\*(R"\s0 for a |
| 789 |
definition of each statement and what it does. By default innotop does not |
| 790 |
delay after any statements. |
| 791 |
.Sp |
| 792 |
This feature is included so you can customize the side-effects caused by |
| 793 |
monitoring your server. You may not see any effects, but some innotop users |
| 794 |
have noticed that certain MySQL versions under very high load with InnoDB |
| 795 |
enabled take longer than usual to execute \s-1SHOW GLOBAL STATUS. \s0 If innotop calls |
| 796 |
\&\s-1SHOW FULL PROCESSLIST\s0 immediately afterward, the processlist contains more |
| 797 |
queries than the machine actually averages at any given moment. Configuring |
| 798 |
innotop to pause briefly after calling \s-1SHOW GLOBAL STATUS\s0 alleviates this |
| 799 |
effect. |
| 800 |
.Sp |
| 801 |
Sleep times are stored in the \*(L"stmt_sleep_times\*(R" section of the configuration |
| 802 |
file. Fractional-second sleeps are supported, subject to your hardware's |
| 803 |
limitations. |
| 804 |
.IP "c: Edit Columns" 4 |
| 805 |
.IX Item "c: Edit Columns" |
| 806 |
Starts the table editor on one of the displayed tables. See \*(L"\s-1TABLE EDITOR\*(R"\s0. |
| 807 |
An alternative way to start the table editor without entering the configuration |
| 808 |
dialog is with the '^' key. |
| 809 |
.IP "g: General Configuration" 4 |
| 810 |
.IX Item "g: General Configuration" |
| 811 |
Starts the configuration editor to edit global and mode-specific configuration |
| 812 |
variables (see \*(L"\s-1MODES\*(R"\s0). innotop prompts you to choose a variable from among |
| 813 |
the global and mode-specific ones depending on the current mode. |
| 814 |
.IP "k: Row-Coloring Rules" 4 |
| 815 |
.IX Item "k: Row-Coloring Rules" |
| 816 |
Starts the row-coloring rules editor on one of the displayed table(s). See |
| 817 |
\&\*(L"\s-1COLORS\*(R"\s0 for details. |
| 818 |
.IP "p: Manage Plugins" 4 |
| 819 |
.IX Item "p: Manage Plugins" |
| 820 |
Starts the plugin configuration editor. See \*(L"\s-1PLUGINS\*(R"\s0 for details. |
| 821 |
.IP "s: Server Groups" 4 |
| 822 |
.IX Item "s: Server Groups" |
| 823 |
Lets you create and edit server groups. See \*(L"\s-1SERVER GROUPS\*(R"\s0. |
| 824 |
.IP "t: Choose Displayed Tables" 4 |
| 825 |
.IX Item "t: Choose Displayed Tables" |
| 826 |
Lets you choose which tables to display in this mode. See \*(L"\s-1MODES\*(R"\s0 and |
| 827 |
\&\*(L"\s-1TABLES\*(R"\s0. |
| 828 |
.SH "CONFIGURATION FILE" |
| 829 |
.IX Header "CONFIGURATION FILE" |
| 830 |
innotop's default configuration file locations are \f(CW$HOME\fR/.innotop and |
| 831 |
/etc/innotop/innotop.conf, and they are looked for in that order. If the first |
| 832 |
configuration file exists, the second will not be processed. Those can be |
| 833 |
overridden with the \*(L"\-\-config\*(R" command-line option. You can edit it by hand |
| 834 |
safely, however innotop reads the configuration file when it starts, and, if |
| 835 |
readonly is set to 0, writes it out again when it exits. Thus, if readonly is |
| 836 |
set to 0, any changes you make by hand while innotop is running will be lost. |
| 837 |
.PP |
| 838 |
innotop doesn't store its entire configuration in the configuration file. It |
| 839 |
has a huge set of default configuration values that it holds only in memory, |
| 840 |
and the configuration file only overrides these defaults. When you customize a |
| 841 |
default setting, innotop notices, and then stores the customizations into the |
| 842 |
file. This keeps the file size down, makes it easier to edit, and makes |
| 843 |
upgrades easier. |
| 844 |
.PP |
| 845 |
A configuration file is read-only be default. You can override that with |
| 846 |
\&\*(L"\-\-write\*(R". See \*(L"readonly\*(R". |
| 847 |
.PP |
| 848 |
The configuration file is arranged into sections like an \s-1INI\s0 file. Each |
| 849 |
section begins with [section\-name] and ends with [/section\-name]. Each |
| 850 |
section's entries have a different syntax depending on the data they need to |
| 851 |
store. You can put comments in the file; any line that begins with a # |
| 852 |
character is a comment. innotop will not read the comments, so it won't write |
| 853 |
them back out to the file when it exits. Comments in read-only configuration |
| 854 |
files are still useful, though. |
| 855 |
.PP |
| 856 |
The first line in the file is innotop's version number. This lets innotop |
| 857 |
notice when the file format is not backwards-compatible, and upgrade smoothly |
| 858 |
without destroying your customized configuration. |
| 859 |
.PP |
| 860 |
The following list describes each section of the configuration file and the data |
| 861 |
it contains: |
| 862 |
.IP "general" 4 |
| 863 |
.IX Item "general" |
| 864 |
The 'general' section contains global configuration variables and variables that |
| 865 |
may be mode-specific, but don't belong in any other section. The syntax is a |
| 866 |
simple key=value list. innotop writes a comment above each value to help you |
| 867 |
edit the file by hand. |
| 868 |
.RS 4 |
| 869 |
.IP "S_func" 4 |
| 870 |
.IX Item "S_func" |
| 871 |
Controls S mode presentation (see \*(L"S: Variables & Status\*(R"). If g, values are |
| 872 |
graphed; if s, values are like vmstat; if p, values are in a pivoted table. |
| 873 |
.IP "S_set" 4 |
| 874 |
.IX Item "S_set" |
| 875 |
Specifies which set of variables to display in \*(L"S: Variables & Status\*(R" mode. |
| 876 |
See \*(L"\s-1VARIABLE SETS\*(R"\s0. |
| 877 |
.IP "auto_wipe_dl" 4 |
| 878 |
.IX Item "auto_wipe_dl" |
| 879 |
Instructs innotop to automatically wipe large deadlocks when it notices them. |
| 880 |
When this happens you may notice a slight delay. At the next tick, you will |
| 881 |
usually see the information that was being truncated by the large deadlock. |
| 882 |
.IP "charset" 4 |
| 883 |
.IX Item "charset" |
| 884 |
Specifies what kind of characters to allow through the \*(L"no_ctrl_char\*(R" |
| 885 |
transformation. This keeps non-printable characters from confusing a |
| 886 |
terminal when you monitor queries that contain binary data, such as images. |
| 887 |
.Sp |
| 888 |
The default is 'ascii', which considers anything outside normal \s-1ASCII\s0 to be a |
| 889 |
control character. The other allowable values are 'unicode' and 'none'. 'none' |
| 890 |
considers every character a control character, which can be useful for |
| 891 |
collapsing \s-1ALL\s0 text fields in queries. |
| 892 |
.IP "cmd_filter" 4 |
| 893 |
.IX Item "cmd_filter" |
| 894 |
This is the prefix that filters variables in \*(L"C: Command Summary\*(R" mode. |
| 895 |
.IP "color" 4 |
| 896 |
.IX Item "color" |
| 897 |
Whether terminal coloring is permitted. |
| 898 |
.IP "cxn_timeout" 4 |
| 899 |
.IX Item "cxn_timeout" |
| 900 |
On MySQL versions 4.0.3 and newer, this variable is used to set the connection's |
| 901 |
timeout, so MySQL doesn't close the connection if it is not used for a while. |
| 902 |
This might happen because a connection isn't monitored in a particular mode, for |
| 903 |
example. |
| 904 |
.IP "debug" 4 |
| 905 |
.IX Item "debug" |
| 906 |
This option enables more verbose errors and makes innotop more strict in some |
| 907 |
places. It can help in debugging filters and other user-defined code. It also |
| 908 |
makes innotop write a lot of information to \*(L"debugfile\*(R" when there is a |
| 909 |
crash. |
| 910 |
.IP "debugfile" 4 |
| 911 |
.IX Item "debugfile" |
| 912 |
A file to which innotop will write information when there is a crash. See |
| 913 |
\&\*(L"\s-1FILES\*(R"\s0. |
| 914 |
.IP "display_table_captions" 4 |
| 915 |
.IX Item "display_table_captions" |
| 916 |
innotop displays a table caption above most tables. This variable suppresses or |
| 917 |
shows captions on all tables globally. Some tables are configured with the |
| 918 |
hide_caption property, which overrides this. |
| 919 |
.IP "global" 4 |
| 920 |
.IX Item "global" |
| 921 |
Whether to show \s-1GLOBAL\s0 variables and status. innotop only tries to do this on |
| 922 |
servers which support the \s-1GLOBAL\s0 option to \s-1SHOW VARIABLES\s0 and \s-1SHOW STATUS. \s0 In |
| 923 |
some MySQL versions, you need certain privileges to do this; if you don't have |
| 924 |
them, innotop will not be able to fetch any variable and status data. This |
| 925 |
configuration variable lets you run innotop and fetch what data you can even |
| 926 |
without the elevated privileges. |
| 927 |
.Sp |
| 928 |
I can no longer find or reproduce the situation where \s-1GLOBAL\s0 wasn't allowed, but |
| 929 |
I know there was one. |
| 930 |
.IP "graph_char" 4 |
| 931 |
.IX Item "graph_char" |
| 932 |
Defines the character to use when drawing graphs in \*(L"S: Variables & Status\*(R" |
| 933 |
mode. |
| 934 |
.IP "header_highlight" 4 |
| 935 |
.IX Item "header_highlight" |
| 936 |
Defines how to highlight column headers. This only works if Term::ANSIColor is |
| 937 |
available. Valid values are 'bold' and 'underline'. |
| 938 |
.IP "hide_hdr" 4 |
| 939 |
.IX Item "hide_hdr" |
| 940 |
Hides column headers globally. |
| 941 |
.IP "interval" 4 |
| 942 |
.IX Item "interval" |
| 943 |
The interval at which innotop will refresh its data (ticks). The interval is |
| 944 |
implemented as a sleep time between ticks, so the true interval will vary |
| 945 |
depending on how long it takes innotop to fetch and render data. |
| 946 |
.Sp |
| 947 |
This variable accepts fractions of a second. |
| 948 |
.IP "mode" 4 |
| 949 |
.IX Item "mode" |
| 950 |
The mode in which innotop should start. Allowable arguments are the same as the |
| 951 |
key presses that select a mode interactively. See \*(L"\s-1MODES\*(R"\s0. |
| 952 |
.IP "num_digits" 4 |
| 953 |
.IX Item "num_digits" |
| 954 |
How many digits to show in fractional numbers and percents. This variable's |
| 955 |
range is between 0 and 9 and can be set directly from \*(L"S: Variables & Status\*(R" |
| 956 |
mode with the '+' and '\-' keys. It is used in the \*(L"set_precision\*(R", |
| 957 |
\&\*(L"shorten\*(R", and \*(L"percent\*(R" transformations. |
| 958 |
.IP "num_status_sets" 4 |
| 959 |
.IX Item "num_status_sets" |
| 960 |
Controls how many sets of status variables to display in pivoted \*(L"S: Variables |
| 961 |
& Status\*(R" mode. It also controls the number of old sets of variables innotop |
| 962 |
keeps in its memory, so the larger this variable is, the more memory innotop |
| 963 |
uses. |
| 964 |
.IP "plugin_dir" 4 |
| 965 |
.IX Item "plugin_dir" |
| 966 |
Specifies where plugins can be found. By default, innotop stores plugins in the |
| 967 |
\&'plugins' subdirectory of your innotop configuration directory. |
| 968 |
.IP "readonly" 4 |
| 969 |
.IX Item "readonly" |
| 970 |
Whether the configuration file is readonly. This cannot be set interactively. |
| 971 |
.IP "show_cxn_errors" 4 |
| 972 |
.IX Item "show_cxn_errors" |
| 973 |
Makes innotop print connection errors to \s-1STDOUT. \s0 See \*(L"\s-1ERROR HANDLING\*(R"\s0. |
| 974 |
.IP "show_cxn_errors_in_tbl" 4 |
| 975 |
.IX Item "show_cxn_errors_in_tbl" |
| 976 |
Makes innotop display connection errors as rows in the first table on screen. |
| 977 |
See \*(L"\s-1ERROR HANDLING\*(R"\s0. |
| 978 |
.IP "show_percent" 4 |
| 979 |
.IX Item "show_percent" |
| 980 |
Adds a '%' character after the value returned by the \*(L"percent\*(R" |
| 981 |
transformation. |
| 982 |
.IP "show_statusbar" 4 |
| 983 |
.IX Item "show_statusbar" |
| 984 |
Controls whether to show the status bar in the display. See \*(L"\s-1INNOTOP |
| 985 |
STATUS\*(R"\s0. |
| 986 |
.IP "skip_innodb" 4 |
| 987 |
.IX Item "skip_innodb" |
| 988 |
Disables fetching \s-1SHOW INNODB STATUS,\s0 in case your server(s) do not have InnoDB |
| 989 |
enabled and you don't want innotop to try to fetch it. This can also be useful |
| 990 |
when you don't have the \s-1SUPER\s0 privilege, required to run \s-1SHOW INNODB STATUS.\s0 |
| 991 |
.IP "spark" 4 |
| 992 |
.IX Item "spark" |
| 993 |
Specifies how wide a spark chart is. There are two \s-1ASCII\s0 spark charts in A |
| 994 |
mode, showing \s-1QPS\s0 and User_threads_running. |
| 995 |
.IP "status_inc" 4 |
| 996 |
.IX Item "status_inc" |
| 997 |
Whether to show absolute or incremental values for status variables. |
| 998 |
Incremental values are calculated as an offset from the last value innotop saw |
| 999 |
for that variable. This is a global setting, but will probably become |
| 1000 |
mode-specific at some point. Right now it is honored a bit inconsistently; some |
| 1001 |
modes don't pay attention to it. |
| 1002 |
.IP "timeformat" 4 |
| 1003 |
.IX Item "timeformat" |
| 1004 |
The C\-style \fIstrftime()\fR\-compatible format for the timestamp line to be printed |
| 1005 |
in \-n mode when \-t is set. |
| 1006 |
.RE |
| 1007 |
.RS 4 |
| 1008 |
.RE |
| 1009 |
.IP "plugins" 4 |
| 1010 |
.IX Item "plugins" |
| 1011 |
This section holds a list of package names of active plugins. If the plugin |
| 1012 |
exists, innotop will activate it. See \*(L"\s-1PLUGINS\*(R"\s0 for more information. |
| 1013 |
.IP "filters" 4 |
| 1014 |
.IX Item "filters" |
| 1015 |
This section holds user-defined filters (see \*(L"\s-1FILTERS\*(R"\s0). Each line is in the |
| 1016 |
format filter_name=text='filter text' tbls='table list'. |
| 1017 |
.Sp |
| 1018 |
The filter text is the text of the subroutine's code. The table list is a list |
| 1019 |
of tables to which the filter can apply. By default, user-defined filters apply |
| 1020 |
to the table for which they were created, but you can manually override that by |
| 1021 |
editing the definition in the configuration file. |
| 1022 |
.IP "active_filters" 4 |
| 1023 |
.IX Item "active_filters" |
| 1024 |
This section stores which filters are active on each table. Each line is in the |
| 1025 |
format table_name=filter_list. |
| 1026 |
.IP "tbl_meta" 4 |
| 1027 |
.IX Item "tbl_meta" |
| 1028 |
This section stores user-defined or user-customized columns (see \*(L"\s-1COLUMNS\*(R"\s0). |
| 1029 |
Each line is in the format col_name=properties, where the properties are a |
| 1030 |
name=quoted\-value list. |
| 1031 |
.IP "connections" 4 |
| 1032 |
.IX Item "connections" |
| 1033 |
This section holds the server connections you have defined. Each line is in |
| 1034 |
the format name=properties, where the properties are a name=value list. The |
| 1035 |
properties are self-explanatory, and the only one that is treated specially is |
| 1036 |
\&'pass' which is only present if 'savepass' is set. This section of the |
| 1037 |
configuration file will be skipped if any \s-1DSN,\s0 username, or password |
| 1038 |
command-line options are used. See \*(L"\s-1SERVER CONNECTIONS\*(R"\s0. |
| 1039 |
.IP "active_connections" 4 |
| 1040 |
.IX Item "active_connections" |
| 1041 |
This section holds a list of which connections are active in each mode. Each |
| 1042 |
line is in the format mode_name=connection_list. |
| 1043 |
.IP "server_groups" 4 |
| 1044 |
.IX Item "server_groups" |
| 1045 |
This section holds server groups. Each line is in the format |
| 1046 |
name=connection_list. See \*(L"\s-1SERVER GROUPS\*(R"\s0. |
| 1047 |
.IP "active_server_groups" 4 |
| 1048 |
.IX Item "active_server_groups" |
| 1049 |
This section holds a list of which server group is active in each mode. Each |
| 1050 |
line is in the format mode_name=server_group. |
| 1051 |
.IP "max_values_seen" 4 |
| 1052 |
.IX Item "max_values_seen" |
| 1053 |
This section holds the maximum values seen for variables. This is used to scale |
| 1054 |
the graphs in \*(L"S: Variables & Status\*(R" mode. Each line is in the format |
| 1055 |
name=value. |
| 1056 |
.IP "active_columns" 4 |
| 1057 |
.IX Item "active_columns" |
| 1058 |
This section holds table column lists. Each line is in the format |
| 1059 |
tbl_name=column_list. See \*(L"\s-1COLUMNS\*(R"\s0. |
| 1060 |
.IP "sort_cols" 4 |
| 1061 |
.IX Item "sort_cols" |
| 1062 |
This section holds the sort definition. Each line is in the format |
| 1063 |
tbl_name=column_list. If a column is prefixed with '\-', that column sorts |
| 1064 |
descending. See \*(L"\s-1SORTING\*(R"\s0. |
| 1065 |
.IP "visible_tables" 4 |
| 1066 |
.IX Item "visible_tables" |
| 1067 |
This section defines which tables are visible in each mode. Each line is in the |
| 1068 |
format mode_name=table_list. See \*(L"\s-1TABLES\*(R"\s0. |
| 1069 |
.IP "varsets" 4 |
| 1070 |
.IX Item "varsets" |
| 1071 |
This section defines variable sets for use in \*(L"S: Status & Variables\*(R" mode. |
| 1072 |
Each line is in the format name=variable_list. See \*(L"\s-1VARIABLE SETS\*(R"\s0. |
| 1073 |
.IP "colors" 4 |
| 1074 |
.IX Item "colors" |
| 1075 |
This section defines colorization rules. Each line is in the format |
| 1076 |
tbl_name=property_list. See \*(L"\s-1COLORS\*(R"\s0. |
| 1077 |
.IP "stmt_sleep_times" 4 |
| 1078 |
.IX Item "stmt_sleep_times" |
| 1079 |
This section contains statement sleep times. Each line is in the format |
| 1080 |
statement_name=sleep_time. See \*(L"S: Statement Sleep Times\*(R". |
| 1081 |
.IP "group_by" 4 |
| 1082 |
.IX Item "group_by" |
| 1083 |
This section contains column lists for table group_by expressions. Each line is |
| 1084 |
in the format tbl_name=column_list. See \*(L"\s-1GROUPING\*(R"\s0. |
| 1085 |
.SH "CUSTOMIZING" |
| 1086 |
.IX Header "CUSTOMIZING" |
| 1087 |
You can customize innotop a great deal. For example, you can: |
| 1088 |
.IP "\(bu" 4 |
| 1089 |
Choose which tables to display, and in what order. |
| 1090 |
.IP "\(bu" 4 |
| 1091 |
Choose which columns are in those tables, and create new columns. |
| 1092 |
.IP "\(bu" 4 |
| 1093 |
Filter which rows display with built-in filters, user-defined filters, and |
| 1094 |
quick-filters. |
| 1095 |
.IP "\(bu" 4 |
| 1096 |
Sort the rows to put important data first or group together related rows. |
| 1097 |
.IP "\(bu" 4 |
| 1098 |
Highlight rows with color. |
| 1099 |
.IP "\(bu" 4 |
| 1100 |
Customize the alignment, width, and formatting of columns, and apply |
| 1101 |
transformations to columns to extract parts of their values or format the values |
| 1102 |
as you wish (for example, shortening large numbers to familiar units). |
| 1103 |
.IP "\(bu" 4 |
| 1104 |
Design your own expressions to extract and combine data as you need. This gives |
| 1105 |
you unlimited flexibility. |
| 1106 |
.PP |
| 1107 |
All these and more are explained in the following sections. |
| 1108 |
.SS "\s-1TABLES\s0" |
| 1109 |
.IX Subsection "TABLES" |
| 1110 |
A table is what you'd expect: a collection of columns. It also has some other |
| 1111 |
properties, such as a caption. Filters, sorting rules, and colorization rules |
| 1112 |
belong to tables and are covered in later sections. |
| 1113 |
.PP |
| 1114 |
Internally, table meta-data is defined in a data structure called \f(CW%tbl_meta\fR. |
| 1115 |
This hash holds all built-in table definitions, which contain a lot of default |
| 1116 |
instructions to innotop. The meta-data includes the caption, a list of columns |
| 1117 |
the user has customized, a list of columns, a list of visible columns, a list of |
| 1118 |
filters, color rules, a sort-column list, sort direction, and some information |
| 1119 |
about the table's data sources. Most of this is customizable via the table |
| 1120 |
editor (see \*(L"\s-1TABLE EDITOR\*(R"\s0). |
| 1121 |
.PP |
| 1122 |
You can choose which tables to show by pressing the '$' key. See \*(L"\s-1MODES\*(R"\s0 and |
| 1123 |
\&\*(L"\s-1TABLES\*(R"\s0. |
| 1124 |
.PP |
| 1125 |
The table life-cycle is as follows: |
| 1126 |
.IP "\(bu" 4 |
| 1127 |
Each table begins with a data source, which is an array of hashes. See below |
| 1128 |
for details on data sources. |
| 1129 |
.IP "\(bu" 4 |
| 1130 |
Each element of the data source becomes a row in the final table. |
| 1131 |
.IP "\(bu" 4 |
| 1132 |
For each element in the data source, innotop extracts values from the source and |
| 1133 |
creates a row. This row is another hash, which later steps will refer to as |
| 1134 |
\&\f(CW$set\fR. The values innotop extracts are determined by the table's columns. Each |
| 1135 |
column has an extraction subroutine, compiled from an expression (see |
| 1136 |
\&\*(L"\s-1EXPRESSIONS\*(R"\s0). The resulting row is a hash whose keys are named the same as |
| 1137 |
the column name. |
| 1138 |
.IP "\(bu" 4 |
| 1139 |
innotop filters the rows, removing those that don't need to be displayed. See |
| 1140 |
\&\*(L"\s-1FILTERS\*(R"\s0. |
| 1141 |
.IP "\(bu" 4 |
| 1142 |
innotop sorts the rows. See \*(L"\s-1SORTING\*(R"\s0. |
| 1143 |
.IP "\(bu" 4 |
| 1144 |
innotop groups the rows together, if specified. See \*(L"\s-1GROUPING\*(R"\s0. |
| 1145 |
.IP "\(bu" 4 |
| 1146 |
innotop colorizes the rows. See \*(L"\s-1COLORS\*(R"\s0. |
| 1147 |
.IP "\(bu" 4 |
| 1148 |
innotop transforms the column values in each row. See \*(L"\s-1TRANSFORMATIONS\*(R"\s0. |
| 1149 |
.IP "\(bu" 4 |
| 1150 |
innotop optionally pivots the rows (see \*(L"\s-1PIVOTING\*(R"\s0), then filters and sorts |
| 1151 |
them. |
| 1152 |
.IP "\(bu" 4 |
| 1153 |
innotop formats and justifies the rows as a table. During this step, innotop |
| 1154 |
applies further formatting to the column values, including alignment, maximum |
| 1155 |
and minimum widths. innotop also does final error checking to ensure there are |
| 1156 |
no crashes due to undefined values. innotop then adds a caption if specified, |
| 1157 |
and the table is ready to print. |
| 1158 |
.PP |
| 1159 |
The lifecycle is slightly different if the table is pivoted, as noted above. To |
| 1160 |
clarify, if the table is pivoted, the process is extract, group, transform, |
| 1161 |
pivot, filter, sort, create. If it's not pivoted, the process is extract, |
| 1162 |
filter, sort, group, color, transform, create. This slightly convoluted process |
| 1163 |
doesn't map all that well to \s-1SQL,\s0 but pivoting complicates things pretty |
| 1164 |
thoroughly. Roughly speaking, filtering and sorting happen as late as needed to |
| 1165 |
effect the final result as you might expect, but as early as possible for |
| 1166 |
efficiency. |
| 1167 |
.PP |
| 1168 |
Each built-in table is described below: |
| 1169 |
.IP "adaptive_hash_index" 4 |
| 1170 |
.IX Item "adaptive_hash_index" |
| 1171 |
Displays data about InnoDB's adaptive hash index. Data source: |
| 1172 |
\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1173 |
.IP "buffer_pool" 4 |
| 1174 |
.IX Item "buffer_pool" |
| 1175 |
Displays data about InnoDB's buffer pool. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1176 |
.IP "cmd_summary" 4 |
| 1177 |
.IX Item "cmd_summary" |
| 1178 |
Displays weighted status variables. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1179 |
.IP "deadlock_locks" 4 |
| 1180 |
.IX Item "deadlock_locks" |
| 1181 |
Shows which locks were held and waited for by the last detected deadlock. Data |
| 1182 |
source: \*(L"\s-1DEADLOCK_LOCKS\*(R"\s0. |
| 1183 |
.IP "deadlock_transactions" 4 |
| 1184 |
.IX Item "deadlock_transactions" |
| 1185 |
Shows transactions involved in the last detected deadlock. Data source: |
| 1186 |
\&\*(L"\s-1DEADLOCK_TRANSACTIONS\*(R"\s0. |
| 1187 |
.IP "explain" 4 |
| 1188 |
.IX Item "explain" |
| 1189 |
Shows the output of \s-1EXPLAIN. \s0 Data source: \*(L"\s-1EXPLAIN\*(R"\s0. |
| 1190 |
.IP "file_io_misc" 4 |
| 1191 |
.IX Item "file_io_misc" |
| 1192 |
Displays data about InnoDB's file and I/O operations. Data source: |
| 1193 |
\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1194 |
.IP "fk_error" 4 |
| 1195 |
.IX Item "fk_error" |
| 1196 |
Displays various data about InnoDB's last foreign key error. Data source: |
| 1197 |
\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1198 |
.IP "health_dashboard" 4 |
| 1199 |
.IX Item "health_dashboard" |
| 1200 |
Displays an overall summary of servers, one server per line, for monitoring. |
| 1201 |
Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0, \*(L"\s-1MASTER_SLAVE\*(R"\s0, \*(L"\s-1PROCESSLIST_STATS\*(R"\s0. |
| 1202 |
.IP "index_statistics" 4 |
| 1203 |
.IX Item "index_statistics" |
| 1204 |
Displays data from the \s-1INDEX_STATISTICS\s0 table in Percona-enhanced servers. |
| 1205 |
.IP "index_table_statistics" 4 |
| 1206 |
.IX Item "index_table_statistics" |
| 1207 |
Displays data from the \s-1INDEX_STATISTICS\s0 and \s-1TABLE_STATISTICS\s0 tables in |
| 1208 |
Percona-enhanced servers. It joins the two together, grouped by the database |
| 1209 |
and table name. It is the default view in \*(L"U: User Statistics\*(R" mode, |
| 1210 |
and makes it easy to see what tables are hot, how many rows are read from indexes, |
| 1211 |
how many changes are made, and how many changes are made to indexes. |
| 1212 |
.IP "innodb_blocked_blocker" 4 |
| 1213 |
.IX Item "innodb_blocked_blocker" |
| 1214 |
Displays InnoDB locks and lock waits. Data source: \*(L"\s-1INNODB_BLOCKED_BLOCKER\*(R"\s0. |
| 1215 |
.IP "innodb_locks" 4 |
| 1216 |
.IX Item "innodb_locks" |
| 1217 |
Displays InnoDB locks. Data source: \*(L"\s-1INNODB_LOCKS\*(R"\s0. |
| 1218 |
.IP "innodb_transactions" 4 |
| 1219 |
.IX Item "innodb_transactions" |
| 1220 |
Displays data about InnoDB's current transactions. Data source: |
| 1221 |
\&\*(L"\s-1INNODB_TRANSACTIONS\*(R"\s0. |
| 1222 |
.IP "insert_buffers" 4 |
| 1223 |
.IX Item "insert_buffers" |
| 1224 |
Displays data about InnoDB's insert buffer. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1225 |
.IP "io_threads" 4 |
| 1226 |
.IX Item "io_threads" |
| 1227 |
Displays data about InnoDB's I/O threads. Data source: \*(L"\s-1IO_THREADS\*(R"\s0. |
| 1228 |
.IP "log_statistics" 4 |
| 1229 |
.IX Item "log_statistics" |
| 1230 |
Displays data about InnoDB's logging system. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1231 |
.IP "master_status" 4 |
| 1232 |
.IX Item "master_status" |
| 1233 |
Displays replication master status. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1234 |
.IP "open_tables" 4 |
| 1235 |
.IX Item "open_tables" |
| 1236 |
Displays open tables. Data source: \*(L"\s-1OPEN_TABLES\*(R"\s0. |
| 1237 |
.IP "page_statistics" 4 |
| 1238 |
.IX Item "page_statistics" |
| 1239 |
Displays InnoDB page statistics. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1240 |
.IP "pending_io" 4 |
| 1241 |
.IX Item "pending_io" |
| 1242 |
Displays InnoDB pending I/O operations. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1243 |
.IP "processlist" 4 |
| 1244 |
.IX Item "processlist" |
| 1245 |
Displays current MySQL processes (threads/connections). Data source: |
| 1246 |
\&\*(L"\s-1PROCESSLIST\*(R"\s0. |
| 1247 |
.IP "q_header" 4 |
| 1248 |
.IX Item "q_header" |
| 1249 |
Displays various status values. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1250 |
.IP "row_operation_misc" 4 |
| 1251 |
.IX Item "row_operation_misc" |
| 1252 |
Displays data about InnoDB's row operations. Data source: |
| 1253 |
\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1254 |
.IP "row_operations" 4 |
| 1255 |
.IX Item "row_operations" |
| 1256 |
Displays data about InnoDB's row operations. Data source: |
| 1257 |
\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1258 |
.IP "semaphores" 4 |
| 1259 |
.IX Item "semaphores" |
| 1260 |
Displays data about InnoDB's semaphores and mutexes. Data source: |
| 1261 |
\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1262 |
.IP "slave_io_status" 4 |
| 1263 |
.IX Item "slave_io_status" |
| 1264 |
Displays data about the slave I/O thread. Data source: |
| 1265 |
\&\*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1266 |
.IP "slave_sql_status" 4 |
| 1267 |
.IX Item "slave_sql_status" |
| 1268 |
Displays data about the slave \s-1SQL\s0 thread. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1269 |
.IP "table_statistics" 4 |
| 1270 |
.IX Item "table_statistics" |
| 1271 |
Displays data from the \s-1TABLE_STATISTICS\s0 table in Percona-enhanced servers. |
| 1272 |
.IP "t_header" 4 |
| 1273 |
.IX Item "t_header" |
| 1274 |
Displays various InnoDB status values. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1275 |
.IP "var_status" 4 |
| 1276 |
.IX Item "var_status" |
| 1277 |
Displays user-configurable data. Data source: \*(L"\s-1STATUS_VARIABLES\*(R"\s0. |
| 1278 |
.IP "wait_array" 4 |
| 1279 |
.IX Item "wait_array" |
| 1280 |
Displays data about InnoDB's \s-1OS\s0 wait array. Data source: \*(L"\s-1OS_WAIT_ARRAY\*(R"\s0. |
| 1281 |
.SS "\s-1COLUMNS\s0" |
| 1282 |
.IX Subsection "COLUMNS" |
| 1283 |
Columns belong to tables. You can choose a table's columns by pressing the '^' |
| 1284 |
key, which starts the \*(L"\s-1TABLE EDITOR\*(R"\s0 and lets you choose and edit columns. |
| 1285 |
Pressing 'e' from within the table editor lets you edit the column's properties: |
| 1286 |
.IP "\(bu" 4 |
| 1287 |
hdr: a column header. This appears in the first row of the table. |
| 1288 |
.IP "\(bu" 4 |
| 1289 |
just: justification. '\-' means left-justified and '' means right-justified, |
| 1290 |
just as with printf formatting codes (not a coincidence). |
| 1291 |
.IP "\(bu" 4 |
| 1292 |
dec: whether to further align the column on the decimal point. |
| 1293 |
.IP "\(bu" 4 |
| 1294 |
num: whether the column is numeric. This affects how values are sorted |
| 1295 |
(lexically or numerically). |
| 1296 |
.IP "\(bu" 4 |
| 1297 |
label: a small note about the column, which appears in dialogs that help the |
| 1298 |
user choose columns. |
| 1299 |
.IP "\(bu" 4 |
| 1300 |
src: an expression that innotop uses to extract the column's data from its |
| 1301 |
source (see \*(L"\s-1DATA SOURCES\*(R"\s0). See \*(L"\s-1EXPRESSIONS\*(R"\s0 for more on expressions. |
| 1302 |
.IP "\(bu" 4 |
| 1303 |
minw: specifies a minimum display width. This helps stabilize the display, |
| 1304 |
which makes it easier to read if the data is changing frequently. |
| 1305 |
.IP "\(bu" 4 |
| 1306 |
maxw: similar to minw. |
| 1307 |
.IP "\(bu" 4 |
| 1308 |
trans: a list of column transformations. See \*(L"\s-1TRANSFORMATIONS\*(R"\s0. |
| 1309 |
.IP "\(bu" 4 |
| 1310 |
agg: an aggregate function. See \*(L"\s-1GROUPING\*(R"\s0. The default is \*(L"first\*(R". |
| 1311 |
.IP "\(bu" 4 |
| 1312 |
aggonly: controls whether the column only shows when grouping is enabled on the |
| 1313 |
table (see \*(L"\s-1GROUPING\*(R"\s0). By default, this is disabled. This means columns |
| 1314 |
will always be shown by default, whether grouping is enabled or not. If a |
| 1315 |
column's aggonly is set true, the column will appear when you toggle grouping on |
| 1316 |
the table. Several columns are set this way, such as the count column on |
| 1317 |
\&\*(L"processlist\*(R" and \*(L"innodb_transactions\*(R", so you don't see a count when the |
| 1318 |
grouping isn't enabled, but you do when it is. |
| 1319 |
.IP "\(bu" 4 |
| 1320 |
agghide: the reverse of aggonly. The column is hidden when grouping is enabled. |
| 1321 |
.SS "\s-1FILTERS\s0" |
| 1322 |
.IX Subsection "FILTERS" |
| 1323 |
Filters remove rows from the display. They behave much like a \s-1WHERE\s0 clause in |
| 1324 |
\&\s-1SQL. \s0 innotop has several built-in filters, which remove irrelevant information |
| 1325 |
like inactive queries, but you can define your own as well. innotop also lets |
| 1326 |
you create quick-filters, which do not get saved to the configuration file, and |
| 1327 |
are just an easy way to quickly view only some rows. |
| 1328 |
.PP |
| 1329 |
You can enable or disable a filter on any table. Press the '%' key (mnemonic: % |
| 1330 |
looks kind of like a line being filtered between two circles) and choose which |
| 1331 |
table you want to filter, if asked. You'll then see a list of possible filters |
| 1332 |
and a list of filters currently enabled for that table. Type the names of |
| 1333 |
filters you want to apply and press Enter. |
| 1334 |
.PP |
| 1335 |
\fIUSER-DEFINED \s-1FILTERS\s0\fR |
| 1336 |
.IX Subsection "USER-DEFINED FILTERS" |
| 1337 |
.PP |
| 1338 |
If you type a name that doesn't exist, innotop will prompt you to create the |
| 1339 |
filter. Filters are easy to create if you know Perl, and not hard if you don't. |
| 1340 |
What you're doing is creating a subroutine that returns true if the row should |
| 1341 |
be displayed. The row is a hash reference passed to your subroutine as \f(CW$set\fR. |
| 1342 |
.PP |
| 1343 |
For example, imagine you want to filter the processlist table so you only see |
| 1344 |
queries that have been running more than five minutes. Type a new name for your |
| 1345 |
filter, and when prompted for the subroutine body, press \s-1TAB\s0 to initiate your |
| 1346 |
terminal's auto-completion. You'll see the names of the columns in the |
| 1347 |
\&\*(L"processlist\*(R" table (innotop generally tries to help you with auto-completion |
| 1348 |
lists). You want to filter on the 'time' column. Type the text \*(L"$set\->{time} > |
| 1349 |
300\*(R" to return true when the query is more than five minutes old. That's all |
| 1350 |
you need to do. |
| 1351 |
.PP |
| 1352 |
In other words, the code you're typing is surrounded by an implicit context, |
| 1353 |
which looks like this: |
| 1354 |
.PP |
| 1355 |
.Vb 4 |
| 1356 |
\& sub filter { |
| 1357 |
\& my ( $set ) = @_; |
| 1358 |
\& # YOUR CODE HERE |
| 1359 |
\& } |
| 1360 |
.Ve |
| 1361 |
.PP |
| 1362 |
If your filter doesn't work, or if something else suddenly behaves differently, |
| 1363 |
you might have made an error in your filter, and innotop is silently catching |
| 1364 |
the error. Try enabling \*(L"debug\*(R" to make innotop throw an error instead. |
| 1365 |
.PP |
| 1366 |
\fIQUICK-FILTERS\fR |
| 1367 |
.IX Subsection "QUICK-FILTERS" |
| 1368 |
.PP |
| 1369 |
innotop's quick-filters are a shortcut to create a temporary filter that doesn't |
| 1370 |
persist when you restart innotop. To create a quick-filter, press the '/' key. |
| 1371 |
innotop will prompt you for the column name and filter text. Again, you can use |
| 1372 |
auto-completion on column names. The filter text can be just the text you want |
| 1373 |
to \*(L"search for.\*(R" For example, to filter the \*(L"processlist\*(R" table on queries |
| 1374 |
that refer to the products table, type '/' and then 'info product'. Internally, |
| 1375 |
the filter is compiled into a subroutine like this: |
| 1376 |
.PP |
| 1377 |
.Vb 4 |
| 1378 |
\& sub filter { |
| 1379 |
\& my ( $set ) = @_; |
| 1380 |
\& $set\->{info} =~ m/product/; |
| 1381 |
\& } |
| 1382 |
.Ve |
| 1383 |
.PP |
| 1384 |
The filter text can actually be any Perl regular expression, but of course a |
| 1385 |
literal string like 'product' works fine as a regular expression. |
| 1386 |
.PP |
| 1387 |
What if you want the filter to discard matching rows, rather than showing |
| 1388 |
matching rows? If you're familiar with Perl regular expressions, you might |
| 1389 |
guess how to do this. You have to use a zero-width negative lookahead |
| 1390 |
assertion. If you don't know what that means, don't worry. Let's filter out |
| 1391 |
all rows where the command is Gandalf. Type the following: |
| 1392 |
.PP |
| 1393 |
.Vb 2 |
| 1394 |
\& 1. / |
| 1395 |
\& 2. cmd ^(?!Gandalf) |
| 1396 |
.Ve |
| 1397 |
.PP |
| 1398 |
Behind the scenes innotop compiles the quick-filter into a specially tagged |
| 1399 |
filter that is otherwise like any other filter. It just isn't saved to the |
| 1400 |
configuration file. |
| 1401 |
.PP |
| 1402 |
To clear quick-filters, press the '\e' key and innotop will clear them all at |
| 1403 |
once. |
| 1404 |
.SS "\s-1SORTING\s0" |
| 1405 |
.IX Subsection "SORTING" |
| 1406 |
innotop has sensible built-in defaults to sort the most important rows to the |
| 1407 |
top of the table. Like anything else in innotop, you can customize how any |
| 1408 |
table is sorted. |
| 1409 |
.PP |
| 1410 |
To start the sort dialog, start the \*(L"\s-1TABLE EDITOR\*(R"\s0 with the '^' key, choose a |
| 1411 |
table if necessary, and press the 's' key. You'll see a list of columns you can |
| 1412 |
use in the sort expression and the current sort expression, if any. Enter a |
| 1413 |
list of columns by which you want to sort and press Enter. If you want to |
| 1414 |
reverse sort, prefix the column name with a minus sign. For example, if you |
| 1415 |
want to sort by column a ascending, then column b descending, type 'a \-b'. You |
| 1416 |
can also explicitly add a + in front of columns you want to sort ascending, but |
| 1417 |
it's not required. |
| 1418 |
.PP |
| 1419 |
Some modes have keys mapped to open this dialog directly, and to quickly reverse |
| 1420 |
sort direction. Press '?' as usual to see which keys are mapped in any mode. |
| 1421 |
.SS "\s-1GROUPING\s0" |
| 1422 |
.IX Subsection "GROUPING" |
| 1423 |
innotop can group, or aggregate, rows together (the terms are used |
| 1424 |
interchangeably). This is quite similar to an \s-1SQL GROUP BY\s0 clause. You can |
| 1425 |
specify to group on certain columns, or if you don't specify any, the entire set |
| 1426 |
of rows is treated as one group. This is quite like \s-1SQL\s0 so far, but unlike \s-1SQL,\s0 |
| 1427 |
you can also select un-grouped columns. innotop actually aggregates every |
| 1428 |
column. If you don't explicitly specify a grouping function, the default is |
| 1429 |
\&'first'. This is basically a convenience so you don't have to specify an |
| 1430 |
aggregate function for every column you want in the result. |
| 1431 |
.PP |
| 1432 |
You can quickly toggle grouping on a table with the '=' key, which toggles its |
| 1433 |
aggregate property. This property doesn't persist to the config file. |
| 1434 |
.PP |
| 1435 |
The columns by which the table is grouped are specified in its group_by |
| 1436 |
property. When you turn grouping on, innotop places the group_by columns at the |
| 1437 |
far left of the table, even if they're not supposed to be visible. The rest of |
| 1438 |
the visible columns appear in order after them. |
| 1439 |
.PP |
| 1440 |
Two tables have default group_by lists and a count column built in: |
| 1441 |
\&\*(L"processlist\*(R" and \*(L"innodb_transactions\*(R". The grouping is by connection |
| 1442 |
and status, so you can quickly see how many queries or transactions are in a |
| 1443 |
given status on each server you're monitoring. The time columns are aggregated |
| 1444 |
as a sum; other columns are left at the default 'first' aggregation. |
| 1445 |
.PP |
| 1446 |
By default, the table shown in \*(L"S: Variables & Status\*(R" mode also uses |
| 1447 |
grouping so you can monitor variables and status across many servers. The |
| 1448 |
default aggregation function in this mode is 'avg'. |
| 1449 |
.PP |
| 1450 |
Valid grouping functions are defined in the \f(CW%agg_funcs\fR hash. They include |
| 1451 |
.IP "first" 4 |
| 1452 |
.IX Item "first" |
| 1453 |
Returns the first element in the group. |
| 1454 |
.IP "count" 4 |
| 1455 |
.IX Item "count" |
| 1456 |
Returns the number of elements in the group, including undefined elements, much |
| 1457 |
like \s-1SQL\s0's \s-1COUNT\s0(*). |
| 1458 |
.IP "avg" 4 |
| 1459 |
.IX Item "avg" |
| 1460 |
Returns the average of defined elements in the group. |
| 1461 |
.IP "sum" 4 |
| 1462 |
.IX Item "sum" |
| 1463 |
Returns the sum of elements in the group. |
| 1464 |
.PP |
| 1465 |
Here's an example of grouping at work. Suppose you have a very busy server with |
| 1466 |
hundreds of open connections, and you want to see how many connections are in |
| 1467 |
what status. Using the built-in grouping rules, you can press 'Q' to enter |
| 1468 |
\&\*(L"Q: Query List\*(R" mode. Press '=' to toggle grouping (if necessary, select the |
| 1469 |
\&\*(L"processlist\*(R" table when prompted). |
| 1470 |
.PP |
| 1471 |
Your display might now look like the following: |
| 1472 |
.PP |
| 1473 |
.Vb 1 |
| 1474 |
\& Query List (? for help) localhost, 32:33, 0.11 QPS, 1 thd, 5.0.38\-log |
| 1475 |
\& |
| 1476 |
\& CXN Cmd Cnt ID User Host Time Query |
| 1477 |
\& localhost Query 49 12933 webusr localhost 19:38 SELECT * FROM |
| 1478 |
\& localhost Sending Da 23 2383 webusr localhost 12:43 SELECT col1, |
| 1479 |
\& localhost Sleep 120 140 webusr localhost 5:18:12 |
| 1480 |
\& localhost Statistics 12 19213 webusr localhost 01:19 SELECT * FROM |
| 1481 |
.Ve |
| 1482 |
.PP |
| 1483 |
That's actually quite a worrisome picture. You've got a lot of idle connections |
| 1484 |
(Sleep), and some connections executing queries (Query and Sending Data). |
| 1485 |
That's okay, but you also have a lot in Statistics status, collectively spending |
| 1486 |
over a minute. That means the query optimizer is having a really hard time |
| 1487 |
generating execution plans for your statements. Something is wrong; it should |
| 1488 |
normally take milliseconds to plan queries. You might not have seen this pattern if you |
| 1489 |
didn't look at your connections in aggregate. (This is a made-up example, but |
| 1490 |
it can happen in real life). |
| 1491 |
.SS "\s-1PIVOTING\s0" |
| 1492 |
.IX Subsection "PIVOTING" |
| 1493 |
innotop can pivot a table for more compact display, similar to a Pivot Table in |
| 1494 |
a spreadsheet (also known as a crosstab). Pivoting a table makes columns into |
| 1495 |
rows. Assume you start with this table: |
| 1496 |
.PP |
| 1497 |
.Vb 4 |
| 1498 |
\& foo bar |
| 1499 |
\& === === |
| 1500 |
\& 1 3 |
| 1501 |
\& 2 4 |
| 1502 |
.Ve |
| 1503 |
.PP |
| 1504 |
After pivoting, the table will look like this: |
| 1505 |
.PP |
| 1506 |
.Vb 4 |
| 1507 |
\& name set0 set1 |
| 1508 |
\& ==== ==== ==== |
| 1509 |
\& foo 1 2 |
| 1510 |
\& bar 3 4 |
| 1511 |
.Ve |
| 1512 |
.PP |
| 1513 |
To get reasonable results, you might need to group as well as pivoting. |
| 1514 |
innotop currently does this for \*(L"S: Variables & Status\*(R" mode. |
| 1515 |
.SS "\s-1COLORS\s0" |
| 1516 |
.IX Subsection "COLORS" |
| 1517 |
By default, innotop highlights rows with color so you can see at a glance which |
| 1518 |
rows are more important. You can customize the colorization rules and add your |
| 1519 |
own to any table. Open the table editor with the '^' key, choose a table if |
| 1520 |
needed, and press 'o' to open the color editor dialog. |
| 1521 |
.PP |
| 1522 |
The color editor dialog displays the rules applied to the table, in the order |
| 1523 |
they are evaluated. Each row is evaluated against each rule to see if the rule |
| 1524 |
matches the row; if it does, the row gets the specified color, and no further |
| 1525 |
rules are evaluated. The rules look like the following: |
| 1526 |
.PP |
| 1527 |
.Vb 9 |
| 1528 |
\& state eq Locked black on_red |
| 1529 |
\& cmd eq Sleep white |
| 1530 |
\& user eq system user white |
| 1531 |
\& cmd eq Connect white |
| 1532 |
\& cmd eq Binlog Dump white |
| 1533 |
\& time > 600 red |
| 1534 |
\& time > 120 yellow |
| 1535 |
\& time > 60 green |
| 1536 |
\& time > 30 cyan |
| 1537 |
.Ve |
| 1538 |
.PP |
| 1539 |
This is the default rule set for the \*(L"processlist\*(R" table. In order of |
| 1540 |
priority, these rules make locked queries black on a red background, \*(L"gray out\*(R" |
| 1541 |
connections from replication and sleeping queries, and make queries turn from |
| 1542 |
cyan to red as they run longer. |
| 1543 |
.PP |
| 1544 |
(For some reason, the \s-1ANSI\s0 color code \*(L"white\*(R" is actually a light gray. Your |
| 1545 |
terminal's display may vary; experiment to find colors you like). |
| 1546 |
.PP |
| 1547 |
You can use keystrokes to move the rules up and down, which re-orders their |
| 1548 |
priority. You can also delete rules and add new ones. If you add a new rule, |
| 1549 |
innotop prompts you for the column, an operator for the comparison, a value |
| 1550 |
against which to compare the column, and a color to assign if the rule matches. |
| 1551 |
There is auto-completion and prompting at each step. |
| 1552 |
.PP |
| 1553 |
The value in the third step needs to be correctly quoted. innotop does not try |
| 1554 |
to quote the value because it doesn't know whether it should treat the value as |
| 1555 |
a string or a number. If you want to compare the column against a string, as |
| 1556 |
for example in the first rule above, you should enter 'Locked' surrounded by |
| 1557 |
quotes. If you get an error message about a bareword, you probably should have |
| 1558 |
quoted something. |
| 1559 |
.SS "\s-1EXPRESSIONS\s0" |
| 1560 |
.IX Subsection "EXPRESSIONS" |
| 1561 |
Expressions are at the core of how innotop works, and are what enables you to |
| 1562 |
extend innotop as you wish. Recall the table lifecycle explained in |
| 1563 |
\&\*(L"\s-1TABLES\*(R"\s0. Expressions are used in the earliest step, where it extracts |
| 1564 |
values from a data source to form rows. |
| 1565 |
.PP |
| 1566 |
It does this by calling a subroutine for each column, passing it the source data |
| 1567 |
set, a set of current values, and a set of previous values. These are all |
| 1568 |
needed so the subroutine can calculate things like the difference between this |
| 1569 |
tick and the previous tick. |
| 1570 |
.PP |
| 1571 |
The subroutines that extract the data from the set are compiled from |
| 1572 |
expressions. This gives significantly more power than just naming the values to |
| 1573 |
fill the columns, because it allows the column's value to be calculated from |
| 1574 |
whatever data is necessary, but avoids the need to write complicated and lengthy |
| 1575 |
Perl code. |
| 1576 |
.PP |
| 1577 |
innotop begins with a string of text that can look as simple as a value's name |
| 1578 |
or as complicated as a full-fledged Perl expression. It looks at each |
| 1579 |
\&'bareword' token in the string and decides whether it's supposed to be a key |
| 1580 |
into the \f(CW$set\fR hash. A bareword is an unquoted value that isn't already |
| 1581 |
surrounded by code-ish things like dollar signs or curly brackets. If innotop |
| 1582 |
decides that the bareword isn't a function or other valid Perl code, it converts |
| 1583 |
it into a hash access. After the whole string is processed, innotop compiles a |
| 1584 |
subroutine, like this: |
| 1585 |
.PP |
| 1586 |
.Vb 5 |
| 1587 |
\& sub compute_column_value { |
| 1588 |
\& my ( $set, $cur, $pre ) = @_; |
| 1589 |
\& my $val = # EXPANDED STRING GOES HERE |
| 1590 |
\& return $val; |
| 1591 |
\& } |
| 1592 |
.Ve |
| 1593 |
.PP |
| 1594 |
Here's a concrete example, taken from the header table \*(L"q_header\*(R" in \*(L"Q: |
| 1595 |
Query List\*(R" mode. This expression calculates the qps, or Queries Per Second, |
| 1596 |
column's values, from the values returned by \s-1SHOW STATUS:\s0 |
| 1597 |
.PP |
| 1598 |
.Vb 1 |
| 1599 |
\& Questions/Uptime_hires |
| 1600 |
.Ve |
| 1601 |
.PP |
| 1602 |
innotop decides both words are barewords, and transforms this expression into |
| 1603 |
the following Perl code: |
| 1604 |
.PP |
| 1605 |
.Vb 1 |
| 1606 |
\& $set\->{Questions}/$set\->{Uptime_hires} |
| 1607 |
.Ve |
| 1608 |
.PP |
| 1609 |
When surrounded by the rest of the subroutine's code, this is executable Perl |
| 1610 |
that calculates a high-resolution queries-per-second value. |
| 1611 |
.PP |
| 1612 |
The arguments to the subroutine are named \f(CW$set\fR, \f(CW$cur\fR, and \f(CW$pre\fR. In most cases, |
| 1613 |
\&\f(CW$set\fR and \f(CW$cur\fR will be the same values. However, if \*(L"status_inc\*(R" is set, \f(CW$cur\fR |
| 1614 |
will not be the same as \f(CW$set\fR, because \f(CW$set\fR will already contain values that are |
| 1615 |
the incremental difference between \f(CW$cur\fR and \f(CW$pre\fR. |
| 1616 |
.PP |
| 1617 |
Every column in innotop is computed by subroutines compiled in the same fashion. |
| 1618 |
There is no difference between innotop's built-in columns and user-defined |
| 1619 |
columns. This keeps things consistent and predictable. |
| 1620 |
.SS "\s-1TRANSFORMATIONS\s0" |
| 1621 |
.IX Subsection "TRANSFORMATIONS" |
| 1622 |
Transformations change how a value is rendered. For example, they can take a |
| 1623 |
number of seconds and display it in H:M:S format. The following transformations |
| 1624 |
are defined: |
| 1625 |
.IP "commify" 4 |
| 1626 |
.IX Item "commify" |
| 1627 |
Adds commas to large numbers every three decimal places. |
| 1628 |
.IP "distill" 4 |
| 1629 |
.IX Item "distill" |
| 1630 |
Distills \s-1SQL\s0 into verb-noun-noun format for quick comprehension. |
| 1631 |
.IP "dulint_to_int" 4 |
| 1632 |
.IX Item "dulint_to_int" |
| 1633 |
Accepts two unsigned integers and converts them into a single longlong. This is |
| 1634 |
useful for certain operations with InnoDB, which uses two integers as |
| 1635 |
transaction identifiers, for example. |
| 1636 |
.IP "fuzzy_time" 4 |
| 1637 |
.IX Item "fuzzy_time" |
| 1638 |
Converts a number of seconds into a friendly, readable value like \*(L"1h35m\*(R". |
| 1639 |
.IP "no_ctrl_char" 4 |
| 1640 |
.IX Item "no_ctrl_char" |
| 1641 |
Removes quoted control characters from the value. This is affected by the |
| 1642 |
\&\*(L"charset\*(R" configuration variable. |
| 1643 |
.Sp |
| 1644 |
This transformation only operates within quoted strings, for example, values to |
| 1645 |
a \s-1SET\s0 clause in an \s-1UPDATE\s0 statement. It will not alter the \s-1UPDATE\s0 statement, |
| 1646 |
but will collapse the quoted string to [\s-1BINARY\s0] or [\s-1TEXT\s0], depending on the |
| 1647 |
charset. |
| 1648 |
.IP "percent" 4 |
| 1649 |
.IX Item "percent" |
| 1650 |
Converts a number to a percentage by multiplying it by two, formatting it with |
| 1651 |
\&\*(L"num_digits\*(R" digits after the decimal point, and optionally adding a percent |
| 1652 |
sign (see \*(L"show_percent\*(R"). |
| 1653 |
.IP "secs_to_time" 4 |
| 1654 |
.IX Item "secs_to_time" |
| 1655 |
Formats a number of seconds as time in days+hours:minutes:seconds format. |
| 1656 |
.IP "set_precision" 4 |
| 1657 |
.IX Item "set_precision" |
| 1658 |
Formats numbers with \*(L"num_digits\*(R" number of digits after the decimal point. |
| 1659 |
.IP "shorten" 4 |
| 1660 |
.IX Item "shorten" |
| 1661 |
Formats a number as a unit of 1024 (k/M/G/T) and with \*(L"num_digits\*(R" number of |
| 1662 |
digits after the decimal point. |
| 1663 |
.SS "\s-1TABLE EDITOR\s0" |
| 1664 |
.IX Subsection "TABLE EDITOR" |
| 1665 |
The innotop table editor lets you customize tables with keystrokes. You start |
| 1666 |
the table editor with the '^' key. If there's more than one table on the |
| 1667 |
screen, it will prompt you to choose one of them. Once you do, innotop will |
| 1668 |
show you something like this: |
| 1669 |
.PP |
| 1670 |
.Vb 1 |
| 1671 |
\& Editing table definition for Buffer Pool. Press ? for help, q to quit. |
| 1672 |
\& |
| 1673 |
\& name hdr label src |
| 1674 |
\& cxn CXN Connection from which cxn |
| 1675 |
\& buf_pool_size Size Buffer pool size IB_bp_buf_poo |
| 1676 |
\& buf_free Free Bufs Buffers free in the b IB_bp_buf_fre |
| 1677 |
\& pages_total Pages Pages total IB_bp_pages_t |
| 1678 |
\& pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m |
| 1679 |
\& buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo |
| 1680 |
\& total_mem_alloc Memory Total memory allocate IB_bp_total_m |
| 1681 |
\& add_pool_alloc Add\*(Aql Pool Additional pool alloca IB_bp_add_poo |
| 1682 |
.Ve |
| 1683 |
.PP |
| 1684 |
The first line shows which table you're editing, and reminds you again to press |
| 1685 |
\&'?' for a list of key mappings. The rest is a tabular representation of the |
| 1686 |
table's columns, because that's likely what you're trying to edit. However, you |
| 1687 |
can edit more than just the table's columns; this screen can start the filter |
| 1688 |
editor, color rule editor, and more. |
| 1689 |
.PP |
| 1690 |
Each row in the display shows a single column in the table you're editing, along |
| 1691 |
with a couple of its properties such as its header and source expression (see |
| 1692 |
\&\*(L"\s-1EXPRESSIONS\*(R"\s0). |
| 1693 |
.PP |
| 1694 |
The key mappings are Vim-style, as in many other places. Pressing 'j' and 'k' |
| 1695 |
moves the highlight up or down. You can then (d)elete or (e)dit the highlighted |
| 1696 |
column. You can also (a)dd a column to the table. This actually just activates |
| 1697 |
one of the columns already defined for the table; it prompts you to choose from |
| 1698 |
among the columns available but not currently displayed. Finally, you can |
| 1699 |
re-order the columns with the '+' and '\-' keys. |
| 1700 |
.PP |
| 1701 |
You can do more than just edit the columns with the table editor, you can also |
| 1702 |
edit other properties, such as the table's sort expression and group-by |
| 1703 |
expression. Press '?' to see the full list, of course. |
| 1704 |
.PP |
| 1705 |
If you want to really customize and create your own column, as opposed to just |
| 1706 |
activating a built-in one that's not currently displayed, press the (n)ew key, |
| 1707 |
and innotop will prompt you for the information it needs: |
| 1708 |
.IP "\(bu" 4 |
| 1709 |
The column name: this needs to be a word without any funny characters, e.g. just |
| 1710 |
letters, numbers and underscores. |
| 1711 |
.IP "\(bu" 4 |
| 1712 |
The column header: this is the label that appears at the top of the column, in |
| 1713 |
the table header. This can have spaces and funny characters, but be careful not |
| 1714 |
to make it too wide and waste space on-screen. |
| 1715 |
.IP "\(bu" 4 |
| 1716 |
The column's data source: this is an expression that determines what data from |
| 1717 |
the source (see \*(L"\s-1TABLES\*(R"\s0) innotop will put into the column. This can just be |
| 1718 |
the name of an item in the source, or it can be a more complex expression, as |
| 1719 |
described in \*(L"\s-1EXPRESSIONS\*(R"\s0. |
| 1720 |
.PP |
| 1721 |
Once you've entered the required data, your table has a new column. There is no |
| 1722 |
difference between this column and the built-in ones; it can have all the same |
| 1723 |
properties and behaviors. innotop will write the column's definition to the |
| 1724 |
configuration file, so it will persist across sessions. |
| 1725 |
.PP |
| 1726 |
Here's an example: suppose you want to track how many times your slaves have |
| 1727 |
retried transactions. According to the MySQL manual, the |
| 1728 |
Slave_retried_transactions status variable gives you that data: \*(L"The total |
| 1729 |
number of times since startup that the replication slave \s-1SQL\s0 thread has retried |
| 1730 |
transactions. This variable was added in version 5.0.4.\*(R" This is appropriate to |
| 1731 |
add to the \*(L"slave_sql_status\*(R" table. |
| 1732 |
.PP |
| 1733 |
To add the column, switch to the replication-monitoring mode with the 'M' key, |
| 1734 |
and press the '^' key to start the table editor. When prompted, choose |
| 1735 |
slave_sql_status as the table, then press 'n' to create the column. Type |
| 1736 |
\&'retries' as the column name, 'Retries' as the column header, and |
| 1737 |
\&'Slave_retried_transactions' as the source. Now the column is created, and you |
| 1738 |
see the table editor screen again. Press 'q' to exit the table editor, and |
| 1739 |
you'll see your column at the end of the table. |
| 1740 |
.SH "VARIABLE SETS" |
| 1741 |
.IX Header "VARIABLE SETS" |
| 1742 |
Variable sets are used in \*(L"S: Variables & Status\*(R" mode to define more easily |
| 1743 |
what variables you want to monitor. Behind the scenes they are compiled to a |
| 1744 |
list of expressions, and then into a column list so they can be treated just |
| 1745 |
like columns in any other table, in terms of data extraction and |
| 1746 |
transformations. However, you're protected from the tedious details by a syntax |
| 1747 |
that ought to feel very natural to you: a \s-1SQL SELECT\s0 list. |
| 1748 |
.PP |
| 1749 |
The data source for variable sets, and indeed the entire S mode, is the |
| 1750 |
combination of \s-1SHOW STATUS, SHOW VARIABLES,\s0 and \s-1SHOW INNODB STATUS. \s0 Imagine |
| 1751 |
that you had a huge table with one column per variable returned from those |
| 1752 |
statements. That's the data source for variable sets. You can now query this |
| 1753 |
data source just like you'd expect. For example: |
| 1754 |
.PP |
| 1755 |
.Vb 1 |
| 1756 |
\& Questions, Uptime, Questions/Uptime as QPS |
| 1757 |
.Ve |
| 1758 |
.PP |
| 1759 |
Behind the scenes innotop will split that variable set into three expressions, |
| 1760 |
compile them and turn them into a table definition, then extract as usual. This |
| 1761 |
becomes a \*(L"variable set,\*(R" or a \*(L"list of variables you want to monitor.\*(R" |
| 1762 |
.PP |
| 1763 |
innotop lets you name and save your variable sets, and writes them to the |
| 1764 |
configuration file. You can choose which variable set you want to see with the |
| 1765 |
\&'c' key, or activate the next and previous sets with the '>' and '<' keys. |
| 1766 |
There are many built-in variable sets as well, which should give you a good |
| 1767 |
start for creating your own. Press 'e' to edit the current variable set, or |
| 1768 |
just to see how it's defined. To create a new one, just press 'c' and type its |
| 1769 |
name. |
| 1770 |
.PP |
| 1771 |
You may want to use some of the functions listed in \*(L"\s-1TRANSFORMATIONS\*(R"\s0 to help |
| 1772 |
format the results. In particular, \*(L"set_precision\*(R" is often useful to limit |
| 1773 |
the number of digits you see. Extending the above example, here's how: |
| 1774 |
.PP |
| 1775 |
.Vb 1 |
| 1776 |
\& Questions, Uptime, set_precision(Questions/Uptime) as QPS |
| 1777 |
.Ve |
| 1778 |
.PP |
| 1779 |
Actually, this still needs a little more work. If your \*(L"interval\*(R" is less |
| 1780 |
than one second, you might be dividing by zero because Uptime is incremental in |
| 1781 |
this mode by default. Instead, use Uptime_hires: |
| 1782 |
.PP |
| 1783 |
.Vb 1 |
| 1784 |
\& Questions, Uptime, set_precision(Questions/Uptime_hires) as QPS |
| 1785 |
.Ve |
| 1786 |
.PP |
| 1787 |
This example is simple, but it shows how easy it is to choose which variables |
| 1788 |
you want to monitor. |
| 1789 |
.SH "PLUGINS" |
| 1790 |
.IX Header "PLUGINS" |
| 1791 |
innotop has a simple but powerful plugin mechanism by which you can extend |
| 1792 |
or modify its existing functionality, and add new functionality. innotop's |
| 1793 |
plugin functionality is event-based: plugins register themselves to be called |
| 1794 |
when events happen. They then have a chance to influence the event. |
| 1795 |
.PP |
| 1796 |
An innotop plugin is a Perl module (.pm) file placed in innotop's \*(L"plugin_dir\*(R" |
| 1797 |
directory. On \s-1UNIX\s0 systems, you can place a symbolic link to the module instead |
| 1798 |
of putting the actual file there. innotop automatically discovers files named \f(CW\*(C`*.pm\*(C'\fR. If |
| 1799 |
there is a corresponding entry in the \*(L"plugins\*(R" configuration file section, |
| 1800 |
innotop loads and activates the plugin. |
| 1801 |
.PP |
| 1802 |
The module must conform to innotop's plugin interface. Additionally, the source |
| 1803 |
code of the module must be written in such a way that innotop can inspect the |
| 1804 |
file and determine the package name and description. |
| 1805 |
.SS "Package Source Convention" |
| 1806 |
.IX Subsection "Package Source Convention" |
| 1807 |
innotop inspects the plugin module's source to determine the Perl package name. |
| 1808 |
It looks for a line of the form \*(L"package Foo;\*(R" and if found, considers the |
| 1809 |
plugin's package name to be Foo. Of course the package name can be a valid Perl |
| 1810 |
package name such as Foo::Bar, with double colons (::) and so on. |
| 1811 |
.PP |
| 1812 |
It also looks for a description in the source code, to make the plugin editor |
| 1813 |
more human-friendly. The description is a comment line of the form \*(L"# |
| 1814 |
description: Foo\*(R", where \*(L"Foo\*(R" is the text innotop will consider to be the |
| 1815 |
plugin's description. |
| 1816 |
.SS "Plugin Interface" |
| 1817 |
.IX Subsection "Plugin Interface" |
| 1818 |
The innotop plugin interface is quite simple: innotop expects the plugin to be |
| 1819 |
an object-oriented module it can call certain methods on. The methods are |
| 1820 |
.IP "new(%variables)" 4 |
| 1821 |
.IX Item "new(%variables)" |
| 1822 |
This is the plugin's constructor. It is passed a hash of innotop's variables, |
| 1823 |
which it can manipulate (see \*(L"Plugin Variables\*(R"). It must return a reference |
| 1824 |
to the newly created plugin object. |
| 1825 |
.Sp |
| 1826 |
At construction time, innotop has only loaded the general configuration and |
| 1827 |
created the default built-in variables with their default contents (which is |
| 1828 |
quite a lot). Therefore, the state of the program is exactly as in the innotop |
| 1829 |
source code, plus the configuration variables from the \*(L"general\*(R" section in |
| 1830 |
the config file. |
| 1831 |
.Sp |
| 1832 |
If your plugin manipulates the variables, it is changing global data, which is |
| 1833 |
shared by innotop and all plugins. Plugins are loaded in the order they're |
| 1834 |
listed in the config file. Your plugin may load before or after another plugin, |
| 1835 |
so there is a potential for conflict or interaction between plugins if they |
| 1836 |
modify data other plugins use or modify. |
| 1837 |
.IP "\fIregister_for_events()\fR" 4 |
| 1838 |
.IX Item "register_for_events()" |
| 1839 |
This method must return a list of events in which the plugin is interested, if |
| 1840 |
any. See \*(L"Plugin Events\*(R" for the defined events. If the plugin returns an |
| 1841 |
event that's not defined, the event is ignored. |
| 1842 |
.IP "event handlers" 4 |
| 1843 |
.IX Item "event handlers" |
| 1844 |
The plugin must implement a method named the same as each event for which it has |
| 1845 |
registered. In other words, if the plugin returns qw(foo bar) from |
| 1846 |
\&\fIregister_for_events()\fR, it must have \fIfoo()\fR and \fIbar()\fR methods. These methods are |
| 1847 |
callbacks for the events. See \*(L"Plugin Events\*(R" for more details about each |
| 1848 |
event. |
| 1849 |
.SS "Plugin Variables" |
| 1850 |
.IX Subsection "Plugin Variables" |
| 1851 |
The plugin's constructor is passed a hash of innotop's variables, which it can |
| 1852 |
manipulate. It is probably a good idea if the plugin object saves a copy of it |
| 1853 |
for later use. The variables are defined in the innotop variable |
| 1854 |
\&\f(CW%pluggable_vars\fR, and are as follows: |
| 1855 |
.IP "action_for" 4 |
| 1856 |
.IX Item "action_for" |
| 1857 |
A hashref of key mappings. These are innotop's global hot-keys. |
| 1858 |
.IP "agg_funcs" 4 |
| 1859 |
.IX Item "agg_funcs" |
| 1860 |
A hashref of functions that can be used for grouping. See \*(L"\s-1GROUPING\*(R"\s0. |
| 1861 |
.IP "config" 4 |
| 1862 |
.IX Item "config" |
| 1863 |
The global configuration hash. |
| 1864 |
.IP "connections" 4 |
| 1865 |
.IX Item "connections" |
| 1866 |
A hashref of connection specifications. These are just specifications of how to |
| 1867 |
connect to a server. |
| 1868 |
.IP "dbhs" 4 |
| 1869 |
.IX Item "dbhs" |
| 1870 |
A hashref of innotop's database connections. These are actual \s-1DBI\s0 connection |
| 1871 |
objects. |
| 1872 |
.IP "filters" 4 |
| 1873 |
.IX Item "filters" |
| 1874 |
A hashref of filters applied to table rows. See \*(L"\s-1FILTERS\*(R"\s0 for more. |
| 1875 |
.IP "modes" 4 |
| 1876 |
.IX Item "modes" |
| 1877 |
A hashref of modes. See \*(L"\s-1MODES\*(R"\s0 for more. |
| 1878 |
.IP "server_groups" 4 |
| 1879 |
.IX Item "server_groups" |
| 1880 |
A hashref of server groups. See \*(L"\s-1SERVER GROUPS\*(R"\s0. |
| 1881 |
.IP "tbl_meta" 4 |
| 1882 |
.IX Item "tbl_meta" |
| 1883 |
A hashref of innotop's table meta-data, with one entry per table (see |
| 1884 |
\&\*(L"\s-1TABLES\*(R"\s0 for more information). |
| 1885 |
.IP "trans_funcs" 4 |
| 1886 |
.IX Item "trans_funcs" |
| 1887 |
A hashref of transformation functions. See \*(L"\s-1TRANSFORMATIONS\*(R"\s0. |
| 1888 |
.IP "var_sets" 4 |
| 1889 |
.IX Item "var_sets" |
| 1890 |
A hashref of variable sets. See \*(L"\s-1VARIABLE SETS\*(R"\s0. |
| 1891 |
.SS "Plugin Events" |
| 1892 |
.IX Subsection "Plugin Events" |
| 1893 |
Each event is defined somewhere in the innotop source code. When innotop runs |
| 1894 |
that code, it executes the callback function for each plugin that expressed its |
| 1895 |
interest in the event. innotop passes some data for each event. The events are |
| 1896 |
defined in the \f(CW%event_listener_for\fR variable, and are as follows: |
| 1897 |
.ie n .IP "extract_values($set, $cur, $pre, $tbl)" 4 |
| 1898 |
.el .IP "extract_values($set, \f(CW$cur\fR, \f(CW$pre\fR, \f(CW$tbl\fR)" 4 |
| 1899 |
.IX Item "extract_values($set, $cur, $pre, $tbl)" |
| 1900 |
This event occurs inside the function that extracts values from a data source. |
| 1901 |
The arguments are the set of values, the current values, the previous values, |
| 1902 |
and the table name. |
| 1903 |
.IP "set_to_tbl" 4 |
| 1904 |
.IX Item "set_to_tbl" |
| 1905 |
Events are defined at many places in this subroutine, which is responsible for |
| 1906 |
turning an arrayref of hashrefs into an arrayref of lines that can be printed to |
| 1907 |
the screen. The events all pass the same data: an arrayref of rows and the name |
| 1908 |
of the table being created. The events are set_to_tbl_pre_filter, |
| 1909 |
set_to_tbl_pre_sort,set_to_tbl_pre_group, set_to_tbl_pre_colorize, |
| 1910 |
set_to_tbl_pre_transform, set_to_tbl_pre_pivot, set_to_tbl_pre_create, |
| 1911 |
set_to_tbl_post_create. |
| 1912 |
.IP "draw_screen($lines)" 4 |
| 1913 |
.IX Item "draw_screen($lines)" |
| 1914 |
This event occurs inside the subroutine that prints the lines to the screen. |
| 1915 |
\&\f(CW$lines\fR is an arrayref of strings. |
| 1916 |
.SS "Simple Plugin Example" |
| 1917 |
.IX Subsection "Simple Plugin Example" |
| 1918 |
The easiest way to explain the plugin functionality is probably with a simple |
| 1919 |
example. The following module adds a column to the beginning of every table and |
| 1920 |
sets its value to 1. (If you copy and paste this example code, be sure to remove |
| 1921 |
the first space from each line; lines such as '# description' must not start with |
| 1922 |
whitespace). |
| 1923 |
.PP |
| 1924 |
.Vb 2 |
| 1925 |
\& use strict; |
| 1926 |
\& use warnings FATAL => \*(Aqall\*(Aq; |
| 1927 |
\& |
| 1928 |
\& package Innotop::Plugin::Example; |
| 1929 |
\& # description: Adds an \*(Aqexample\*(Aq column to every table |
| 1930 |
\& |
| 1931 |
\& sub new { |
| 1932 |
\& my ( $class, %vars ) = @_; |
| 1933 |
\& # Store reference to innotop\*(Aqs variables in $self |
| 1934 |
\& my $self = bless { %vars }, $class; |
| 1935 |
\& |
| 1936 |
\& # Design the example column |
| 1937 |
\& my $col = { |
| 1938 |
\& hdr => \*(AqExample\*(Aq, |
| 1939 |
\& just => \*(Aq\*(Aq, |
| 1940 |
\& dec => 0, |
| 1941 |
\& num => 1, |
| 1942 |
\& label => \*(AqExample\*(Aq, |
| 1943 |
\& src => \*(Aqexample\*(Aq, # Get data from this column in the data source |
| 1944 |
\& tbl => \*(Aq\*(Aq, |
| 1945 |
\& trans => [], |
| 1946 |
\& }; |
| 1947 |
\& |
| 1948 |
\& # Add the column to every table. |
| 1949 |
\& my $tbl_meta = $vars{tbl_meta}; |
| 1950 |
\& foreach my $tbl ( values %$tbl_meta ) { |
| 1951 |
\& # Add the column to the list of defined columns |
| 1952 |
\& $tbl\->{cols}\->{example} = $col; |
| 1953 |
\& # Add the column to the list of visible columns |
| 1954 |
\& unshift @{$tbl\->{visible}}, \*(Aqexample\*(Aq; |
| 1955 |
\& } |
| 1956 |
\& |
| 1957 |
\& # Be sure to return a reference to the object. |
| 1958 |
\& return $self; |
| 1959 |
\& } |
| 1960 |
\& |
| 1961 |
\& # I\*(Aqd like to be called when a data set is being rendered into a table, please. |
| 1962 |
\& sub register_for_events { |
| 1963 |
\& my ( $self ) = @_; |
| 1964 |
\& return qw(set_to_tbl_pre_filter); |
| 1965 |
\& } |
| 1966 |
\& |
| 1967 |
\& # This method will be called when the event fires. |
| 1968 |
\& sub set_to_tbl_pre_filter { |
| 1969 |
\& my ( $self, $rows, $tbl ) = @_; |
| 1970 |
\& # Set the example column\*(Aqs data source to the value 1. |
| 1971 |
\& foreach my $row ( @$rows ) { |
| 1972 |
\& $row\->{example} = 1; |
| 1973 |
\& } |
| 1974 |
\& } |
| 1975 |
\& |
| 1976 |
\& 1; |
| 1977 |
.Ve |
| 1978 |
.SS "Plugin Editor" |
| 1979 |
.IX Subsection "Plugin Editor" |
| 1980 |
The plugin editor lets you view the plugins innotop discovered and activate or |
| 1981 |
deactivate them. Start the editor by pressing $ to start the configuration |
| 1982 |
editor from any mode. Press the 'p' key to start the plugin editor. You'll see |
| 1983 |
a list of plugins innotop discovered. You can use the 'j' and 'k' keys to move |
| 1984 |
the highlight to the desired one, then press the * key to toggle it active or |
| 1985 |
inactive. Exit the editor and restart innotop for the changes to take effect. |
| 1986 |
.SH "SQL STATEMENTS" |
| 1987 |
.IX Header "SQL STATEMENTS" |
| 1988 |
innotop uses a limited set of \s-1SQL\s0 statements to retrieve data from MySQL for |
| 1989 |
display. The statements are customized depending on the server version against |
| 1990 |
which they are executed; for example, on MySQL 5 and newer, \s-1INNODB_STATUS\s0 |
| 1991 |
executes \*(L"\s-1SHOW ENGINE INNODB STATUS\*(R",\s0 while on earlier versions it executes |
| 1992 |
\&\*(L"\s-1SHOW INNODB STATUS\*(R". \s0 The statements are as follows: |
| 1993 |
.PP |
| 1994 |
.Vb 10 |
| 1995 |
\& Statement SQL executed |
| 1996 |
\& =================== =============================== |
| 1997 |
\& INDEX_STATISTICS SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS |
| 1998 |
\& INNODB_STATUS SHOW [ENGINE] INNODB STATUS |
| 1999 |
\& KILL_CONNECTION KILL |
| 2000 |
\& KILL_QUERY KILL QUERY |
| 2001 |
\& OPEN_TABLES SHOW OPEN TABLES |
| 2002 |
\& PROCESSLIST SHOW FULL PROCESSLIST |
| 2003 |
\& SHOW_MASTER_LOGS SHOW MASTER LOGS |
| 2004 |
\& SHOW_MASTER_STATUS SHOW MASTER STATUS |
| 2005 |
\& SHOW_SLAVE_STATUS SHOW SLAVE STATUS |
| 2006 |
\& SHOW_STATUS SHOW [GLOBAL] STATUS |
| 2007 |
\& SHOW_VARIABLES SHOW [GLOBAL] VARIABLES |
| 2008 |
\& TABLE_STATISTICS SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS |
| 2009 |
.Ve |
| 2010 |
.SH "DATA SOURCES" |
| 2011 |
.IX Header "DATA SOURCES" |
| 2012 |
Each time innotop extracts values to create a table (see \*(L"\s-1EXPRESSIONS\*(R"\s0 and |
| 2013 |
\&\*(L"\s-1TABLES\*(R"\s0), it does so from a particular data source. Largely because of the |
| 2014 |
complex data extracted from \s-1SHOW INNODB STATUS,\s0 this is slightly messy. \s-1SHOW |
| 2015 |
INNODB STATUS\s0 contains a mixture of single values and repeated values that form |
| 2016 |
nested data sets. |
| 2017 |
.PP |
| 2018 |
Whenever innotop fetches data from MySQL, it adds two extra bits to each set: |
| 2019 |
cxn and Uptime_hires. cxn is the name of the connection from which the data |
| 2020 |
came. Uptime_hires is a high-resolution version of the server's Uptime status |
| 2021 |
variable, which is important if your \*(L"interval\*(R" setting is sub-second. |
| 2022 |
.PP |
| 2023 |
Here are the kinds of data sources from which data is extracted: |
| 2024 |
.IP "\s-1STATUS_VARIABLES\s0" 4 |
| 2025 |
.IX Item "STATUS_VARIABLES" |
| 2026 |
This is the broadest category, into which the most kinds of data fall. It |
| 2027 |
begins with the combination of \s-1SHOW STATUS\s0 and \s-1SHOW VARIABLES,\s0 but other sources |
| 2028 |
may be included as needed, for example, \s-1SHOW MASTER STATUS\s0 and \s-1SHOW SLAVE |
| 2029 |
STATUS,\s0 as well as many of the non-repeated values from \s-1SHOW INNODB STATUS.\s0 |
| 2030 |
.IP "\s-1DEADLOCK_LOCKS\s0" 4 |
| 2031 |
.IX Item "DEADLOCK_LOCKS" |
| 2032 |
This data is extracted from the transaction list in the \s-1LATEST DETECTED DEADLOCK\s0 |
| 2033 |
section of \s-1SHOW INNODB STATUS. \s0 It is nested two levels deep: transactions, then |
| 2034 |
locks. |
| 2035 |
.IP "\s-1DEADLOCK_TRANSACTIONS\s0" 4 |
| 2036 |
.IX Item "DEADLOCK_TRANSACTIONS" |
| 2037 |
This data is from the transaction list in the \s-1LATEST DETECTED DEADLOCK\s0 |
| 2038 |
section of \s-1SHOW INNODB STATUS. \s0 It is nested one level deep. |
| 2039 |
.IP "\s-1EXPLAIN\s0" 4 |
| 2040 |
.IX Item "EXPLAIN" |
| 2041 |
This data is from the result set returned by \s-1EXPLAIN.\s0 |
| 2042 |
.IP "\s-1INNODB_BLOCKED_BLOCKER\s0" 4 |
| 2043 |
.IX Item "INNODB_BLOCKED_BLOCKER" |
| 2044 |
This data is from the \s-1INFORMATION_SCHEMA\s0 tables related to InnoDB locks and |
| 2045 |
the processlist. |
| 2046 |
.IP "\s-1INNODB_TRANSACTIONS\s0" 4 |
| 2047 |
.IX Item "INNODB_TRANSACTIONS" |
| 2048 |
This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW INNODB STATUS.\s0 |
| 2049 |
.IP "\s-1IO_THREADS\s0" 4 |
| 2050 |
.IX Item "IO_THREADS" |
| 2051 |
This data is from the list of threads in the \s-1FILE I/O\s0 section of \s-1SHOW INNODB |
| 2052 |
STATUS.\s0 |
| 2053 |
.IP "\s-1INNODB_LOCKS\s0" 4 |
| 2054 |
.IX Item "INNODB_LOCKS" |
| 2055 |
This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW INNODB STATUS\s0 and is nested |
| 2056 |
two levels deep. |
| 2057 |
.IP "\s-1MASTER_SLAVE\s0" 4 |
| 2058 |
.IX Item "MASTER_SLAVE" |
| 2059 |
This data is from the combination of \s-1SHOW MASTER STATUS\s0 and \s-1SHOW SLAVE STATUS.\s0 |
| 2060 |
.IP "\s-1OPEN_TABLES\s0" 4 |
| 2061 |
.IX Item "OPEN_TABLES" |
| 2062 |
This data is from \s-1SHOW OPEN TABLES.\s0 |
| 2063 |
.IP "\s-1PROCESSLIST\s0" 4 |
| 2064 |
.IX Item "PROCESSLIST" |
| 2065 |
This data is from \s-1SHOW FULL PROCESSLIST.\s0 |
| 2066 |
.IP "\s-1PROCESSLIST_STATS\s0" 4 |
| 2067 |
.IX Item "PROCESSLIST_STATS" |
| 2068 |
This data is from \s-1SHOW FULL PROCESSLIST\s0 and computes stats such as the maximum time |
| 2069 |
a user query has been running, and how many user queries are running. A \*(L"user |
| 2070 |
query\*(R" excludes replication threads. |
| 2071 |
.IP "\s-1OS_WAIT_ARRAY\s0" 4 |
| 2072 |
.IX Item "OS_WAIT_ARRAY" |
| 2073 |
This data is from the \s-1SEMAPHORES\s0 section of \s-1SHOW INNODB STATUS\s0 and is nested one |
| 2074 |
level deep. It comes from the lines that look like this: |
| 2075 |
.Sp |
| 2076 |
.Vb 1 |
| 2077 |
\& \-\-Thread 1568861104 has waited at btr0cur.c line 424 .... |
| 2078 |
.Ve |
| 2079 |
.SH "MYSQL PRIVILEGES" |
| 2080 |
.IX Header "MYSQL PRIVILEGES" |
| 2081 |
.IP "\(bu" 4 |
| 2082 |
You must connect to MySQL as a user who has the \s-1SUPER\s0 privilege for many of the |
| 2083 |
functions. |
| 2084 |
.IP "\(bu" 4 |
| 2085 |
If you don't have the \s-1SUPER\s0 privilege, you can still run some functions, but you |
| 2086 |
won't necessarily see all the same data. |
| 2087 |
.IP "\(bu" 4 |
| 2088 |
You need the \s-1PROCESS\s0 privilege to see the list of currently running queries in Q |
| 2089 |
mode. |
| 2090 |
.IP "\(bu" 4 |
| 2091 |
You need special privileges to start and stop slave servers. |
| 2092 |
.IP "\(bu" 4 |
| 2093 |
You need appropriate privileges to create and drop the deadlock tables if needed |
| 2094 |
(see \*(L"\s-1SERVER CONNECTIONS\*(R"\s0). |
| 2095 |
.SH "SYSTEM REQUIREMENTS" |
| 2096 |
.IX Header "SYSTEM REQUIREMENTS" |
| 2097 |
You need Perl to run innotop, of course. You also need a few Perl modules: \s-1DBI,\s0 |
| 2098 |
DBD::MariaDB, Term::ReadKey, and Time::HiRes. These should be included with most |
| 2099 |
Perl distributions, but in case they are not, I recommend using versions |
| 2100 |
distributed with your operating system or Perl distribution, not from \s-1CPAN.\s0 |
| 2101 |
Term::ReadKey in particular has been known to cause problems if installed from |
| 2102 |
\&\s-1CPAN.\s0 |
| 2103 |
.PP |
| 2104 |
If you have Term::ANSIColor, innotop will use it to format headers more readably |
| 2105 |
and compactly. (Under Microsoft Windows, you also need Win32::Console::ANSI for |
| 2106 |
terminal formatting codes to be honored). If you install Term::ReadLine, |
| 2107 |
preferably Term::ReadLine::Gnu, you'll get nice auto-completion support. |
| 2108 |
.PP |
| 2109 |
I run innotop on Gentoo GNU/Linux, Debian and Ubuntu, and I've had feedback from |
| 2110 |
people successfully running it on Red Hat, CentOS, Solaris, and Mac \s-1OSX. I\s0 |
| 2111 |
don't see any reason why it won't work on other UNIX-ish operating systems, but |
| 2112 |
I don't know for sure. It also runs on Windows under ActivePerl without |
| 2113 |
problem. |
| 2114 |
.PP |
| 2115 |
innotop has been used on MySQL versions 3.23.58, 4.0.27, 4.1.0, 4.1.22, 5.0.26, |
| 2116 |
5.1.15, and 5.2.3. If it doesn't run correctly for you, that is a bug that |
| 2117 |
should be reported. |
| 2118 |
.SH "FILES" |
| 2119 |
.IX Header "FILES" |
| 2120 |
\&\f(CW$HOMEDIR\fR/.innotop and/or /etc/innotop are used to store |
| 2121 |
configuration information. Files include the configuration file innotop.conf, |
| 2122 |
the core_dump file which contains verbose error messages if \*(L"debug\*(R" is |
| 2123 |
enabled, and the plugins/ subdirectory. |
| 2124 |
.SH "GLOSSARY OF TERMS" |
| 2125 |
.IX Header "GLOSSARY OF TERMS" |
| 2126 |
.IP "tick" 4 |
| 2127 |
.IX Item "tick" |
| 2128 |
A tick is a refresh event, when innotop re-fetches data from connections and |
| 2129 |
displays it. |
| 2130 |
.SH "ACKNOWLEDGEMENTS" |
| 2131 |
.IX Header "ACKNOWLEDGEMENTS" |
| 2132 |
The following people and organizations are acknowledged for various reasons. |
| 2133 |
Hopefully no one has been forgotten. |
| 2134 |
.PP |
| 2135 |
Aaron Racine, |
| 2136 |
Allen K. Smith, |
| 2137 |
Aurimas Mikalauskas, |
| 2138 |
Bartosz Fenski, |
| 2139 |
Brian Miezejewski, |
| 2140 |
Christian Hammers, |
| 2141 |
Cyril Scetbon, |
| 2142 |
Dane Miller, |
| 2143 |
David Multer, |
| 2144 |
Dr. Frank Ullrich, |
| 2145 |
Giuseppe Maxia, |
| 2146 |
Google.com Site Reliability Engineers, |
| 2147 |
Google Code, |
| 2148 |
Jan Pieter Kunst, |
| 2149 |
Jari Aalto, |
| 2150 |
Jay Pipes, |
| 2151 |
Jeremy Zawodny, |
| 2152 |
Johan Idren, |
| 2153 |
Kristian Kohntopp, |
| 2154 |
Lenz Grimmer, |
| 2155 |
Maciej Dobrzanski, |
| 2156 |
Michiel Betel, |
| 2157 |
MySQL \s-1AB,\s0 |
| 2158 |
Paul McCullagh, |
| 2159 |
Sebastien Estienne, |
| 2160 |
Sourceforge.net, |
| 2161 |
Steven Kreuzer, |
| 2162 |
The Gentoo MySQL Team, |
| 2163 |
Trevor Price, |
| 2164 |
Yaar Schnitman, |
| 2165 |
and probably more people that have not been included. |
| 2166 |
.PP |
| 2167 |
(If your name has been misspelled, it's probably out of fear of putting |
| 2168 |
international characters into this documentation; earlier versions of Perl might |
| 2169 |
not be able to compile it then). |
| 2170 |
.SH "COPYRIGHT, LICENSE AND WARRANTY" |
| 2171 |
.IX Header "COPYRIGHT, LICENSE AND WARRANTY" |
| 2172 |
This program is copyright (c) 2006 Baron Schwartz. |
| 2173 |
Feedback and improvements are welcome. |
| 2174 |
.PP |
| 2175 |
\&\s-1THIS PROGRAM IS PROVIDED \*(L"AS IS\*(R" AND WITHOUT ANY EXPRESS OR IMPLIED |
| 2176 |
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
| 2177 |
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\s0 |
| 2178 |
.PP |
| 2179 |
This program is free software; you can redistribute it and/or modify it under |
| 2180 |
the terms of the \s-1GNU\s0 General Public License as published by the Free Software |
| 2181 |
Foundation, version 2; \s-1OR\s0 the Perl Artistic License. On \s-1UNIX\s0 and similar |
| 2182 |
systems, you can issue `man perlgpl' or `man perlartistic' to read these |
| 2183 |
licenses. |
| 2184 |
.PP |
| 2185 |
You should have received a copy of the \s-1GNU\s0 General Public License along with |
| 2186 |
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin |
| 2187 |
Street, Fifth Floor, Boston, \s-1MA 02110-1335 USA\s0. |
| 2188 |
.PP |
| 2189 |
Execute innotop and press '!' to see this information at any time. |
| 2190 |
.SH "AUTHOR" |
| 2191 |
.IX Header "AUTHOR" |
| 2192 |
Originally written by Baron Schwartz; currently maintained by Aaron Racine. |
| 2193 |
.SH "BUGS" |
| 2194 |
.IX Header "BUGS" |
| 2195 |
You can report bugs, ask for improvements, and get other help and support at |
| 2196 |
<https://github.com/innotop/innotop>. There are mailing lists, a source code |
| 2197 |
browser, a bug tracker, etc. Please use these instead of contacting the |
| 2198 |
maintainer or author directly, as it makes our job easier and benefits others if the |
| 2199 |
discussions are permanent and public. Of course, if you need to contact us in |
| 2200 |
private, please do. |