'; $retval .= ''; $retval .= '
'; $retval .= ''; return $retval; } /** * Prints the suggestion links * * @param Data $serverStatusData Server status data * * @return string */ public static function getHtmlForLinkSuggestions(Data $serverStatusData) { $retval = ' '; return $retval; } /** * Returns a table with variables information * * @param Data $serverStatusData Server status data * * @return string */ public static function getHtmlForVariablesList(Data $serverStatusData) { $retval = ''; $strShowStatus = self::getDescriptions(); /** * define some alerts */ // name => max value before alert $alerts = array( // lower is better // variable => max value 'Aborted_clients' => 0, 'Aborted_connects' => 0, 'Binlog_cache_disk_use' => 0, 'Created_tmp_disk_tables' => 0, 'Handler_read_rnd' => 0, 'Handler_read_rnd_next' => 0, 'Innodb_buffer_pool_pages_dirty' => 0, 'Innodb_buffer_pool_reads' => 0, 'Innodb_buffer_pool_wait_free' => 0, 'Innodb_log_waits' => 0, 'Innodb_row_lock_time_avg' => 10, // ms 'Innodb_row_lock_time_max' => 50, // ms 'Innodb_row_lock_waits' => 0, 'Slow_queries' => 0, 'Delayed_errors' => 0, 'Select_full_join' => 0, 'Select_range_check' => 0, 'Sort_merge_passes' => 0, 'Opened_tables' => 0, 'Table_locks_waited' => 0, 'Qcache_lowmem_prunes' => 0, 'Qcache_free_blocks' => isset($serverStatusData->status['Qcache_total_blocks']) ? $serverStatusData->status['Qcache_total_blocks'] / 5 : 0, 'Slow_launch_threads' => 0, // depends on Key_read_requests // normally lower then 1:0.01 'Key_reads' => isset($serverStatusData->status['Key_read_requests']) ? (0.01 * $serverStatusData->status['Key_read_requests']) : 0, // depends on Key_write_requests // normally nearly 1:1 'Key_writes' => isset($serverStatusData->status['Key_write_requests']) ? (0.9 * $serverStatusData->status['Key_write_requests']) : 0, 'Key_buffer_fraction' => 0.5, // alert if more than 95% of thread cache is in use 'Threads_cached' => isset($serverStatusData->variables['thread_cache_size']) ? 0.95 * $serverStatusData->variables['thread_cache_size'] : 0 // higher is better // variable => min value //'Handler read key' => '> ', ); $retval .= self::getHtmlForRenderVariables( $serverStatusData, $alerts, $strShowStatus ); return $retval; } /** * Returns HTML for render variables list * * @param Data $serverStatusData Server status data * @param array $alerts Alert Array * @param array $strShowStatus Status Array * * @return string */ public static function getHtmlForRenderVariables(Data $serverStatusData, array $alerts, array $strShowStatus) { $retval = '' . __('Variable') . ' | '; $retval .= '' . __('Value') . ' | '; $retval .= '' . __('Description') . ' | '; $retval .= '
---|---|---|
'; $retval .= htmlspecialchars(str_replace('_', ' ', $name)); // Fields containing % are calculated, // they can not be described in MySQL documentation if (mb_strpos($name, '%') === false) { $retval .= Util::showMySQLDocu( 'server-status-variables', false, 'statvar_' . $name ); } $retval .= ' | '; $retval .= ''; if (isset($alerts[$name])) { if ($value > $alerts[$name]) { $retval .= ''; } else { $retval .= ''; } } if (substr($name, -1) === '%') { $retval .= htmlspecialchars( Util::formatNumber($value, 0, 2) ) . ' %'; } elseif (strpos($name, 'Uptime') !== false) { $retval .= htmlspecialchars( Util::timespanFormat($value) ); } elseif (is_numeric($value) && $value > 1000) { $retval .= '' . htmlspecialchars(Util::formatNumber($value, 3, 1)) . ''; } elseif (is_numeric($value)) { $retval .= htmlspecialchars( Util::formatNumber($value, 3, 1) ); } else { $retval .= htmlspecialchars($value); } if (isset($alerts[$name])) { $retval .= ''; } $retval .= ''; $retval .= ' | '; $retval .= ''; if (isset($strShowStatus[$name])) { $retval .= $strShowStatus[$name]; } if (isset($serverStatusData->links[$name])) { foreach ($serverStatusData->links[$name] as $link_name => $link_url) { if ('doc' == $link_name) { $retval .= Util::showMySQLDocu($link_url); } else { $retval .= ' ' . $link_name . ''; } } unset($link_url, $link_name); } $retval .= ' | '; $retval .= '