Translated using Weblate (Interlingua)
[phpmyadmin.git] / server_status_monitor.php
blob7bfc6ac597bc570664b9e9ac58ea69c421382693
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Server status monitor feature
6 * @package PhpMyAdmin
7 */
9 use PhpMyAdmin\Server\Status\Monitor;
10 use PhpMyAdmin\Server\Status\Data;
11 use PhpMyAdmin\Response;
13 require_once 'libraries/common.inc.php';
14 require_once 'libraries/server_common.inc.php';
15 require_once 'libraries/replication.inc.php';
17 $response = Response::getInstance();
19 /**
20 * Ajax request
22 if ($response->isAjax()) {
23 // Send with correct charset
24 header('Content-Type: text/html; charset=UTF-8');
26 // real-time charting data
27 if (isset($_REQUEST['chart_data'])) {
28 switch($_REQUEST['type']) {
29 case 'chartgrid': // Data for the monitor
30 $ret = Monitor::getJsonForChartingData();
31 $response->addJSON('message', $ret);
32 exit;
36 if (isset($_REQUEST['log_data'])) {
38 $start = intval($_REQUEST['time_start']);
39 $end = intval($_REQUEST['time_end']);
41 if ($_REQUEST['type'] == 'slow') {
42 $return = Monitor::getJsonForLogDataTypeSlow($start, $end);
43 $response->addJSON('message', $return);
44 exit;
47 if ($_REQUEST['type'] == 'general') {
48 $return = Monitor::getJsonForLogDataTypeGeneral($start, $end);
49 $response->addJSON('message', $return);
50 exit;
54 if (isset($_REQUEST['logging_vars'])) {
55 $loggingVars = Monitor::getJsonForLoggingVars();
56 $response->addJSON('message', $loggingVars);
57 exit;
60 if (isset($_REQUEST['query_analyzer'])) {
61 $return = Monitor::getJsonForQueryAnalyzer();
62 $response->addJSON('message', $return);
63 exit;
67 /**
68 * JS Includes
70 $header = $response->getHeader();
71 $scripts = $header->getScripts();
72 $scripts->addFile('vendor/jquery/jquery.tablesorter.js');
73 $scripts->addFile('vendor/jquery/jquery.sortableTable.js');
74 $scripts->addFile('vendor/jquery/jquery-ui-timepicker-addon.js');
75 // for charting
76 $scripts->addFile('vendor/jqplot/jquery.jqplot.js');
77 $scripts->addFile('vendor/jqplot/plugins/jqplot.pieRenderer.js');
78 $scripts->addFile('vendor/jqplot/plugins/jqplot.enhancedPieLegendRenderer.js');
79 $scripts->addFile('vendor/jqplot/plugins/jqplot.canvasTextRenderer.js');
80 $scripts->addFile('vendor/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js');
81 $scripts->addFile('vendor/jqplot/plugins/jqplot.dateAxisRenderer.js');
82 $scripts->addFile('vendor/jqplot/plugins/jqplot.highlighter.js');
83 $scripts->addFile('vendor/jqplot/plugins/jqplot.cursor.js');
84 $scripts->addFile('jqplot/plugins/jqplot.byteFormatter.js');
86 $scripts->addFile('server_status_monitor.js');
87 $scripts->addFile('server_status_sorter.js');
90 /**
91 * start output
93 $serverStatusData = new Data();
95 /**
96 * Output
98 $response->addHTML('<div>');
99 $response->addHTML($serverStatusData->getMenuHtml());
100 $response->addHTML(Monitor::getHtmlForMonitor($serverStatusData));
101 $response->addHTML(Monitor::getHtmlForClientSideDataAndLinks($serverStatusData));
102 $response->addHTML('</div>');
103 exit;