2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * displays status variables with descriptions and some hints an optmizing
5 * + reset status variables
11 * no need for variables importing
14 if (! defined('PMA_NO_VARIABLES_IMPORT')) {
15 define('PMA_NO_VARIABLES_IMPORT', true);
17 require_once './libraries/common.inc.php';
19 $GLOBALS['js_include'][] = 'pMap.js';
22 * Does the common work
24 require './libraries/server_common.inc.php';
30 require './libraries/server_links.inc.php';
35 require './libraries/replication.inc.php';
36 require_once './libraries/replication_gui.lib.php';
41 require_once './libraries/chart.lib.php';
44 * Messages are built using the message name
46 $strShowStatusBinlog_cache_disk_useDescr = __('The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction.');
47 $strShowStatusBinlog_cache_useDescr = __('The number of transactions that used the temporary binary log cache.');
48 $strShowStatusCreated_tmp_disk_tablesDescr = __('The number of temporary tables on disk created automatically by the server while executing statements. If Created_tmp_disk_tables is big, you may want to increase the tmp_table_size value to cause temporary tables to be memory-based instead of disk-based.');
49 $strShowStatusCreated_tmp_filesDescr = __('How many temporary files mysqld has created.');
50 $strShowStatusCreated_tmp_tablesDescr = __('The number of in-memory temporary tables created automatically by the server while executing statements.');
51 $strShowStatusDelayed_errorsDescr = __('The number of rows written with INSERT DELAYED for which some error occurred (probably duplicate key).');
52 $strShowStatusDelayed_insert_threadsDescr = __('The number of INSERT DELAYED handler threads in use. Every different table on which one uses INSERT DELAYED gets its own thread.');
53 $strShowStatusDelayed_writesDescr = __('The number of INSERT DELAYED rows written.');
54 $strShowStatusFlush_commandsDescr = __('The number of executed FLUSH statements.');
55 $strShowStatusHandler_commitDescr = __('The number of internal COMMIT statements.');
56 $strShowStatusHandler_deleteDescr = __('The number of times a row was deleted from a table.');
57 $strShowStatusHandler_discoverDescr = __('The MySQL server can ask the NDB Cluster storage engine if it knows about a table with a given name. This is called discovery. Handler_discover indicates the number of time tables have been discovered.');
58 $strShowStatusHandler_read_firstDescr = __('The number of times the first entry was read from an index. If this is high, it suggests that the server is doing a lot of full index scans; for example, SELECT col1 FROM foo, assuming that col1 is indexed.');
59 $strShowStatusHandler_read_keyDescr = __('The number of requests to read a row based on a key. If this is high, it is a good indication that your queries and tables are properly indexed.');
60 $strShowStatusHandler_read_nextDescr = __('The number of requests to read the next row in key order. This is incremented if you are querying an index column with a range constraint or if you are doing an index scan.');
61 $strShowStatusHandler_read_prevDescr = __('The number of requests to read the previous row in key order. This read method is mainly used to optimize ORDER BY ... DESC.');
62 $strShowStatusHandler_read_rndDescr = __('The number of requests to read a row based on a fixed position. This is high if you are doing a lot of queries that require sorting of the result. You probably have a lot of queries that require MySQL to scan whole tables or you have joins that don\'t use keys properly.');
63 $strShowStatusHandler_read_rnd_nextDescr = __('The number of requests to read the next row in the data file. This is high if you are doing a lot of table scans. Generally this suggests that your tables are not properly indexed or that your queries are not written to take advantage of the indexes you have.');
64 $strShowStatusHandler_rollbackDescr = __('The number of internal ROLLBACK statements.');
65 $strShowStatusHandler_updateDescr = __('The number of requests to update a row in a table.');
66 $strShowStatusHandler_writeDescr = __('The number of requests to insert a row in a table.');
67 $strShowStatusInnodb_buffer_pool_pages_dataDescr = __('The number of pages containing data (dirty or clean).');
68 $strShowStatusInnodb_buffer_pool_pages_dirtyDescr = __('The number of pages currently dirty.');
69 $strShowStatusInnodb_buffer_pool_pages_flushedDescr = __('The number of buffer pool pages that have been requested to be flushed.');
70 $strShowStatusInnodb_buffer_pool_pages_freeDescr = __('The number of free pages.');
71 $strShowStatusInnodb_buffer_pool_pages_latchedDescr = __('The number of latched pages in InnoDB buffer pool. These are pages currently being read or written or that can\'t be flushed or removed for some other reason.');
72 $strShowStatusInnodb_buffer_pool_pages_miscDescr = __('The number of pages busy because they have been allocated for administrative overhead such as row locks or the adaptive hash index. This value can also be calculated as Innodb_buffer_pool_pages_total - Innodb_buffer_pool_pages_free - Innodb_buffer_pool_pages_data.');
73 $strShowStatusInnodb_buffer_pool_pages_totalDescr = __('Total size of buffer pool, in pages.');
74 $strShowStatusInnodb_buffer_pool_read_ahead_rndDescr = __('The number of "random" read-aheads InnoDB initiated. This happens when a query is to scan a large portion of a table but in random order.');
75 $strShowStatusInnodb_buffer_pool_read_ahead_seqDescr = __('The number of sequential read-aheads InnoDB initiated. This happens when InnoDB does a sequential full table scan.');
76 $strShowStatusInnodb_buffer_pool_read_requestsDescr = __('The number of logical read requests InnoDB has done.');
77 $strShowStatusInnodb_buffer_pool_readsDescr = __('The number of logical reads that InnoDB could not satisfy from buffer pool and had to do a single-page read.');
78 $strShowStatusInnodb_buffer_pool_wait_freeDescr = __('Normally, writes to the InnoDB buffer pool happen in the background. However, if it\'s necessary to read or create a page and no clean pages are available, it\'s necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size was set properly, this value should be small.');
79 $strShowStatusInnodb_buffer_pool_write_requestsDescr = __('The number writes done to the InnoDB buffer pool.');
80 $strShowStatusInnodb_data_fsyncsDescr = __('The number of fsync() operations so far.');
81 $strShowStatusInnodb_data_pending_fsyncsDescr = __('The current number of pending fsync() operations.');
82 $strShowStatusInnodb_data_pending_readsDescr = __('The current number of pending reads.');
83 $strShowStatusInnodb_data_pending_writesDescr = __('The current number of pending writes.');
84 $strShowStatusInnodb_data_readDescr = __('The amount of data read so far, in bytes.');
85 $strShowStatusInnodb_data_readsDescr = __('The total number of data reads.');
86 $strShowStatusInnodb_data_writesDescr = __('The total number of data writes.');
87 $strShowStatusInnodb_data_writtenDescr = __('The amount of data written so far, in bytes.');
88 $strShowStatusInnodb_dblwr_pages_writtenDescr = __('The number of pages that have been written for doublewrite operations.');
89 $strShowStatusInnodb_dblwr_writesDescr = __('The number of doublewrite operations that have been performed.');
90 $strShowStatusInnodb_log_waitsDescr = __('The number of waits we had because log buffer was too small and we had to wait for it to be flushed before continuing.');
91 $strShowStatusInnodb_log_write_requestsDescr = __('The number of log write requests.');
92 $strShowStatusInnodb_log_writesDescr = __('The number of physical writes to the log file.');
93 $strShowStatusInnodb_os_log_fsyncsDescr = __('The number of fsync() writes done to the log file.');
94 $strShowStatusInnodb_os_log_pending_fsyncsDescr = __('The number of pending log file fsyncs.');
95 $strShowStatusInnodb_os_log_pending_writesDescr = __('Pending log file writes.');
96 $strShowStatusInnodb_os_log_writtenDescr = __('The number of bytes written to the log file.');
97 $strShowStatusInnodb_pages_createdDescr = __('The number of pages created.');
98 $strShowStatusInnodb_page_sizeDescr = __('The compiled-in InnoDB page size (default 16KB). Many values are counted in pages; the page size allows them to be easily converted to bytes.');
99 $strShowStatusInnodb_pages_readDescr = __('The number of pages read.');
100 $strShowStatusInnodb_pages_writtenDescr = __('The number of pages written.');
101 $strShowStatusInnodb_row_lock_current_waitsDescr = __('The number of row locks currently being waited for.');
102 $strShowStatusInnodb_row_lock_time_avgDescr = __('The average time to acquire a row lock, in milliseconds.');
103 $strShowStatusInnodb_row_lock_timeDescr = __('The total time spent in acquiring row locks, in milliseconds.');
104 $strShowStatusInnodb_row_lock_time_maxDescr = __('The maximum time to acquire a row lock, in milliseconds.');
105 $strShowStatusInnodb_row_lock_waitsDescr = __('The number of times a row lock had to be waited for.');
106 $strShowStatusInnodb_rows_deletedDescr = __('The number of rows deleted from InnoDB tables.');
107 $strShowStatusInnodb_rows_insertedDescr = __('The number of rows inserted in InnoDB tables.');
108 $strShowStatusInnodb_rows_readDescr = __('The number of rows read from InnoDB tables.');
109 $strShowStatusInnodb_rows_updatedDescr = __('The number of rows updated in InnoDB tables.');
110 $strShowStatusKey_blocks_not_flushedDescr = __('The number of key blocks in the key cache that have changed but haven\'t yet been flushed to disk. It used to be known as Not_flushed_key_blocks.');
111 $strShowStatusKey_blocks_unusedDescr = __('The number of unused blocks in the key cache. You can use this value to determine how much of the key cache is in use.');
112 $strShowStatusKey_blocks_usedDescr = __('The number of used blocks in the key cache. This value is a high-water mark that indicates the maximum number of blocks that have ever been in use at one time.');
113 $strShowStatusKey_read_requestsDescr = __('The number of requests to read a key block from the cache.');
114 $strShowStatusKey_readsDescr = __('The number of physical reads of a key block from disk. If Key_reads is big, then your key_buffer_size value is probably too small. The cache miss rate can be calculated as Key_reads/Key_read_requests.');
115 $strShowStatusKey_write_requestsDescr = __('The number of requests to write a key block to the cache.');
116 $strShowStatusKey_writesDescr = __('The number of physical writes of a key block to disk.');
117 $strShowStatusLast_query_costDescr = __('The total cost of the last compiled query as computed by the query optimizer. Useful for comparing the cost of different query plans for the same query. The default value of 0 means that no query has been compiled yet.');
118 $strShowStatusNot_flushed_delayed_rowsDescr = __('The number of rows waiting to be written in INSERT DELAYED queues.');
119 $strShowStatusOpened_tablesDescr = __('The number of tables that have been opened. If opened tables is big, your table cache value is probably too small.');
120 $strShowStatusOpen_filesDescr = __('The number of files that are open.');
121 $strShowStatusOpen_streamsDescr = __('The number of streams that are open (used mainly for logging).');
122 $strShowStatusOpen_tablesDescr = __('The number of tables that are open.');
123 $strShowStatusQcache_free_blocksDescr = __('The number of free memory blocks in query cache.');
124 $strShowStatusQcache_free_memoryDescr = __('The amount of free memory for query cache.');
125 $strShowStatusQcache_hitsDescr = __('The number of cache hits.');
126 $strShowStatusQcache_insertsDescr = __('The number of queries added to the cache.');
127 $strShowStatusQcache_lowmem_prunesDescr = __('The number of queries that have been removed from the cache to free up memory for caching new queries. This information can help you tune the query cache size. The query cache uses a least recently used (LRU) strategy to decide which queries to remove from the cache.');
128 $strShowStatusQcache_not_cachedDescr = __('The number of non-cached queries (not cachable, or not cached due to the query_cache_type setting).');
129 $strShowStatusQcache_queries_in_cacheDescr = __('The number of queries registered in the cache.');
130 $strShowStatusQcache_total_blocksDescr = __('The total number of blocks in the query cache.');
131 $strShowStatusReset = _pgettext('$strShowStatusReset', 'Reset');
132 $strShowStatusRpl_statusDescr = __('The status of failsafe replication (not yet implemented).');
133 $strShowStatusSelect_full_joinDescr = __('The number of joins that do not use indexes. If this value is not 0, you should carefully check the indexes of your tables.');
134 $strShowStatusSelect_full_range_joinDescr = __('The number of joins that used a range search on a reference table.');
135 $strShowStatusSelect_range_checkDescr = __('The number of joins without keys that check for key usage after each row. (If this is not 0, you should carefully check the indexes of your tables.)');
136 $strShowStatusSelect_rangeDescr = __('The number of joins that used ranges on the first table. (It\'s normally not critical even if this is big.)');
137 $strShowStatusSelect_scanDescr = __('The number of joins that did a full scan of the first table.');
138 $strShowStatusSlave_open_temp_tablesDescr = __('The number of temporary tables currently open by the slave SQL thread.');
139 $strShowStatusSlave_retried_transactionsDescr = __('Total (since startup) number of times the replication slave SQL thread has retried transactions.');
140 $strShowStatusSlave_runningDescr = __('This is ON if this server is a slave that is connected to a master.');
141 $strShowStatusSlow_launch_threadsDescr = __('The number of threads that have taken more than slow_launch_time seconds to create.');
142 $strShowStatusSlow_queriesDescr = __('The number of queries that have taken more than long_query_time seconds.');
143 $strShowStatusSort_merge_passesDescr = __('The number of merge passes the sort algorithm has had to do. If this value is large, you should consider increasing the value of the sort_buffer_size system variable.');
144 $strShowStatusSort_rangeDescr = __('The number of sorts that were done with ranges.');
145 $strShowStatusSort_rowsDescr = __('The number of sorted rows.');
146 $strShowStatusSort_scanDescr = __('The number of sorts that were done by scanning the table.');
147 $strShowStatusTable_locks_immediateDescr = __('The number of times that a table lock was acquired immediately.');
148 $strShowStatusTable_locks_waitedDescr = __('The number of times that a table lock could not be acquired immediately and a wait was needed. If this is high, and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication.');
149 $strShowStatusThreads_cachedDescr = __('The number of threads in the thread cache. The cache hit rate can be calculated as Threads_created/Connections. If this value is red you should raise your thread_cache_size.');
150 $strShowStatusThreads_connectedDescr = __('The number of currently open connections.');
151 $strShowStatusThreads_createdDescr = __('The number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value. (Normally this doesn\'t give a notable performance improvement if you have a good thread implementation.)');
152 $strShowStatusThreads_runningDescr = __('The number of threads that are not sleeping.');
155 * Displays the sub-page heading
157 echo '<div id="serverstatus">' . "\n";
159 . ($GLOBALS['cfg']['MainPageIconic']
160 ?
'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] .
161 's_status.png" width="16" height="16" alt="" />'
163 . __('Runtime Information') . "\n"
168 * flush status variables if requested
170 if (isset($_REQUEST['flush'])) {
171 $_flush_commands = array(
177 if (in_array($_REQUEST['flush'], $_flush_commands)) {
178 PMA_DBI_query('FLUSH ' . $_REQUEST['flush'] . ';');
180 unset($_flush_commands);
185 * get status from server
187 $server_status = PMA_DBI_fetch_result('SHOW GLOBAL STATUS', 0, 1);
190 * for some calculations we require also some server settings
192 $server_variables = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES', 0, 1);
195 * starttime calculation
197 $start_time = PMA_DBI_fetch_value(
198 'SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime']);
202 * cleanup some deprecated values
205 'Com_prepare_sql' => 'Com_stmt_prepare',
206 'Com_execute_sql' => 'Com_stmt_execute',
207 'Com_dealloc_sql' => 'Com_stmt_close',
210 foreach ($deprecated as $old => $new) {
211 if (isset($server_status[$old])
212 && isset($server_status[$new])) {
213 unset($server_status[$old]);
220 * calculate some values
222 // Key_buffer_fraction
223 if (isset($server_status['Key_blocks_unused'])
224 && isset($server_variables['key_cache_block_size'])
225 && isset($server_variables['key_buffer_size'])) {
226 $server_status['Key_buffer_fraction_%'] =
228 - $server_status['Key_blocks_unused']
229 * $server_variables['key_cache_block_size']
230 / $server_variables['key_buffer_size']
233 isset($server_status['Key_blocks_used'])
234 && isset($server_variables['key_buffer_size'])) {
235 $server_status['Key_buffer_fraction_%'] =
236 $server_status['Key_blocks_used']
238 / $server_variables['key_buffer_size'];
241 // Ratio for key read/write
242 if (isset($server_status['Key_writes'])
243 && isset($server_status['Key_write_requests'])
244 && $server_status['Key_write_requests'] > 0)
245 $server_status['Key_write_ratio_%'] = 100 * $server_status['Key_writes'] / $server_status['Key_write_requests'];
247 if (isset($server_status['Key_reads'])
248 && isset($server_status['Key_read_requests'])
249 && $server_status['Key_read_requests'] > 0)
250 $server_status['Key_read_ratio_%'] = 100 * $server_status['Key_reads'] / $server_status['Key_read_requests'];
252 // Threads_cache_hitrate
253 if (isset($server_status['Threads_created'])
254 && isset($server_status['Connections'])
255 && $server_status['Connections'] > 0) {
256 $server_status['Threads_cache_hitrate_%'] =
258 - $server_status['Threads_created']
259 / $server_status['Connections']
263 // Format Uptime_since_flush_status : show as days, hours, minutes, seconds
264 if (isset($server_status['Uptime_since_flush_status'])) {
265 $server_status['Uptime_since_flush_status'] = PMA_timespanFormat($server_status['Uptime_since_flush_status']);
271 // name => max value before alert
274 // variable => max value
275 'Aborted_clients' => 0,
276 'Aborted_connects' => 0,
278 'Binlog_cache_disk_use' => 0,
280 'Created_tmp_disk_tables' => 0,
282 'Handler_read_rnd' => 0,
283 'Handler_read_rnd_next' => 0,
285 'Innodb_buffer_pool_pages_dirty' => 0,
286 'Innodb_buffer_pool_reads' => 0,
287 'Innodb_buffer_pool_wait_free' => 0,
288 'Innodb_log_waits' => 0,
289 'Innodb_row_lock_time_avg' => 10, // ms
290 'Innodb_row_lock_time_max' => 50, // ms
291 'Innodb_row_lock_waits' => 0,
294 'Delayed_errors' => 0,
295 'Select_full_join' => 0,
296 'Select_range_check' => 0,
297 'Sort_merge_passes' => 0,
298 'Opened_tables' => 0,
299 'Table_locks_waited' => 0,
300 'Qcache_lowmem_prunes' => 0,
301 'Slow_launch_threads' => 0,
303 // depends on Key_read_requests
304 // normaly lower then 1:0.01
305 'Key_reads' => (0.01 * $server_status['Key_read_requests']),
306 // depends on Key_write_requests
307 // normaly nearly 1:1
308 'Key_writes' => (0.9 * $server_status['Key_write_requests']),
310 'Key_buffer_fraction' => 0.5,
312 // alert if more than 95% of thread cache is in use
313 'Threads_cached' => 0.95 * $server_variables['thread_cache_size']
316 // variable => min value
317 //'Handler read key' => '> ',
322 * split variables in sections
324 $allocations = array(
325 // variable name => section
328 'Innodb_' => 'innodb',
330 'Handler_' => 'handler',
331 'Qcache_' => 'qcache',
332 'Threads_' => 'threads',
333 'Slow_launch_threads' => 'threads',
335 'Binlog_cache_' => 'binlog_cache',
336 'Created_tmp_' => 'created_tmp',
339 'Delayed_' => 'delayed',
340 'Not_flushed_delayed_rows' => 'delayed',
342 'Flush_commands' => 'query',
343 'Last_query_cost' => 'query',
344 'Slow_queries' => 'query',
345 'Queries' => 'query',
346 'Prepared_stmt_count' => 'query',
348 'Select_' => 'select',
351 'Open_tables' => 'table',
352 'Opened_tables' => 'table',
353 'Open_table_definitions' => 'table',
354 'Opened_table_definitions' => 'table',
355 'Table_locks_' => 'table',
357 'Rpl_status' => 'repl',
364 'Open_files' => 'files',
365 'Open_streams' => 'files',
366 'Opened_files' => 'files',
370 // section => section name (description)
371 'com' => array('title' => ''),
372 'query' => array('title' => __('SQL query')),
373 'innodb' => array('title' => 'InnoDB'),
374 'ndb' => array('title' => 'NDB'),
375 'handler' => array('title' => __('Handler')),
376 'qcache' => array('title' => __('Query cache')),
377 'threads' => array('title' => __('Threads')),
378 'binlog_cache' => array('title' => __('Binary log')),
379 'created_tmp' => array('title' => __('Temporary data')),
380 'delayed' => array('title' => __('Delayed inserts')),
381 'key' => array('title' => __('Key cache')),
382 'select' => array('title' => __('Joins')),
383 'repl' => array('title' => __('Replication')),
384 'sort' => array('title' => __('Sorting')),
385 'table' => array('title' => __('Tables')),
386 'tc' => array('title' => __('Transaction coordinator')),
387 'files' => array('title' => __('Files')),
388 'ssl' => array('title' => 'SSL'),
392 * define some needfull links/commands
394 // variable or section name => (name => url)
397 $links['table'][__('Flush (close) all tables')]
398 = $PMA_PHP_SELF . '?flush=TABLES&' . PMA_generate_common_url();
399 $links['table'][__('Show open tables')]
400 = 'sql.php?sql_query=' . urlencode('SHOW OPEN TABLES') .
401 '&goto=server_status.php&' . PMA_generate_common_url();
403 if ($server_master_status) {
404 $links['repl'][__('Show slave hosts')]
405 = 'sql.php?sql_query=' . urlencode('SHOW SLAVE HOSTS') .
406 '&goto=server_status.php&' . PMA_generate_common_url();
407 $links['repl'][__('Show master status')] = '#replication_master';
409 if ($server_slave_status) {
410 $links['repl'][__('Show slave status')] = '#replication_slave';
413 $links['repl']['doc'] = 'replication';
415 $links['qcache'][__('Flush query cache')]
416 = $PMA_PHP_SELF . '?flush=' . urlencode('QUERY CACHE') . '&' .
417 PMA_generate_common_url();
418 $links['qcache']['doc'] = 'query_cache';
420 $links['threads'][__('Show processes')]
421 = 'server_processlist.php?' . PMA_generate_common_url();
422 $links['threads']['doc'] = 'mysql_threads';
424 $links['key']['doc'] = 'myisam_key_cache';
426 $links['binlog_cache']['doc'] = 'binary_log';
428 $links['Slow_queries']['doc'] = 'slow_query_log';
430 $links['innodb'][__('Variables')]
431 = 'server_engines.php?engine=InnoDB&' . PMA_generate_common_url();
432 $links['innodb'][__('InnoDB Status')]
433 = 'server_engines.php?engine=InnoDB&page=Status&' .
434 PMA_generate_common_url();
435 $links['innodb']['doc'] = 'innodb';
438 // sort status vars into arrays
439 foreach ($server_status as $name => $value) {
440 if (isset($allocations[$name])) {
441 $sections[$allocations[$name]]['vars'][$name] = $value;
442 unset($server_status[$name]);
444 foreach ($allocations as $filter => $section) {
445 if (preg_match('/^' . $filter . '/', $name)
446 && isset($server_status[$name])) {
447 unset($server_status[$name]);
448 $sections[$section]['vars'][$name] = $value;
453 unset($name, $value, $filter, $section, $allocations);
456 $sections['all']['vars'] =& $server_status;
458 $hour_factor = 3600 / $server_status['Uptime'];
464 <div id
="statuslinks">
466 $PMA_PHP_SELF . '?' . PMA_generate_common_url(); ?>"
467 ><?php
echo __('Refresh'); ?
></a
>
469 $PMA_PHP_SELF . '?flush=STATUS&' . PMA_generate_common_url(); ?>"
470 ><?php
echo _pgettext('for Show status', 'Reset'); ?
></a
>
471 <?php
echo PMA_showMySQLDocu('server_status_variables','server_status_variables'); ?
>
476 echo sprintf(__('This MySQL server has been running for %s. It started up on %s.'),
477 PMA_timespanFormat($server_status['Uptime']),
478 PMA_localisedDate($start_time)) . "\n";
483 if ($server_master_status ||
$server_slave_status) {
485 if ($server_master_status && $server_slave_status) {
486 echo __('This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.');
487 } elseif ($server_master_status) {
488 echo __('This MySQL server works as <b>master</b> in <b>replication</b> process.');
489 } elseif ($server_slave_status) {
490 echo __('This MySQL server works as <b>slave</b> in <b>replication</b> process.');
492 echo __('For further information about replication status on the server, please visit the <a href=#replication>replication section</a>.');
497 <div id
="sectionlinks">
499 foreach ($sections as $section_name => $section) {
500 if (! empty($section['vars']) && ! empty($section['title'])) {
501 echo '<a href="' . $PMA_PHP_SELF . '?' .
502 PMA_generate_common_url() . '#' . $section_name . '">' .
503 $section['title'] . '</a>' . "\n";
509 <h3
><?php
echo __('<b>Server traffic</b>: These tables show the network traffic statistics of this MySQL server since its startup.'); ?
></h3
>
511 <table id
="serverstatustraffic" class="data">
514 <th colspan
="2"><?php
echo __('Traffic') . ' ' . PMA_showHint(__('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.')); ?
></th
>
515 <th
>ø
; <?php
echo __('per hour'); ?
></th
>
519 <tr
class="noclick odd">
520 <th
class="name"><?php
echo __('Received'); ?
></th
>
521 <td
class="value"><?php
echo
523 PMA_formatByteDown($server_status['Bytes_received'], 2, 1)); ?
></td
>
524 <td
class="value"><?php
echo
527 $server_status['Bytes_received'] * $hour_factor, 2, 1)); ?
></td
>
529 <tr
class="noclick even">
530 <th
class="name"><?php
echo __('Sent'); ?
></th
>
531 <td
class="value"><?php
echo
533 PMA_formatByteDown($server_status['Bytes_sent'], 2, 1)); ?
></td
>
534 <td
class="value"><?php
echo
537 $server_status['Bytes_sent'] * $hour_factor, 2, 1)); ?
></td
>
539 <tr
class="noclick odd">
540 <th
class="name"><?php
echo __('Total'); ?
></th
>
541 <td
class="value"><?php
echo
544 $server_status['Bytes_received'] +
$server_status['Bytes_sent'], 2, 1)
546 <td
class="value"><?php
echo
549 ($server_status['Bytes_received'] +
$server_status['Bytes_sent'])
550 * $hour_factor, 2, 1)
556 <table id
="serverstatusconnections" class="data">
559 <th colspan
="2"><?php
echo __('Connections'); ?
></th
>
560 <th
>ø
; <?php
echo __('per hour'); ?
></th
>
565 <tr
class="noclick odd">
566 <th
class="name"><?php
echo __('max. concurrent connections'); ?
></th
>
567 <td
class="value"><?php
echo
568 PMA_formatNumber($server_status['Max_used_connections'], 0); ?
> </td
>
569 <td
class="value">--- </td
>
570 <td
class="value">--- </td
>
572 <tr
class="noclick even">
573 <th
class="name"><?php
echo __('Failed attempts'); ?
></th
>
574 <td
class="value"><?php
echo
575 PMA_formatNumber($server_status['Aborted_connects'], 4, 0); ?
></td
>
576 <td
class="value"><?php
echo
577 PMA_formatNumber($server_status['Aborted_connects'] * $hour_factor,
579 <td
class="value"><?php
echo
580 $server_status['Connections'] > 0
582 $server_status['Aborted_connects'] * 100 / $server_status['Connections'],
586 <tr
class="noclick odd">
587 <th
class="name"><?php
echo __('Aborted'); ?
></th
>
588 <td
class="value"><?php
echo
589 PMA_formatNumber($server_status['Aborted_clients'], 4, 0); ?
></td
>
590 <td
class="value"><?php
echo
591 PMA_formatNumber($server_status['Aborted_clients'] * $hour_factor,
593 <td
class="value"><?php
echo
594 $server_status['Connections'] > 0
596 $server_status['Aborted_clients'] * 100 / $server_status['Connections'],
600 <tr
class="noclick even">
601 <th
class="name"><?php
echo __('Total'); ?
></th
>
602 <td
class="value"><?php
echo
603 PMA_formatNumber($server_status['Connections'], 4, 0); ?
></td
>
604 <td
class="value"><?php
echo
605 PMA_formatNumber($server_status['Connections'] * $hour_factor,
607 <td
class="value"><?php
echo
608 PMA_formatNumber(100, 0, 2); ?
>%
</td
>
613 <hr
class="clearfloat" />
615 <h3 id
="serverstatusqueries"><?php
echo
616 sprintf(__('<b>Query statistics</b>: Since its startup, %s queries have been sent to the server.'),
617 PMA_formatNumber($server_status['Questions'], 0));
618 echo PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions');
621 <table id
="serverstatusqueriessummary" class="data">
624 <th
><?php
echo __('Total'); ?
></th
>
625 <th
>ø
; <?php
echo __('per hour'); ?
></th
>
626 <th
>ø
; <?php
echo __('per minute'); ?
></th
>
627 <th
>ø
; <?php
echo __('per second'); ?
></th
>
631 <tr
class="noclick odd">
632 <td
class="value"><?php
echo
633 PMA_formatNumber($server_status['Questions'], 4, 0); ?
></td
>
634 <td
class="value"><?php
echo
635 PMA_formatNumber($server_status['Questions'] * $hour_factor,
637 <td
class="value"><?php
echo
639 $server_status['Questions'] * 60 / $server_status['Uptime'],
641 <td
class="value"><?php
echo
643 $server_status['Questions'] / $server_status['Uptime'],
649 <div id
="serverstatusqueriesdetails">
652 $used_queries = $sections['com']['vars'];
653 // reverse sort by value to show most used statements first
654 arsort($used_queries);
655 // remove all zero values from the end
656 // variable empty for Drizzle
658 while (end($used_queries) == 0) {
659 array_pop($used_queries);
663 // number of tables to split values into
665 $max_rows_per_table = (int) ceil(count($used_queries) / $tables);
668 $count_displayed_rows = 0;
669 $perc_factor = 100 / ($server_status['Questions'] - $server_status['Connections']);
671 foreach ($used_queries as $name => $value) {
673 if ($count_displayed_rows === 0 ||
$count_displayed_rows === $max_rows_per_table) {
675 if ($count_displayed_rows === $max_rows_per_table) {
676 echo ' </tbody>' . "\n";
677 echo ' </table>' . "\n";
678 $count_displayed_rows = 0;
681 <table id
="serverstatusqueriesdetails<?php echo $current_table; ?>" class="data">
682 <col
class="namecol" />
683 <col
class="valuecol" span
="3" />
685 <tr
><th colspan
="2"><?php
echo __('Query type'); ?
></th
>
686 <th
>ø
; <?php
echo __('per hour'); ?
></th
>
693 $odd_row = !$odd_row;
695 $count_displayed_rows++
;
697 // For the percentage column, use Questions - Connections, because
698 // the number of connections is not an item of the Query types
699 // but is included in Questions. Then the total of the percentages is 100.
700 $name = str_replace('Com_', '', $name);
701 $name = str_replace('_', ' ', $name);
703 <tr
class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
704 <th
class="name"><?php
echo htmlspecialchars($name); ?
></th
>
705 <td
class="value"><?php
echo PMA_formatNumber($value, 4, 0); ?
></td
>
706 <td
class="value"><?php
echo
707 PMA_formatNumber($value * $hour_factor, 3, 3); ?
></td
>
708 <td
class="value"><?php
echo
709 PMA_formatNumber($value * $perc_factor, 0, 2); ?
>%
</td
>
716 <div
class="clearfloat"></div
>
719 <?php
if ($used_queries): ?
>
720 <div id
="serverstatusquerieschart">
722 if (empty($_REQUEST["query_chart"])) {
723 echo '<a href="' . $PMA_PHP_SELF . '?' . $url_query
724 . '&query_chart=1#serverstatusqueries"'
725 . 'title="' . __('Show query chart') . '">['
726 . __('Show query chart') . ']</a>';
727 PMA_Message
::notice( __('Note: Generating the query chart can take a long time.'))->display();
729 echo PMA_chart_status($used_queries);
735 <div id
="serverstatussection">
737 //Unset used variables
739 $tables, $max_rows_per_table, $current_table, $count_displayed_rows, $perc_factor,
740 $hour_factor, $sections['com'],
741 $server_status['Aborted_clients'], $server_status['Aborted_connects'],
742 $server_status['Max_used_connections'], $server_status['Bytes_received'],
743 $server_status['Bytes_sent'], $server_status['Connections'],
744 $server_status['Questions'], $server_status['Uptime'],
748 foreach ($sections as $section_name => $section) {
749 if (! empty($section['vars'])) {
751 <table
class="data" id
="serverstatussection<?php echo $section_name; ?>">
752 <caption
class="tblHeaders">
754 href
="<?php echo $PMA_PHP_SELF . '?' .
755 PMA_generate_common_url() . '#serverstatus'; ?>"
756 name
="<?php echo $section_name; ?>"><?php
echo __('Begin'); ?
>
758 ($GLOBALS['cfg']['MainPageIconic']
759 ?
'<img src="' . $GLOBALS['pmaThemeImage'] .
760 's_asc.png" width="11" height="9" align="middle" alt="" />'
764 if (! empty($section['title'])) {
765 echo $section['title'];
769 <col
class="namecol" />
770 <col
class="valuecol" />
771 <col
class="descrcol" />
774 <th
><?php
echo __('Variable'); ?
></th
>
775 <th
><?php
echo __('Value'); ?
></th
>
776 <th
><?php
echo __('Description'); ?
></th
>
780 if (! empty($links[$section_name])) {
783 <tr
class="tblFooters">
784 <th colspan
="3" class="tblFooters">
786 foreach ($links[$section_name] as $link_name => $link_url) {
787 if ('doc' == $link_name) {
788 echo PMA_showMySQLDocu($link_url, $link_url);
790 echo '<a href="' . $link_url . '">' . $link_name . '</a>' . "\n";
793 unset($link_url, $link_name);
804 foreach ($section['vars'] as $name => $value) {
805 $odd_row = !$odd_row;
807 <tr
class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
808 <th
class="name"><?php
echo htmlspecialchars($name) . PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); ?
>
810 <td
class="value"><?php
811 if (isset($alerts[$name])) {
812 if ($value > $alerts[$name]) {
813 echo '<span class="attention">';
815 echo '<span class="allfine">';
818 if ('%' === substr($name, -1, 1)) {
819 echo PMA_formatNumber($value, 0, 2) . ' %';
820 } elseif (is_numeric($value) && $value == (int) $value && $value > 1000) {
821 echo PMA_formatNumber($value, 3, 1);
822 } elseif (is_numeric($value) && $value == (int) $value) {
823 echo PMA_formatNumber($value, 4, 0);
824 } elseif (is_numeric($value)) {
825 echo PMA_formatNumber($value, 3, 1);
827 echo htmlspecialchars($value);
829 if (isset($alerts[$name])) {
835 if (isset($GLOBALS['strShowStatus' . $name . 'Descr'])) {
836 echo $GLOBALS['strShowStatus' . $name . 'Descr'];
839 if (isset($links[$name])) {
840 foreach ($links[$name] as $link_name => $link_url) {
841 if ('doc' == $link_name) {
842 echo PMA_showMySQLDocu($link_url, $link_url);
844 echo ' <a href="' . $link_url . '">' . $link_name . '</a>' .
848 unset($link_url, $link_name);
855 unset($name, $value);
862 unset($section_name, $section, $sections, $server_status, $odd_row, $alerts);
866 /* if the server works as master or slave in replication process, display useful information */
867 if ($server_master_status ||
$server_slave_status)
870 <hr
class="clearfloat" />
872 <h3
><a name
="replication"></a
><?php
echo __('Replication status'); ?
></h3
>
875 foreach ($replication_types as $type)
877 if ($
{"server_{$type}_status"}) {
878 PMA_replication_print_status_table($type);
891 require './libraries/footer.inc.php';