From bfef230b91d6ab716c6d236b7c86e44c299b2098 Mon Sep 17 00:00:00 2001 From: Tyron Madlener Date: Thu, 11 Aug 2011 17:10:12 +0300 Subject: [PATCH 001/183] - New feature: Charting over calculated values through presets. Currently available: query cache efficiency and query cache usage - Fix sysinfo charts --- js/messages.php | 7 + js/server_status_monitor.js | 330 ++++++++++++++++++++++++------------ server_status.php | 145 ++++++++++------ 3 files changed, 320 insertions(+), 162 deletions(-) diff --git a/js/messages.php b/js/messages.php index 5122f11978..a6404fd9a7 100644 --- a/js/messages.php +++ b/js/messages.php @@ -90,6 +90,13 @@ $js_messages['strChartIssuedQueriesTitle'] = __('Questions (executed statements $js_messages['strChartQueryPie'] = __('Query statistics'); /* server status monitor */ +$js_messages['strIncompatibleMonitorConfig'] = __('Local monitor configuration icompatible'); +$js_messages['strIncompatibleMonitorConfigDescription'] = __('The chart arrangement configuration in your browsers local storage is not compatible anymore to the newer version of the monitor dialog. It is very likely that your current configuration will not work anymore. Please reset your configuration to default in the Settings menu.'); + +$js_messages['strQueryCacheEfficiency'] = __('Query cache efficiency'); +$js_messages['strQueryCacheUsage'] = __('Query cache usage'); +$js_messages['strQueryCacheUsed'] = __('Query cache used'); + $js_messages['strSystemCPUUsage'] = __('System CPU Usage'); $js_messages['strSystemMemory'] = __('System memory'); $js_messages['strSystemSwap'] = __('System swap'); diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js index cb01ca7934..0e45ebd23f 100644 --- a/js/server_status_monitor.js +++ b/js/server_status_monitor.js @@ -16,6 +16,11 @@ $(function() { // Holds about to created chart var newChart = null; var chartSpacing; + + // Whenever the monitor object (runtime.charts) or the settings object (monitorSettings) + // changes in a way incompatible to the previous version, increase this number + // It will reset the users monitor and settings object in his localStorage to the default configuration + var monitorProtocolVersion = '1.0'; // Runtime parameter of the monitor, is being fully set in initGrid() var runtime = { @@ -51,103 +56,158 @@ $(function() { // Allows drag and drop rearrange and print/edit icons on charts var editMode = false; - + + /* List of preconfigured charts that the user may select */ var presetCharts = { - 'cpu-WINNT': { - title: PMA_messages['strSystemCPUUsage'], - nodes: [{ dataType: 'cpu', name: PMA_messages['strAverageLoad'], dataPoint: 'loadavg', unit: '%'}] + // Query cache efficiency + 'qce': { + title: PMA_messages['strQueryCacheEfficiency'], + nodes: [ { + name: PMA_messages['strQueryCacheEfficiency'], + dataPoints: [{type: 'statusvar', name: 'Qcache_hits'}, {type: 'statusvar', name: 'Com_select'}], + unit: '%', + transformFn: 'qce' + } ] }, - 'memory-WINNT': { - title: PMA_messages['strSystemMemory'], - nodes: [ - { dataType: 'memory', name: PMA_messages['strTotalMemory'], dataPoint: 'MemTotal', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strUsedMemory'], dataPoint: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] } - ] - }, - 'swap-WINNT': { - title: PMA_messages['strSystemSwap'], - nodes: [ - { dataType: 'memory', name: PMA_messages['strTotalSwap'], dataPoint: 'SwapTotal', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strUsedSwap'], dataPoint: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] } - ] - }, - 'cpu-Linux': { - title: PMA_messages['strSystemCPUUsage'], - nodes: [ - { dataType: 'cpu', - name: PMA_messages['strAverageLoad'], - unit: '%', - transformFn: 'cpu-linux' - } - ] - }, - 'memory-Linux': { - title: PMA_messages['strSystemMemory'], - nodes: [ - { dataType: 'memory', name: PMA_messages['strUsedMemory'], dataPoint: 'MemUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strCachedMemory'], dataPoint: 'Cached', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strBufferedMemory'], dataPoint: 'Buffers', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strFreeMemory'], dataPoint: 'MemFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] } - ], - settings: { - chart: { - type: 'area', - animation: false - }, - plotOptions: { - area: { - stacking: 'percent' - } - } - } - }, - 'swap-Linux': { - title: PMA_messages['strSystemSwap'], - nodes: [ - { dataType: 'memory', name: PMA_messages['strTotalSwap'], dataPoint: 'SwapUsed', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strCachedSwap'], dataPoint: 'SwapCached', valueDivisor: 1024, unit: PMA_messages['strMiB'] }, - { dataType: 'memory', name: PMA_messages['strFreeSwap'], dataPoint: 'SwapFree', valueDivisor: 1024, unit: PMA_messages['strMiB'] } - ], - settings: { - chart: { - type: 'area', - animation: false - }, - plotOptions: { - area: { - stacking: 'percent' - } - } - } + // Query cache usage + 'qcu': { + title: PMA_messages['strQueryCacheUsage'], + nodes: [ { + name: PMA_messages['strQueryCacheUsed'], + dataPoints: [{type: 'statusvar', name: 'Qcache_free_memory'}, {type: 'servervar', name: 'query_cache_size'}], + unit: '%', + transformFn: 'qcu' + } ] } }; + + /* Add OS specific system info charts to the preset chart list */ + switch(server_os) { + case 'WINNT': + $.extend(presetCharts, { + 'cpu': { + title: PMA_messages['strSystemCPUUsage'], + nodes: [ { + name: PMA_messages['strAverageLoad'], + dataPoints: [{ type: 'cpu', name: 'loadavg'}], + unit: '%' + } ] + }, + + 'memory': { + title: PMA_messages['strSystemMemory'], + nodes: [ { + name: PMA_messages['strTotalMemory'], + dataPoints: [{ type: 'memory', name: 'MemTotal' }], + valueDivisor: 1024, + unit: PMA_messages['strMiB'] + }, { + dataType: 'memory', + name: PMA_messages['strUsedMemory'], + dataPoints: [{ type: 'memory', name: 'MemUsed' }], + valueDivisor: 1024, + unit: PMA_messages['strMiB'] + } ] + }, + + 'swap': { + title: PMA_messages['strSystemSwap'], + nodes: [ { + name: PMA_messages['strTotalSwap'], + dataPoints: [{ type: 'memory', name: 'SwapTotal' }], + valueDivisor: 1024, + unit: PMA_messages['strMiB'] + }, { + name: PMA_messages['strUsedSwap'], + dataPoints: [{ type: 'memory', name: 'SwapUsed' }], + valueDivisor: 1024, + unit: PMA_messages['strMiB'] + } ] + } + }); + break; + + case 'Linux': + $.extend(presetCharts, { + 'cpu': { + title: PMA_messages['strSystemCPUUsage'], + nodes: [ { + name: PMA_messages['strAverageLoad'], + dataPoints: [{ type: 'cpu', name: 'irrelevant' }], + unit: '%', + transformFn: 'cpu-linux' + } ] + }, + 'memory': { + title: PMA_messages['strSystemMemory'], + nodes: [ + { name: PMA_messages['strUsedMemory'], dataPoints: [{ type: 'memory', name: 'MemUsed' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { name: PMA_messages['strCachedMemory'], dataPoints: [{ type: 'memory', name: 'Cached' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { name: PMA_messages['strBufferedMemory'], dataPoints: [{ type: 'memory', name: 'Buffers' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { name: PMA_messages['strFreeMemory'], dataPoints: [{ type: 'memory', name: 'MemFree' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] } + ], + settings: { + chart: { + type: 'area', + animation: false + }, + plotOptions: { + area: { + stacking: 'percent' + } + } + } + }, + 'swap': { + title: PMA_messages['strSystemSwap'], + nodes: [ + { name: PMA_messages['strTotalSwap'], dataPoints: [{ type: 'memory', name: 'SwapUsed' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { name: PMA_messages['strCachedSwap'], dataPoints: [{ type: 'memory', name: 'SwapCached' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] }, + { name: PMA_messages['strFreeSwap'], dataPoints: [{ type: 'memory', name: 'SwapFree' }], valueDivisor: 1024, unit: PMA_messages['strMiB'] } + ], + settings: { + chart: { + type: 'area', + animation: false + }, + plotOptions: { + area: { + stacking: 'percent' + } + } + } + } + }); + break; + } - // Default setting + // Default setting for the chart grid defaultChartGrid = { 'c0': { title: PMA_messages['strQuestions'], - nodes: [{ dataType: 'statusvar', name: PMA_messages['strQuestions'], dataPoint: 'Questions', display: 'differential' }] + nodes: [{name: PMA_messages['strQuestions'], dataPoints: [{ type: 'statusvar', name: 'Questions' }], display: 'differential' }] }, 'c1': { title: PMA_messages['strChartConnectionsTitle'], - nodes: [ { dataType: 'statusvar', name: PMA_messages['strConnections'], dataPoint: 'Connections', display: 'differential' }, - { dataType: 'proc', name: PMA_messages['strProcesses'], dataPoint: 'processes'} ] + nodes: [ { name: PMA_messages['strConnections'], dataPoints: [{ type: 'statusvar', name: 'Connections' }], display: 'differential' }, + { name: PMA_messages['strProcesses'], dataPoints: [{ type: 'proc', name: 'processes' }] } ] }, 'c2': { title: PMA_messages['strTraffic'], nodes: [ - { dataType: 'statusvar', name: PMA_messages['strBytesSent'], dataPoint: 'Bytes_sent', display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] }, - { dataType: 'statusvar', name: PMA_messages['strBytesReceived'], dataPoint: 'Bytes_received', display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] } + { name: PMA_messages['strBytesSent'], dataPoints: [{ type: 'statusvar', name: 'Bytes_sent' }], display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] }, + { name: PMA_messages['strBytesReceived'], dataPoints: [{ type: 'statusvar', name: 'Bytes_received' }], display: 'differential', valueDivisor: 1024, unit: PMA_messages['strKiB'] } ] } }; - // Server is localhost => We can add cpu/memory/swap + // Server is localhost => We can add cpu/memory/swap to the default chart if (server_db_isLocal) { - defaultChartGrid['c3'] = presetCharts['cpu-' + server_os]; - defaultChartGrid['c4'] = presetCharts['memory-' + server_os]; - defaultChartGrid['c5'] = presetCharts['swap-' + server_os]; + defaultChartGrid['c3'] = presetCharts['cpu']; + defaultChartGrid['c4'] = presetCharts['memory']; + defaultChartGrid['c5'] = presetCharts['swap']; } + /* Buttons that are on the top right corner of each chart */ var gridbuttons = { cogButton: { //enabled: true, @@ -368,9 +428,11 @@ $(function() { dlgButtons[PMA_messages['strAddChart']] = function() { var type = $('input[name="chartType"]:checked').val(); - if (type == 'cpu' || type == 'memory' || type == 'swap') { - newChart = presetCharts[type + '-' + server_os]; + if (type == 'preset') { + newChart = presetCharts[$('div#addChartDialog select[name="presetCharts"]').prop('value')]; } else { + // If user builds his own chart, it's being set/updated each time he adds a series + // So here we only warn if he didn't add a series yet if (! newChart || ! newChart.nodes || newChart.nodes.length == 0) { alert(PMA_messages['strAddOneSeriesWarning']); return; @@ -395,6 +457,17 @@ $(function() { $(this).dialog("close"); }; + var $presetList = $('div#addChartDialog select[name="presetCharts"]'); + if ($presetList.html().length == 0) { + $.each(presetCharts, function(key, value) { + $presetList.append(''); + }); + $presetList.change(function() { + $('input#chartPreset').trigger('click'); + $('input[name="chartTitle"]').attr('value', presetCharts[$(this).prop('value')].title); + }); + } + $('div#addChartDialog').dialog({ width: 'auto', height: 'auto', @@ -712,8 +785,7 @@ $(function() { } var serie = { - dataType: 'statusvar', - dataPoint: $('input#variableInput').attr('value'), + dataPoints: [{ type: 'statusvar', name: $('input#variableInput').attr('value') }], name: $('input#variableInput').attr('value'), display: $('input[name="differentialValue"]').attr('checked') ? 'differential' : '' }; @@ -760,7 +832,7 @@ $(function() { var series; /* Apply default values & config */ - if (window.localStorage) { + if (window.localStorage && monitorProtocolVersion == window.localStorage['monitorVersion']) { if (window.localStorage['monitorCharts']) { runtime.charts = $.parseJSON(window.localStorage['monitorCharts']); } @@ -770,6 +842,19 @@ $(function() { $('a[href="#clearMonitorConfig"]').toggle(runtime.charts != null); } + + if (window.localStorage && monitorProtocolVersion != window.localStorage['monitorVersion']) { + $('div#emptyDialog').attr('title',PMA_messages['strIncompatibleMonitorConfig']); + $('div#emptyDialog').html(PMA_messages['strIncompatibleMonitorConfigDescription']); + + var dlgBtns = {}; + dlgBtns[PMA_messages['strClose']] = function() { $(this).dialog('close'); }; + + $('div#emptyDialog').dialog({ + width: 400, + buttons: dlgBtns + }); + } if (runtime.charts == null) { runtime.charts = defaultChartGrid; @@ -1114,10 +1199,8 @@ $(function() { if (! chartData[key]) { return; } - // Draw all points + // Draw all series for (var j = 0; j < elem.nodes.length; j++) { - value = chartData[key][j].y; - // Update x-axis if (i == 0 && j == 0) { if (oldChartData == null) { @@ -1132,24 +1215,32 @@ $(function() { elem.chart.xAxis[0].setExtremes(runtime.xmin, runtime.xmax, false); - // Calculate y value - if (elem.nodes[j].display == 'differential') { - if (oldChartData == null || oldChartData[key] == null) { - continue; - } - value -= oldChartData[key][j].y; - } - - if (elem.nodes[j].valueDivisor) { - value = value / elem.nodes[j].valueDivisor; - } - + /* Calculate y value */ + + // If transform function given, use it if (elem.nodes[j].transformFn) { value = chartValueTransform( elem.nodes[j].transformFn, chartData[key][j], - (oldChartData == null ? null : oldChartData[key][j]) + // Check if first iteration (oldChartData==null), or if newly added chart oldChartData[key]==null + (oldChartData == null || oldChartData[key] == null ? null : oldChartData[key][j]) ); + + // Otherwise use original value and apply differential and divisor if given, + // in this case we have only one data point per series - located at chartData[key][j][0] + } else { + value = parseFloat(chartData[key][j][0].value); + + if (elem.nodes[j].display == 'differential') { + if (oldChartData == null || oldChartData[key] == null) { + continue; + } + value -= oldChartData[key][j][0].value; + } + + if (elem.nodes[j].valueDivisor) { + value = value / elem.nodes[j].valueDivisor; + } } // Set y value, if defined @@ -1177,28 +1268,50 @@ $(function() { } /* Function that supplies special value transform functions for chart values */ - function chartValueTransform(name, cur, prev) { + function chartValueTransform(name, cur, prev) { switch(name) { - case 'cpu-linux': - if (prev == null) { - return undefined; - } - - var diff_total = cur.busy + cur.idle - (prev.busy + prev.idle); - var diff_idle = cur.idle - prev.idle; - return 100*(diff_total - diff_idle) / diff_total; + case 'cpu-linux': + if (prev == null) { + return undefined; + } + // cur and prev are datapoint arrays, but containing only 1 element for cpu-linux + cur = cur[0], prev = prev[0]; + + var diff_total = cur.busy + cur.idle - (prev.busy + prev.idle); + var diff_idle = cur.idle - prev.idle; + return 100 * (diff_total - diff_idle) / diff_total; + + // Query cache efficiency (%) + case 'qce': + if (prev == null) { + return undefined; + } + // cur[0].value is Qcache_hits, cur[1].value is Com_select + var diffQHits = cur[0].value - prev[0].value; + return diffQHits / (cur[1].value - prev[1].value + diffQHits) * 100; + + // Query cache usage (%) + case 'qcu': + // cur[0].value is Qcache_free_memory, cur[1].value is query_cache_size + return 100 - cur[0].value / cur[1].value * 100; + } return undefined; } - /* Build list of nodes that need to be retrieved from server */ + /* Build list of nodes that need to be retrieved from server. + * It creates something like a stripped down version of the runtime.charts object. + */ function buildRequiredDataList() { runtime.dataList = {}; // Store an own id, because the property name is subject of reordering, // thus destroying our mapping with runtime.charts <=> runtime.dataList var chartID = 0; $.each(runtime.charts, function(key, chart) { - runtime.dataList[chartID] = chart.nodes; + runtime.dataList[chartID] = []; + for(var i=0; i < chart.nodes.length; i++) { + runtime.dataList[chartID][i] = chart.nodes[i].dataPoints; + } runtime.charts[key].chartID = chartID; chartID++; }); @@ -1746,6 +1859,7 @@ $(function() { if (window.localStorage) { window.localStorage['monitorCharts'] = $.toJSON(gridCopy); window.localStorage['monitorSettings'] = $.toJSON(monitorSettings); + window.localStorage['monitorVersion'] = monitorProtocolVersion; } $('a[href="#clearMonitorConfig"]').show(); diff --git a/server_status.php b/server_status.php index 751736275e..cdbe9bbe52 100644 --- a/server_status.php +++ b/server_status.php @@ -31,6 +31,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { // real-time charting data if (isset($_REQUEST['chart_data'])) { switch($_REQUEST['type']) { + // Process and Connections realtime chart case 'proc': $c = PMA_DBI_fetch_result("SHOW GLOBAL STATUS WHERE Variable_name = 'Connections'", 0, 1); $result = PMA_DBI_query('SHOW PROCESSLIST'); @@ -44,6 +45,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { exit(json_encode($ret)); + // Query realtime chart case 'queries': $queries = PMA_DBI_fetch_result( "SHOW GLOBAL STATUS @@ -64,6 +66,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { exit(json_encode($ret)); + // Traffic realtime chart case 'traffic': $traffic = PMA_DBI_fetch_result( "SHOW GLOBAL STATUS @@ -78,63 +81,105 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { exit(json_encode($ret)); + // Data for the monitor case 'chartgrid': $ret = json_decode($_REQUEST['requiredData'], true); $statusVars = array(); + $serverVars = array(); $sysinfo = $cpuload = $memory = 0; + $pName = ''; + /* Accumulate all required variables and data */ + // For each chart foreach ($ret as $chart_id => $chartNodes) { - foreach ($chartNodes as $node_id => $node) { - switch ($node['dataType']) { - case 'statusvar': - // Some white list filtering - if (!preg_match('/[^a-zA-Z_]+/', $node['dataPoint'])) - $statusVars[] = $node['dataPoint']; - break; + // For each data series + foreach ($chartNodes as $node_id => $nodeDataPoints) { + // For each data point in the series (usually just 1) + foreach ($nodeDataPoints as $point_id => $dataPoint) { + $pName = $dataPoint['name']; + + switch ($dataPoint['type']) { + /* We only collect the status and server variables here to + * read them all in one query, and only afterwards assign them. + * Also do some white list filtering on the names + */ + case 'servervar': + if (!preg_match('/[^a-zA-Z_]+/', $pName)) + $serverVars[] = $pName; + break; - case 'proc': - $result = PMA_DBI_query('SHOW PROCESSLIST'); - $ret[$chart_id][$node_id]['y'] = PMA_DBI_num_rows($result); - break; + case 'statusvar': + if (!preg_match('/[^a-zA-Z_]+/', $pName)) + $statusVars[] = $pName; + break; - case 'cpu': - if (!$sysinfo) { - require_once('libraries/sysinfo.lib.php'); - $sysinfo = getSysInfo(); - } - if (!$cpuload) - $cpuload = $sysinfo->loadavg(); + case 'proc': + $result = PMA_DBI_query('SHOW PROCESSLIST'); + $ret[$chart_id][$node_id][$point_id]['value'] = PMA_DBI_num_rows($result); + break; - if (PHP_OS == 'Linux') { - $ret[$chart_id][$node_id]['idle'] = $cpuload['idle']; - $ret[$chart_id][$node_id]['busy'] = $cpuload['busy']; - } else - $ret[$chart_id][$node_id]['y'] = $cpuload['loadavg']; + case 'cpu': + if (!$sysinfo) { + require_once('libraries/sysinfo.lib.php'); + $sysinfo = getSysInfo(); + } + if (!$cpuload) + $cpuload = $sysinfo->loadavg(); - break; + if (PHP_OS == 'Linux') { + $ret[$chart_id][$node_id][$point_id]['idle'] = $cpuload['idle']; + $ret[$chart_id][$node_id][$point_id]['busy'] = $cpuload['busy']; + } else + $ret[$chart_id][$node_id][$point_id]['value'] = $cpuload['loadavg']; - case 'memory': - if (!$sysinfo) { - require_once('libraries/sysinfo.lib.php'); - $sysinfo = getSysInfo(); - } - if (!$memory) - $memory = $sysinfo->memory(); + break; - $ret[$chart_id][$node_id]['y'] = $memory[$node['dataPoint']]; - break; + case 'memory': + if (!$sysinfo) { + require_once('libraries/sysinfo.lib.php'); + $sysinfo = getSysInfo(); + } + if (!$memory) + $memory = $sysinfo->memory(); + + $ret[$chart_id][$node_id][$point_id]['value'] = $memory[$pName]; + break; + } } } } - $vars = PMA_DBI_fetch_result( - "SHOW GLOBAL STATUS - WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1); + // Retrieve all required status variables + if (count($statusVars)) { + $statusVarValues = PMA_DBI_fetch_result( + "SHOW GLOBAL STATUS + WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1); + } else { + $statusVarValues = array(); + } + + // Retrieve all required server variables + if (count($serverVars)) { + $serverVarValues = PMA_DBI_fetch_result( + "SHOW GLOBAL VARIABLES + WHERE Variable_name='" . implode("' OR Variable_name='", $serverVars) . "'", 0, 1); + } else { + $serverVarValues = array(); + } + // ...and now assign them foreach ($ret as $chart_id => $chartNodes) { - foreach ($chartNodes as $node_id => $node) { - if ($node['dataType'] == 'statusvar') - $ret[$chart_id][$node_id]['y'] = $vars[$node['dataPoint']]; + foreach ($chartNodes as $node_id => $nodeDataPoints) { + foreach ($nodeDataPoints as $point_id => $dataPoint) { + switch($dataPoint['type']) { + case 'statusvar': + $ret[$chart_id][$node_id][$point_id]['value'] = $statusVarValues[$dataPoint['name']]; + break; + case 'servervar': + $ret[$chart_id][$node_id][$point_id]['value'] = $serverVarValues[$dataPoint['name']]; + break; + } + } } } @@ -594,12 +639,9 @@ if (isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) { } } -$server = 1; -if (isset($_REQUEST['server']) && intval($_REQUEST['server'])) $server = intval($_REQUEST['server']); - -$server_db_isLocal = strtolower($cfg['Servers'][$server]['host']) == 'localhost' - || $cfg['Servers'][$server]['host'] == '127.0.0.1' - || $cfg['Servers'][$server]['host'] == '::1'; +$server_db_isLocal = strtolower($cfg['Server']['host']) == 'localhost' + || $cfg['Server']['host'] == '127.0.0.1' + || $cfg['Server']['host'] == '::1'; PMA_AddJSCode('pma_token = \'' . $_SESSION[' PMA_token '] . "';\n" . 'url_query = \'' . str_replace('&', '&', PMA_generate_common_url($db)) . "';\n" . @@ -1466,16 +1508,11 @@ function printMonitor()