Translated using Weblate (Norwegian Bokmål)
[phpmyadmin.git] / server_status_monitor.php
blobec676d17c52acc2d40229ba66d7438344c855cbf
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;
10 use PMA\libraries\Response;
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/server_common.inc.php';
14 require_once 'libraries/server_status_monitor.lib.php';
15 require_once 'libraries/replication.inc.php';
16 require_once 'libraries/replication_gui.lib.php';
18 $response = Response::getInstance();
20 /**
21 * Ajax request
23 if ($response->isAjax()) {
24 // Send with correct charset
25 header('Content-Type: text/html; charset=UTF-8');
27 // real-time charting data
28 if (isset($_REQUEST['chart_data'])) {
29 switch($_REQUEST['type']) {
30 case 'chartgrid': // Data for the monitor
31 $ret = PMA_getJsonForChartingData();
32 $response->addJSON('message', $ret);
33 exit;
37 if (isset($_REQUEST['log_data'])) {
39 $start = intval($_REQUEST['time_start']);
40 $end = intval($_REQUEST['time_end']);
42 if ($_REQUEST['type'] == 'slow') {
43 $return = PMA_getJsonForLogDataTypeSlow($start, $end);
44 $response->addJSON('message', $return);
45 exit;
48 if ($_REQUEST['type'] == 'general') {
49 $return = PMA_getJsonForLogDataTypeGeneral($start, $end);
50 $response->addJSON('message', $return);
51 exit;
55 if (isset($_REQUEST['logging_vars'])) {
56 $loggingVars = PMA_getJsonForLoggingVars();
57 $response->addJSON('message', $loggingVars);
58 exit;
61 if (isset($_REQUEST['query_analyzer'])) {
62 $return = PMA_getJsonForQueryAnalyzer();
63 $response->addJSON('message', $return);
64 exit;
68 /**
69 * JS Includes
71 $header = $response->getHeader();
72 $scripts = $header->getScripts();
73 $scripts->addFile('jquery/jquery.tablesorter.js');
74 $scripts->addFile('jquery/jquery.sortableTable.js');
75 $scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
76 // for charting
77 $scripts->addFile('jqplot/jquery.jqplot.js');
78 $scripts->addFile('jqplot/plugins/jqplot.pieRenderer.js');
79 $scripts->addFile('jqplot/plugins/jqplot.canvasTextRenderer.js');
80 $scripts->addFile('jqplot/plugins/jqplot.canvasAxisLabelRenderer.js');
81 $scripts->addFile('jqplot/plugins/jqplot.dateAxisRenderer.js');
82 $scripts->addFile('jqplot/plugins/jqplot.highlighter.js');
83 $scripts->addFile('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 ServerStatusData();
95 /**
96 * Output
98 $response->addHTML('<div>');
99 $response->addHTML($ServerStatusData->getMenuHtml());
100 $response->addHTML(PMA_getHtmlForMonitor($ServerStatusData));
101 $response->addHTML(PMA_getHtmlForClientSideDataAndLinks($ServerStatusData));
102 $response->addHTML('</div>');
103 exit;