Translation update done using Pootle.
[phpmyadmin-themes.git] / server_status.php
blobbcbfe06d0fa9814175dd17e50ede16094f87e725
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * displays status variables with descriptions and some hints an optmizing
5 * + reset status variables
7 * @package phpMyAdmin
8 */
10 /**
11 * no need for variables importing
12 * @ignore
14 if (! defined('PMA_NO_VARIABLES_IMPORT')) {
15 define('PMA_NO_VARIABLES_IMPORT', true);
17 require_once './libraries/common.inc.php';
19 /**
20 * Does the common work
22 require './libraries/server_common.inc.php';
25 /**
26 * Displays the links
28 require './libraries/server_links.inc.php';
30 /**
31 * Replication library
33 require './libraries/replication.inc.php';
34 require_once './libraries/replication_gui.lib.php';
36 /**
37 * Messages are built using the message name
39 $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.');
40 $strShowStatusBinlog_cache_useDescr = __('The number of transactions that used the temporary binary log cache.');
41 $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.');
42 $strShowStatusCreated_tmp_filesDescr = __('How many temporary files mysqld has created.');
43 $strShowStatusCreated_tmp_tablesDescr = __('The number of in-memory temporary tables created automatically by the server while executing statements.');
44 $strShowStatusDelayed_errorsDescr = __('The number of rows written with INSERT DELAYED for which some error occurred (probably duplicate key).');
45 $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.');
46 $strShowStatusDelayed_writesDescr = __('The number of INSERT DELAYED rows written.');
47 $strShowStatusFlush_commandsDescr = __('The number of executed FLUSH statements.');
48 $strShowStatusHandler_commitDescr = __('The number of internal COMMIT statements.');
49 $strShowStatusHandler_deleteDescr = __('The number of times a row was deleted from a table.');
50 $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.');
51 $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.');
52 $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.');
53 $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.');
54 $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.');
55 $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.');
56 $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.');
57 $strShowStatusHandler_rollbackDescr = __('The number of internal ROLLBACK statements.');
58 $strShowStatusHandler_updateDescr = __('The number of requests to update a row in a table.');
59 $strShowStatusHandler_writeDescr = __('The number of requests to insert a row in a table.');
60 $strShowStatusInnodb_buffer_pool_pages_dataDescr = __('The number of pages containing data (dirty or clean).');
61 $strShowStatusInnodb_buffer_pool_pages_dirtyDescr = __('The number of pages currently dirty.');
62 $strShowStatusInnodb_buffer_pool_pages_flushedDescr = __('The number of buffer pool pages that have been requested to be flushed.');
63 $strShowStatusInnodb_buffer_pool_pages_freeDescr = __('The number of free pages.');
64 $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.');
65 $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.');
66 $strShowStatusInnodb_buffer_pool_pages_totalDescr = __('Total size of buffer pool, in pages.');
67 $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.');
68 $strShowStatusInnodb_buffer_pool_read_ahead_seqDescr = __('The number of sequential read-aheads InnoDB initiated. This happens when InnoDB does a sequential full table scan.');
69 $strShowStatusInnodb_buffer_pool_read_requestsDescr = __('The number of logical read requests InnoDB has done.');
70 $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.');
71 $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.');
72 $strShowStatusInnodb_buffer_pool_write_requestsDescr = __('The number writes done to the InnoDB buffer pool.');
73 $strShowStatusInnodb_data_fsyncsDescr = __('The number of fsync() operations so far.');
74 $strShowStatusInnodb_data_pending_fsyncsDescr = __('The current number of pending fsync() operations.');
75 $strShowStatusInnodb_data_pending_readsDescr = __('The current number of pending reads.');
76 $strShowStatusInnodb_data_pending_writesDescr = __('The current number of pending writes.');
77 $strShowStatusInnodb_data_readDescr = __('The amount of data read so far, in bytes.');
78 $strShowStatusInnodb_data_readsDescr = __('The total number of data reads.');
79 $strShowStatusInnodb_data_writesDescr = __('The total number of data writes.');
80 $strShowStatusInnodb_data_writtenDescr = __('The amount of data written so far, in bytes.');
81 $strShowStatusInnodb_dblwr_pages_writtenDescr = __('The number of pages that have been written for doublewrite operations.');
82 $strShowStatusInnodb_dblwr_writesDescr = __('The number of doublewrite operations that have been performed.');
83 $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.');
84 $strShowStatusInnodb_log_write_requestsDescr = __('The number of log write requests.');
85 $strShowStatusInnodb_log_writesDescr = __('The number of physical writes to the log file.');
86 $strShowStatusInnodb_os_log_fsyncsDescr = __('The number of fsync() writes done to the log file.');
87 $strShowStatusInnodb_os_log_pending_fsyncsDescr = __('The number of pending log file fsyncs.');
88 $strShowStatusInnodb_os_log_pending_writesDescr = __('Pending log file writes.');
89 $strShowStatusInnodb_os_log_writtenDescr = __('The number of bytes written to the log file.');
90 $strShowStatusInnodb_pages_createdDescr = __('The number of pages created.');
91 $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.');
92 $strShowStatusInnodb_pages_readDescr = __('The number of pages read.');
93 $strShowStatusInnodb_pages_writtenDescr = __('The number of pages written.');
94 $strShowStatusInnodb_row_lock_current_waitsDescr = __('The number of row locks currently being waited for.');
95 $strShowStatusInnodb_row_lock_time_avgDescr = __('The average time to acquire a row lock, in milliseconds.');
96 $strShowStatusInnodb_row_lock_timeDescr = __('The total time spent in acquiring row locks, in milliseconds.');
97 $strShowStatusInnodb_row_lock_time_maxDescr = __('The maximum time to acquire a row lock, in milliseconds.');
98 $strShowStatusInnodb_row_lock_waitsDescr = __('The number of times a row lock had to be waited for.');
99 $strShowStatusInnodb_rows_deletedDescr = __('The number of rows deleted from InnoDB tables.');
100 $strShowStatusInnodb_rows_insertedDescr = __('The number of rows inserted in InnoDB tables.');
101 $strShowStatusInnodb_rows_readDescr = __('The number of rows read from InnoDB tables.');
102 $strShowStatusInnodb_rows_updatedDescr = __('The number of rows updated in InnoDB tables.');
103 $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.');
104 $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.');
105 $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.');
106 $strShowStatusKey_read_requestsDescr = __('The number of requests to read a key block from the cache.');
107 $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.');
108 $strShowStatusKey_write_requestsDescr = __('The number of requests to write a key block to the cache.');
109 $strShowStatusKey_writesDescr = __('The number of physical writes of a key block to disk.');
110 $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.');
111 $strShowStatusNot_flushed_delayed_rowsDescr = __('The number of rows waiting to be written in INSERT DELAYED queues.');
112 $strShowStatusOpened_tablesDescr = __('The number of tables that have been opened. If opened tables is big, your table cache value is probably too small.');
113 $strShowStatusOpen_filesDescr = __('The number of files that are open.');
114 $strShowStatusOpen_streamsDescr = __('The number of streams that are open (used mainly for logging).');
115 $strShowStatusOpen_tablesDescr = __('The number of tables that are open.');
116 $strShowStatusQcache_free_blocksDescr = __('The number of free memory blocks in query cache.');
117 $strShowStatusQcache_free_memoryDescr = __('The amount of free memory for query cache.');
118 $strShowStatusQcache_hitsDescr = __('The number of cache hits.');
119 $strShowStatusQcache_insertsDescr = __('The number of queries added to the cache.');
120 $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.');
121 $strShowStatusQcache_not_cachedDescr = __('The number of non-cached queries (not cachable, or not cached due to the query_cache_type setting).');
122 $strShowStatusQcache_queries_in_cacheDescr = __('The number of queries registered in the cache.');
123 $strShowStatusQcache_total_blocksDescr = __('The total number of blocks in the query cache.');
124 $strShowStatusReset = _pgettext('$strShowStatusReset', 'Reset');
125 $strShowStatusRpl_statusDescr = __('The status of failsafe replication (not yet implemented).');
126 $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.');
127 $strShowStatusSelect_full_range_joinDescr = __('The number of joins that used a range search on a reference table.');
128 $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.)');
129 $strShowStatusSelect_rangeDescr = __('The number of joins that used ranges on the first table. (It\'s normally not critical even if this is big.)');
130 $strShowStatusSelect_scanDescr = __('The number of joins that did a full scan of the first table.');
131 $strShowStatusSlave_open_temp_tablesDescr = __('The number of temporary tables currently open by the slave SQL thread.');
132 $strShowStatusSlave_retried_transactionsDescr = __('Total (since startup) number of times the replication slave SQL thread has retried transactions.');
133 $strShowStatusSlave_runningDescr = __('This is ON if this server is a slave that is connected to a master.');
134 $strShowStatusSlow_launch_threadsDescr = __('The number of threads that have taken more than slow_launch_time seconds to create.');
135 $strShowStatusSlow_queriesDescr = __('The number of queries that have taken more than long_query_time seconds.');
136 $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.');
137 $strShowStatusSort_rangeDescr = __('The number of sorts that were done with ranges.');
138 $strShowStatusSort_rowsDescr = __('The number of sorted rows.');
139 $strShowStatusSort_scanDescr = __('The number of sorts that were done by scanning the table.');
140 $strShowStatusTable_locks_immediateDescr = __('The number of times that a table lock was acquired immediately.');
141 $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.');
142 $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.');
143 $strShowStatusThreads_connectedDescr = __('The number of currently open connections.');
144 $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.)');
145 $strShowStatusThreads_runningDescr = __('The number of threads that are not sleeping.');
148 * Displays the sub-page heading
150 echo '<div id="serverstatus">' . "\n";
151 echo '<h2>' . "\n"
152 . ($GLOBALS['cfg']['MainPageIconic']
153 ? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] .
154 's_status.png" width="16" height="16" alt="" />'
155 : '')
156 . __('Runtime Information') . "\n"
157 . '</h2>' . "\n";
161 * flush status variables if requested
163 if (isset($_REQUEST['flush'])) {
164 $_flush_commands = array(
165 'STATUS',
166 'TABLES',
167 'QUERY CACHE',
170 if (in_array($_REQUEST['flush'], $_flush_commands)) {
171 PMA_DBI_query('FLUSH ' . $_REQUEST['flush'] . ';');
173 unset($_flush_commands);
178 * get status from server
180 $server_status = PMA_DBI_fetch_result('SHOW GLOBAL STATUS', 0, 1);
183 * for some calculations we require also some server settings
185 $server_variables = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES', 0, 1);
188 * starttime calculation
190 $start_time = PMA_DBI_fetch_value(
191 'SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime']);
195 * cleanup some deprecated values
197 $deprecated = array(
198 'Com_prepare_sql' => 'Com_stmt_prepare',
199 'Com_execute_sql' => 'Com_stmt_execute',
200 'Com_dealloc_sql' => 'Com_stmt_close',
203 foreach ($deprecated as $old => $new) {
204 if (isset($server_status[$old])
205 && isset($server_status[$new])) {
206 unset($server_status[$old]);
209 unset($deprecated);
213 * calculate some values
215 // Key_buffer_fraction
216 if (isset($server_status['Key_blocks_unused'])
217 && isset($server_variables['key_cache_block_size'])
218 && isset($server_variables['key_buffer_size'])) {
219 $server_status['Key_buffer_fraction_%'] =
221 - $server_status['Key_blocks_unused']
222 * $server_variables['key_cache_block_size']
223 / $server_variables['key_buffer_size']
224 * 100;
225 } elseif (
226 isset($server_status['Key_blocks_used'])
227 && isset($server_variables['key_buffer_size'])) {
228 $server_status['Key_buffer_fraction_%'] =
229 $server_status['Key_blocks_used']
230 * 1024
231 / $server_variables['key_buffer_size'];
234 // Ratio for key read/write
235 if (isset($server_status['Key_writes'])
236 && isset($server_status['Key_write_requests'])
237 && $server_status['Key_write_requests'] > 0)
238 $server_status['Key_write_ratio_%'] = 100 * $server_status['Key_writes'] / $server_status['Key_write_requests'];
240 if (isset($server_status['Key_reads'])
241 && isset($server_status['Key_read_requests'])
242 && $server_status['Key_read_requests'] > 0)
243 $server_status['Key_read_ratio_%'] = 100 * $server_status['Key_reads'] / $server_status['Key_read_requests'];
245 // Threads_cache_hitrate
246 if (isset($server_status['Threads_created'])
247 && isset($server_status['Connections'])
248 && $server_status['Connections'] > 0) {
249 $server_status['Threads_cache_hitrate_%'] =
251 - $server_status['Threads_created']
252 / $server_status['Connections']
253 * 100;
256 // Format Uptime_since_flush_status : show as days, hours, minutes, seconds
257 if (isset($server_status['Uptime_since_flush_status'])) {
258 $server_status['Uptime_since_flush_status'] = PMA_timespanFormat($server_status['Uptime_since_flush_status']);
262 * define some alerts
264 // name => max value before alert
265 $alerts = array(
266 // lower is better
267 // variable => max value
268 'Aborted_clients' => 0,
269 'Aborted_connects' => 0,
271 'Binlog_cache_disk_use' => 0,
273 'Created_tmp_disk_tables' => 0,
275 'Handler_read_rnd' => 0,
276 'Handler_read_rnd_next' => 0,
278 'Innodb_buffer_pool_pages_dirty' => 0,
279 'Innodb_buffer_pool_reads' => 0,
280 'Innodb_buffer_pool_wait_free' => 0,
281 'Innodb_log_waits' => 0,
282 'Innodb_row_lock_time_avg' => 10, // ms
283 'Innodb_row_lock_time_max' => 50, // ms
284 'Innodb_row_lock_waits' => 0,
286 'Slow_queries' => 0,
287 'Delayed_errors' => 0,
288 'Select_full_join' => 0,
289 'Select_range_check' => 0,
290 'Sort_merge_passes' => 0,
291 'Opened_tables' => 0,
292 'Table_locks_waited' => 0,
293 'Qcache_lowmem_prunes' => 0,
294 'Slow_launch_threads' => 0,
296 // depends on Key_read_requests
297 // normaly lower then 1:0.01
298 'Key_reads' => (0.01 * $server_status['Key_read_requests']),
299 // depends on Key_write_requests
300 // normaly nearly 1:1
301 'Key_writes' => (0.9 * $server_status['Key_write_requests']),
303 'Key_buffer_fraction' => 0.5,
305 // alert if more than 95% of thread cache is in use
306 'Threads_cached' => 0.95 * $server_variables['thread_cache_size']
308 // higher is better
309 // variable => min value
310 //'Handler read key' => '> ',
315 * split variables in sections
317 $allocations = array(
318 // variable name => section
320 'Com_' => 'com',
321 'Innodb_' => 'innodb',
322 'Ndb_' => 'ndb',
323 'Handler_' => 'handler',
324 'Qcache_' => 'qcache',
325 'Threads_' => 'threads',
326 'Slow_launch_threads' => 'threads',
328 'Binlog_cache_' => 'binlog_cache',
329 'Created_tmp_' => 'created_tmp',
330 'Key_' => 'key',
332 'Delayed_' => 'delayed',
333 'Not_flushed_delayed_rows' => 'delayed',
335 'Flush_commands' => 'query',
336 'Last_query_cost' => 'query',
337 'Slow_queries' => 'query',
339 'Select_' => 'select',
340 'Sort_' => 'sort',
342 'Open_tables' => 'table',
343 'Opened_tables' => 'table',
344 'Table_locks_' => 'table',
346 'Rpl_status' => 'repl',
347 'Slave_' => 'repl',
349 'Tc_' => 'tc',
351 'Ssl_' => 'ssl',
354 $sections = array(
355 // section => section name (description)
356 'com' => array('title' => ''),
357 'query' => array('title' => __('SQL query')),
358 'innodb' => array('title' => 'InnoDB'),
359 'ndb' => array('title' => 'NDB'),
360 'handler' => array('title' => __('Handler')),
361 'qcache' => array('title' => __('Query cache')),
362 'threads' => array('title' => __('Threads')),
363 'binlog_cache' => array('title' => __('Binary log')),
364 'created_tmp' => array('title' => __('Temporary data')),
365 'delayed' => array('title' => __('Delayed inserts')),
366 'key' => array('title' => __('Key cache')),
367 'select' => array('title' => __('Joins')),
368 'repl' => array('title' => __('Replication')),
369 'sort' => array('title' => __('Sorting')),
370 'table' => array('title' => __('Tables')),
371 'tc' => array('title' => __('Transaction coordinator')),
372 'ssl' => array('title' => 'SSL'),
376 * define some needfull links/commands
378 // variable or section name => (name => url)
379 $links = array();
381 $links['table'][__('Flush (close) all tables')]
382 = $PMA_PHP_SELF . '?flush=TABLES&amp;' . PMA_generate_common_url();
383 $links['table'][__('Show open tables')]
384 = 'sql.php?sql_query=' . urlencode('SHOW OPEN TABLES') .
385 '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
387 if ($server_master_status) {
388 $links['repl'][__('Show slave hosts')]
389 = 'sql.php?sql_query=' . urlencode('SHOW SLAVE HOSTS') .
390 '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
391 $links['repl'][__('Show master status')] = '#replication_master';
393 if ($server_slave_status) {
394 $links['repl'][__('Show slave status')] = '#replication_slave';
397 $links['repl']['doc'] = 'replication';
399 $links['qcache'][__('Flush query cache')]
400 = $PMA_PHP_SELF . '?flush=' . urlencode('QUERY CACHE') . '&amp;' .
401 PMA_generate_common_url();
402 $links['qcache']['doc'] = 'query_cache';
404 $links['threads'][__('Show processes')]
405 = 'server_processlist.php?' . PMA_generate_common_url();
406 $links['threads']['doc'] = 'mysql_threads';
408 $links['key']['doc'] = 'myisam_key_cache';
410 $links['binlog_cache']['doc'] = 'binary_log';
412 $links['Slow_queries']['doc'] = 'slow_query_log';
414 $links['innodb'][__('Variables')]
415 = 'server_engines.php?engine=InnoDB&amp;' . PMA_generate_common_url();
416 $links['innodb'][__('InnoDB Status')]
417 = 'server_engines.php?engine=InnoDB&amp;page=Status&amp;' .
418 PMA_generate_common_url();
419 $links['innodb']['doc'] = 'innodb';
422 // sort status vars into arrays
423 foreach ($server_status as $name => $value) {
424 if (isset($allocations[$name])) {
425 $sections[$allocations[$name]]['vars'][$name] = $value;
426 unset($server_status[$name]);
427 } else {
428 foreach ($allocations as $filter => $section) {
429 if (preg_match('/^' . $filter . '/', $name)
430 && isset($server_status[$name])) {
431 unset($server_status[$name]);
432 $sections[$section]['vars'][$name] = $value;
437 unset($name, $value, $filter, $section, $allocations);
439 // rest
440 $sections['all']['vars'] =& $server_status;
442 $hour_factor = 3600 / $server_status['Uptime'];
445 * start output
448 <div id="statuslinks">
449 <a href="<?php echo
450 $PMA_PHP_SELF . '?' . PMA_generate_common_url(); ?>"
451 ><?php echo __('Refresh'); ?></a>
452 <a href="<?php echo
453 $PMA_PHP_SELF . '?flush=STATUS&amp;' . PMA_generate_common_url(); ?>"
454 ><?php echo _pgettext('for Show status', 'Reset'); ?></a>
455 <?php echo PMA_showMySQLDocu('server_status_variables','server_status_variables'); ?>
456 </div>
459 <?php
460 echo sprintf(__('This MySQL server has been running for %s. It started up on %s.'),
461 PMA_timespanFormat($server_status['Uptime']),
462 PMA_localisedDate($start_time)) . "\n";
464 </p>
466 <?php
467 if ($server_master_status || $server_slave_status) {
468 echo '<p>';
469 if ($server_master_status && $server_slave_status) {
470 echo __('This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.');
471 } elseif ($server_master_status) {
472 echo __('This MySQL server works as <b>master</b> in <b>replication</b> process.');
473 } elseif ($server_slave_status) {
474 echo __('This MySQL server works as <b>slave</b> in <b>replication</b> process.');
476 echo __('For further information about replication status on the server, please visit the <a href=#replication>replication section</a>.');
477 echo '</p>';
481 <div id="sectionlinks">
482 <?php
483 foreach ($sections as $section_name => $section) {
484 if (! empty($section['vars']) && ! empty($section['title'])) {
485 echo '<a href="' . $PMA_PHP_SELF . '?' .
486 PMA_generate_common_url() . '#' . $section_name . '">' .
487 $section['title'] . '</a>' . "\n";
491 </div>
493 <h3><?php echo __('<b>Server traffic</b>: These tables show the network traffic statistics of this MySQL server since its startup.'); ?></h3>
495 <table id="serverstatustraffic" class="data">
496 <thead>
497 <tr>
498 <th colspan="2"><?php echo __('Traffic') . '&nbsp;' . PMA_showHint(__('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.')); ?></th>
499 <th>&oslash; <?php echo __('per hour'); ?></th>
500 </tr>
501 </thead>
502 <tbody>
503 <tr class="odd">
504 <th class="name"><?php echo __('Received'); ?></th>
505 <td class="value"><?php echo
506 implode(' ',
507 PMA_formatByteDown($server_status['Bytes_received'], 2, 1)); ?></td>
508 <td class="value"><?php echo
509 implode(' ',
510 PMA_formatByteDown(
511 $server_status['Bytes_received'] * $hour_factor, 2, 1)); ?></td>
512 </tr>
513 <tr class="even">
514 <th class="name"><?php echo __('Sent'); ?></th>
515 <td class="value"><?php echo
516 implode(' ',
517 PMA_formatByteDown($server_status['Bytes_sent'], 2, 1)); ?></td>
518 <td class="value"><?php echo
519 implode(' ',
520 PMA_formatByteDown(
521 $server_status['Bytes_sent'] * $hour_factor, 2, 1)); ?></td>
522 </tr>
523 <tr class="odd">
524 <th class="name"><?php echo __('Total'); ?></th>
525 <td class="value"><?php echo
526 implode(' ',
527 PMA_formatByteDown(
528 $server_status['Bytes_received'] + $server_status['Bytes_sent'], 2, 1)
529 ); ?></td>
530 <td class="value"><?php echo
531 implode(' ',
532 PMA_formatByteDown(
533 ($server_status['Bytes_received'] + $server_status['Bytes_sent'])
534 * $hour_factor, 2, 1)
535 ); ?></td>
536 </tr>
537 </tbody>
538 </table>
540 <table id="serverstatusconnections" class="data">
541 <thead>
542 <tr>
543 <th colspan="2"><?php echo __('Connections'); ?></th>
544 <th>&oslash; <?php echo __('per hour'); ?></th>
545 <th>%</th>
546 </tr>
547 </thead>
548 <tbody>
549 <tr class="odd">
550 <th class="name"><?php echo __('max. concurrent connections'); ?></th>
551 <td class="value"><?php echo
552 PMA_formatNumber($server_status['Max_used_connections'], 0); ?> </td>
553 <td class="value">--- </td>
554 <td class="value">--- </td>
555 </tr>
556 <tr class="even">
557 <th class="name"><?php echo __('Failed attempts'); ?></th>
558 <td class="value"><?php echo
559 PMA_formatNumber($server_status['Aborted_connects'], 4, 0); ?></td>
560 <td class="value"><?php echo
561 PMA_formatNumber($server_status['Aborted_connects'] * $hour_factor,
562 4, 2); ?></td>
563 <td class="value"><?php echo
564 $server_status['Connections'] > 0
565 ? PMA_formatNumber(
566 $server_status['Aborted_connects'] * 100 / $server_status['Connections'],
567 0, 2) . '%'
568 : '--- '; ?></td>
569 </tr>
570 <tr class="odd">
571 <th class="name"><?php echo __('Aborted'); ?></th>
572 <td class="value"><?php echo
573 PMA_formatNumber($server_status['Aborted_clients'], 4, 0); ?></td>
574 <td class="value"><?php echo
575 PMA_formatNumber($server_status['Aborted_clients'] * $hour_factor,
576 4, 2); ?></td>
577 <td class="value"><?php echo
578 $server_status['Connections'] > 0
579 ? PMA_formatNumber(
580 $server_status['Aborted_clients'] * 100 / $server_status['Connections'],
581 0, 2) . '%'
582 : '--- '; ?></td>
583 </tr>
584 <tr class="even">
585 <th class="name"><?php echo __('Total'); ?></th>
586 <td class="value"><?php echo
587 PMA_formatNumber($server_status['Connections'], 4, 0); ?></td>
588 <td class="value"><?php echo
589 PMA_formatNumber($server_status['Connections'] * $hour_factor,
590 4, 2); ?></td>
591 <td class="value"><?php echo
592 PMA_formatNumber(100, 0, 2); ?>%</td>
593 </tr>
594 </tbody>
595 </table>
597 <hr class="clearfloat" />
599 <h3><?php echo
600 sprintf(__('<b>Query statistics</b>: Since its startup, %s queries have been sent to the server.'),
601 PMA_formatNumber($server_status['Questions'], 0)); ?></h3>
603 <table id="serverstatusqueriessummary" class="data">
604 <thead>
605 <tr>
606 <th><?php echo __('Total'); ?></th>
607 <th>&oslash; <?php echo __('per hour'); ?></th>
608 <th>&oslash; <?php echo __('per minute'); ?></th>
609 <th>&oslash; <?php echo __('per second'); ?></th>
610 </tr>
611 </thead>
612 <tbody>
613 <tr class="odd">
614 <td class="value"><?php echo
615 PMA_formatNumber($server_status['Questions'], 4, 0); ?></td>
616 <td class="value"><?php echo
617 PMA_formatNumber($server_status['Questions'] * $hour_factor,
618 3, 2); ?></td>
619 <td class="value"><?php echo
620 PMA_formatNumber(
621 $server_status['Questions'] * 60 / $server_status['Uptime'],
622 3, 2); ?></td>
623 <td class="value"><?php echo
624 PMA_formatNumber(
625 $server_status['Questions'] / $server_status['Uptime'],
626 3, 2); ?></td>
627 </tr>
628 </tbody>
629 </table>
631 <div id="serverstatusqueriesdetails">
632 <?php
634 $used_queries = $sections['com']['vars'];
635 // reverse sort by value to show most used statements first
636 arsort($used_queries);
637 // remove all zero values from the end
638 while (end($used_queries) == 0) {
639 array_pop($used_queries);
642 // number of tables to split values into
643 $tables = 3;
644 $max_rows_per_table = (int) ceil(count($used_queries) / $tables);
645 $current_table = 0;
646 $odd_row = true;
647 $count_displayed_rows = 0;
648 $perc_factor = 100 / ($server_status['Questions'] - $server_status['Connections']);
650 foreach ($used_queries as $name => $value) {
651 $current_table++;
652 if ($count_displayed_rows === 0 || $count_displayed_rows === $max_rows_per_table) {
653 $odd_row = true;
654 if ($count_displayed_rows === $max_rows_per_table) {
655 echo ' </tbody>' . "\n";
656 echo ' </table>' . "\n";
657 $count_displayed_rows = 0;
660 <table id="serverstatusqueriesdetails<?php echo $current_table; ?>" class="data">
661 <col class="namecol" />
662 <col class="valuecol" span="3" />
663 <thead>
664 <tr><th colspan="2"><?php echo __('Query type'); ?></th>
665 <th>&oslash; <?php echo __('per hour'); ?></th>
666 <th>%</th>
667 </tr>
668 </thead>
669 <tbody>
670 <?php
671 } else {
672 $odd_row = !$odd_row;
674 $count_displayed_rows++;
676 // For the percentage column, use Questions - Connections, because
677 // the number of connections is not an item of the Query types
678 // but is included in Questions. Then the total of the percentages is 100.
679 $name = str_replace('Com_', '', $name);
680 $name = str_replace('_', ' ', $name);
682 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
683 <th class="name"><?php echo htmlspecialchars($name); ?></th>
684 <td class="value"><?php echo PMA_formatNumber($value, 4, 0); ?></td>
685 <td class="value"><?php echo
686 PMA_formatNumber($value * $hour_factor, 3, 3); ?></td>
687 <td class="value"><?php echo
688 PMA_formatNumber($value * $perc_factor, 0, 2); ?>%</td>
689 </tr>
690 <?php
693 </tbody>
694 </table>
695 </div>
697 <div id="serverstatussection">
698 <?php
699 //Unset used variables
700 unset(
701 $tables, $max_rows_per_table, $current_table, $count_displayed_rows, $perc_factor,
702 $hour_factor, $sections['com'],
703 $server_status['Aborted_clients'], $server_status['Aborted_connects'],
704 $server_status['Max_used_connections'], $server_status['Bytes_received'],
705 $server_status['Bytes_sent'], $server_status['Connections'],
706 $server_status['Questions'], $server_status['Uptime'],
707 $used_queries
710 foreach ($sections as $section_name => $section) {
711 if (! empty($section['vars'])) {
713 <table class="data" id="serverstatussection<?php echo $section_name; ?>">
714 <caption class="tblHeaders">
715 <a class="top"
716 href="<?php echo $PMA_PHP_SELF . '?' .
717 PMA_generate_common_url() . '#serverstatus'; ?>"
718 name="<?php echo $section_name; ?>"><?php echo __('Begin'); ?>
719 <?php echo
720 ($GLOBALS['cfg']['MainPageIconic']
721 ? '<img src="' . $GLOBALS['pmaThemeImage'] .
722 's_asc.png" width="11" height="9" align="middle" alt="" />'
723 : ''); ?>
724 </a>
725 <?php
726 if (! empty($section['title'])) {
727 echo $section['title'];
730 </caption>
731 <col class="namecol" />
732 <col class="valuecol" />
733 <col class="descrcol" />
734 <thead>
735 <tr>
736 <th><?php echo __('Variable'); ?></th>
737 <th><?php echo __('Value'); ?></th>
738 <th><?php echo __('Description'); ?></th>
739 </tr>
740 </thead>
741 <?php
742 if (! empty($links[$section_name])) {
744 <tfoot>
745 <tr class="tblFooters">
746 <th colspan="3" class="tblFooters">
747 <?php
748 foreach ($links[$section_name] as $link_name => $link_url) {
749 if ('doc' == $link_name) {
750 echo PMA_showMySQLDocu($link_url, $link_url);
751 } else {
752 echo '<a href="' . $link_url . '">' . $link_name . '</a>' . "\n";
755 unset($link_url, $link_name);
757 </th>
758 </tr>
759 </tfoot>
760 <?php
763 <tbody>
764 <?php
765 $odd_row = false;
766 foreach ($section['vars'] as $name => $value) {
767 $odd_row = !$odd_row;
769 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
770 <th class="name"><?php echo htmlspecialchars($name); ?></th>
771 <td class="value"><?php
772 if (isset($alerts[$name])) {
773 if ($value > $alerts[$name]) {
774 echo '<span class="attention">';
775 } else {
776 echo '<span class="allfine">';
779 if ('%' === substr($name, -1, 1)) {
780 echo PMA_formatNumber($value, 0, 2) . ' %';
781 } elseif (is_numeric($value) && $value == (int) $value) {
782 echo PMA_formatNumber($value, 3, 1);
783 } elseif (is_numeric($value)) {
784 echo PMA_formatNumber($value, 3, 1);
785 } else {
786 echo htmlspecialchars($value);
788 if (isset($alerts[$name])) {
789 echo '</span>';
791 ?></td>
792 <td class="descr">
793 <?php
794 if (isset($GLOBALS['strShowStatus' . $name . 'Descr'])) {
795 echo $GLOBALS['strShowStatus' . $name . 'Descr'];
798 if (isset($links[$name])) {
799 foreach ($links[$name] as $link_name => $link_url) {
800 if ('doc' == $link_name) {
801 echo PMA_showMySQLDocu($link_url, $link_url);
802 } else {
803 echo ' <a href="' . $link_url . '">' . $link_name . '</a>' .
804 "\n";
807 unset($link_url, $link_name);
810 </td>
811 </tr>
812 <?php
814 unset($name, $value);
816 </tbody>
817 </table>
818 <?php
821 unset($section_name, $section, $sections, $server_status, $odd_row, $alerts);
823 </div>
824 <?php
825 /* if the server works as master or slave in replication process, display useful information */
826 if ($server_master_status || $server_slave_status)
829 <hr class="clearfloat" />
831 <h3><a name="replication"></a><?php echo __('Replication status'); ?></h3>
832 <?php
834 foreach ($replication_types as $type)
836 if (${"server_{$type}_status"}) {
837 PMA_replication_print_status_table($type);
840 unset($types);
844 </div>
846 <?php
848 * Sends the footer
850 require './libraries/footer.inc.php';