Translated using Weblate (French)
[phpmyadmin.git] / server_status_monitor.php
blobdc88e8f31ccba68fd008cbebf4871e35eed1e84f
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Server status monitor feature
6 * @package PhpMyAdmin
7 */
9 use PMA\libraries\ServerStatusData;
11 require_once 'libraries/common.inc.php';
12 require_once 'libraries/server_common.inc.php';
13 require_once 'libraries/server_status_monitor.lib.php';
14 require_once 'libraries/replication.inc.php';
15 require_once 'libraries/replication_gui.lib.php';
17 /**
18 * Ajax request
20 if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
21 // Send with correct charset
22 header('Content-Type: text/html; charset=UTF-8');
24 // real-time charting data
25 if (isset($_REQUEST['chart_data'])) {
26 switch($_REQUEST['type']) {
27 case 'chartgrid': // Data for the monitor
28 $ret = PMA_getJsonForChartingData();
29 PMA\libraries\Response::getInstance()->addJSON('message', $ret);
30 exit;
34 if (isset($_REQUEST['log_data'])) {
36 $start = intval($_REQUEST['time_start']);
37 $end = intval($_REQUEST['time_end']);
39 if ($_REQUEST['type'] == 'slow') {
40 $return = PMA_getJsonForLogDataTypeSlow($start, $end);
41 PMA\libraries\Response::getInstance()->addJSON('message', $return);
42 exit;
45 if ($_REQUEST['type'] == 'general') {
46 $return = PMA_getJsonForLogDataTypeGeneral($start, $end);
47 PMA\libraries\Response::getInstance()->addJSON('message', $return);
48 exit;
52 if (isset($_REQUEST['logging_vars'])) {
53 $loggingVars = PMA_getJsonForLoggingVars();
54 PMA\libraries\Response::getInstance()->addJSON('message', $loggingVars);
55 exit;
58 if (isset($_REQUEST['query_analyzer'])) {
59 $return = PMA_getJsonForQueryAnalyzer();
60 PMA\libraries\Response::getInstance()->addJSON('message', $return);
61 exit;
65 /**
66 * JS Includes
68 $header = $response->getHeader();
69 $scripts = $header->getScripts();
70 $scripts->addFile('jquery/jquery.tablesorter.js');
71 $scripts->addFile('jquery/jquery.sortableTable.js');
72 $scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
73 // for charting
74 $scripts->addFile('jqplot/jquery.jqplot.js');
75 $scripts->addFile('jqplot/plugins/jqplot.pieRenderer.js');
76 $scripts->addFile('jqplot/plugins/jqplot.canvasTextRenderer.js');
77 $scripts->addFile('jqplot/plugins/jqplot.canvasAxisLabelRenderer.js');
78 $scripts->addFile('jqplot/plugins/jqplot.dateAxisRenderer.js');
79 $scripts->addFile('jqplot/plugins/jqplot.highlighter.js');
80 $scripts->addFile('jqplot/plugins/jqplot.cursor.js');
81 $scripts->addFile('jqplot/plugins/jqplot.byteFormatter.js');
83 $scripts->addFile('server_status_monitor.js');
84 $scripts->addFile('server_status_sorter.js');
87 /**
88 * start output
90 $ServerStatusData = new ServerStatusData();
92 /**
93 * Output
95 $response->addHTML('<div>');
96 $response->addHTML($ServerStatusData->getMenuHtml());
97 $response->addHTML(PMA_getHtmlForMonitor($ServerStatusData));
98 $response->addHTML(PMA_getHtmlForClientSideDataAndLinks($ServerStatusData));
99 $response->addHTML('</div>');
100 exit;