diff --git a/pandora_console/extras/mr/66.sql b/pandora_console/extras/mr/66.sql
new file mode 100644
index 0000000000..909edd7ca7
--- /dev/null
+++ b/pandora_console/extras/mr/66.sql
@@ -0,0 +1,12 @@
+START TRANSACTION;
+
+CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
+`id` INT NOT NULL auto_increment,
+`filter_name` VARCHAR(45) NULL,
+`user_id` VARCHAR(255) NULL,
+`graph_modules` TEXT NULL,
+`interval` INT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
+
+COMMIT;
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index 4fa87f70cb..0895325ef5 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -270,7 +270,8 @@ function format_for_graph(
$dec_point='.',
$thousands_sep=',',
$divider=1000,
- $sufix=''
+ $sufix='',
+ $two_lines=false
) {
// Exception to exclude modules whose unit is already formatted as KB (satellite modules)
if (!empty($sufix) && $sufix == 'KB') {
@@ -297,6 +298,10 @@ function format_for_graph(
}
// This will actually do the rounding and the decimals.
+ if ($two_lines === true) {
+ return remove_right_zeros(format_numeric($number, $decimals)).'
'.$shorts[$pos].$sufix;
+ }
+
return remove_right_zeros(format_numeric($number, $decimals)).$shorts[$pos].$sufix;
}
@@ -4046,25 +4051,49 @@ function series_type_graph_array($data, $show_elements_graph)
}
} else {
$name_legend = '';
- if (isset($show_elements_graph['fullscale']) === true
- && (int) $show_elements_graph['fullscale'] === 1
- ) {
- $name_legend .= 'Tip: ';
- } else {
- $name_legend .= 'Avg: ';
- }
- if ($value['unit']) {
- $name_legend .= $value['agent_alias'];
- $name_legend .= ' / ';
- $name_legend .= $value['module_name'];
- $name_legend .= ' / ';
- $name_legend .= __('Unit ').' ';
- $name_legend .= $value['unit'].': ';
+ if ($show_elements_graph['graph_analytics'] === true) {
+ $name_legend .= '
';
+ $name_legend .= '
';
+ $name_legend .= '';
+ $name_legend .= format_for_graph(
+ end(end($value['data'])),
+ 1,
+ $config['decimal_separator'],
+ $config['thousand_separator'],
+ 1000,
+ '',
+ true
+ );
+ $name_legend .= '';
+ $name_legend .= ''.$value['unit'].'';
+ $name_legend .= '
';
+ $name_legend .= '
';
+ $name_legend .= ''.$value['agent_alias'].'';
+ $name_legend .= ''.$value['module_name'].'';
+ $name_legend .= '
';
+ $name_legend .= '
';
} else {
- $name_legend .= $value['agent_alias'];
- $name_legend .= ' / ';
- $name_legend .= $value['module_name'].': ';
+ if (isset($show_elements_graph['fullscale']) === true
+ && (int) $show_elements_graph['fullscale'] === 1
+ ) {
+ $name_legend .= 'Tip: ';
+ } else {
+ $name_legend .= 'Avg: ';
+ }
+
+ if ($value['unit']) {
+ $name_legend .= $value['agent_alias'];
+ $name_legend .= ' / ';
+ $name_legend .= $value['module_name'];
+ $name_legend .= ' / ';
+ $name_legend .= __('Unit ').' ';
+ $name_legend .= $value['unit'].': ';
+ } else {
+ $name_legend .= $value['agent_alias'];
+ $name_legend .= ' / ';
+ $name_legend .= $value['module_name'].': ';
+ }
}
}
}
@@ -4085,28 +4114,30 @@ function series_type_graph_array($data, $show_elements_graph)
$value['max'] = 0;
}
- $data_return['legend'][$key] .= ''.__('Min').' '.remove_right_zeros(
- number_format(
- $value['min'],
- $config['graph_precision'],
- $config['csv_decimal_separator'],
- $config['csv_decimal_separator'] == ',' ? '.' : ','
- )
- ).' '.$value['unit'].' '.__('Max').' '.remove_right_zeros(
- number_format(
- $value['max'],
- $config['graph_precision'],
- $config['csv_decimal_separator'],
- $config['csv_decimal_separator'] == ',' ? '.' : ','
- )
- ).' '.$value['unit'].' '._('Avg.').' '.remove_right_zeros(
- number_format(
- $value['avg'],
- $config['graph_precision'],
- $config['csv_decimal_separator'],
- $config['csv_decimal_separator'] == ',' ? '.' : ','
- )
- ).' '.$value['unit'].' '.$str;
+ if (isset($show_elements_graph['graph_analytics']) === false) {
+ $data_return['legend'][$key] .= ''.__('Min').' '.remove_right_zeros(
+ number_format(
+ $value['min'],
+ $config['graph_precision'],
+ $config['csv_decimal_separator'],
+ $config['csv_decimal_separator'] == ',' ? '.' : ','
+ )
+ ).' '.$value['unit'].' '.__('Max').' '.remove_right_zeros(
+ number_format(
+ $value['max'],
+ $config['graph_precision'],
+ $config['csv_decimal_separator'],
+ $config['csv_decimal_separator'] == ',' ? '.' : ','
+ )
+ ).' '.$value['unit'].' '._('Avg.').' '.remove_right_zeros(
+ number_format(
+ $value['avg'],
+ $config['graph_precision'],
+ $config['csv_decimal_separator'],
+ $config['csv_decimal_separator'] == ',' ? '.' : ','
+ )
+ ).' '.$value['unit'].' '.$str;
+ }
if ($show_elements_graph['compare'] == 'overlapped'
&& $key == 'sum2'
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 1892b0cd31..6fa1e2a8d5 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -5540,3 +5540,23 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
$options
);
}
+
+
+function graph_analytics_filter_select()
+{
+ global $config;
+
+ $result = [];
+
+ if (check_acl($config['id_user'], 0, 'RW') === 1 || check_acl($config['id_user'], 0, 'RM') === 1) {
+ $filters = db_get_all_rows_sql('SELECT id, filter_name FROM tgraph_analytics_filter WHERE user_id = "'.$config['id_user'].'"');
+
+ if ($filters !== false) {
+ foreach ($filters as $filter) {
+ $result[$filter['id']] = $filter['filter_name'];
+ }
+ }
+ }
+
+ return $result;
+}
diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js
index 93c7a9fb06..37162f5a37 100644
--- a/pandora_console/include/graphs/flot/pandora.flot.js
+++ b/pandora_console/include/graphs/flot/pandora.flot.js
@@ -995,6 +995,9 @@ function pandoraFlotSlicebar(
}
}
+// Set array for realtime graphs
+var realtimeGraphs = [];
+
// eslint-disable-next-line no-unused-vars
function pandoraFlotArea(
graph_id,
@@ -1007,6 +1010,21 @@ function pandoraFlotArea(
params,
events_array
) {
+ // Realtime graphs.
+ if (typeof params.realtime !== "undefined") {
+ realtimeGraphs.push({
+ graph_id,
+ values,
+ legend,
+ series_type,
+ color,
+ date_array,
+ data_module_graph,
+ params,
+ events_array
+ });
+ }
+
//diferents vars
var unit = params.unit ? params.unit : "";
var homeurl = params.homeurl;
@@ -2462,15 +2480,23 @@ function pandoraFlotArea(
if (Object.keys(update_legend).length == 0) {
label_aux = legend[series.label];
- $("#legend_" + graph_id + " .legendLabel")
- .eq(i)
- .html(
- label_aux +
- " value = " +
- number_format(y, 0, "", short_data, divisor) +
- " " +
- unit
- );
+ if (params.graph_analytics === true) {
+ var numberParams = {};
+ numberParams.twoLines = true;
+ $("#legend_" + graph_id + " .legendLabel .square-value")
+ .eq(i)
+ .html(number_format(y, 0, "", 1, divisor, numberParams));
+ } else {
+ $("#legend_" + graph_id + " .legendLabel")
+ .eq(i)
+ .html(
+ label_aux +
+ " value = " +
+ number_format(y, 0, "", short_data, divisor) +
+ " " +
+ unit
+ );
+ }
} else {
$.each(update_legend, function(index, value) {
if (typeof value[x - 1] !== "undefined") {
@@ -2844,12 +2870,16 @@ function pandoraFlotArea(
// Add bottom margin in the legend
// Estimated height of 24 (works fine with this data in all browsers)
$("#legend_" + graph_id).css("margin-bottom", "10px");
- parent_height = parseInt(
- $("#menu_" + graph_id)
- .parent()
- .css("height")
- .split("px")[0]
- );
+
+ if (typeof params.realtime === "undefined" || params.realtime === false) {
+ parent_height = parseInt(
+ $("#menu_" + graph_id)
+ .parent()
+ .css("height")
+ .split("px")[0]
+ );
+ }
+
adjust_menu(graph_id, plot, parent_height, width, show_legend);
}
}
@@ -2987,7 +3017,14 @@ function check_adaptions(graph_id) {
});
}
-function number_format(number, force_integer, unit, short_data, divisor) {
+function number_format(
+ number,
+ force_integer,
+ unit,
+ short_data,
+ divisor,
+ params
+) {
divisor = typeof divisor !== "undefined" ? divisor : 1000;
var decimals = 2;
@@ -3029,6 +3066,11 @@ function number_format(number, force_integer, unit, short_data, divisor) {
number = 0;
}
+ if (typeof params !== "undefined") {
+ if (typeof params.twoLines !== "undefined" && params.twoLines === true);
+ return number + "
" + shorts[pos] + unit;
+ }
+
return number + " " + shorts[pos] + unit;
}
diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php
index 6b64cae989..84fafbb1ea 100644
--- a/pandora_console/include/graphs/functions_flot.php
+++ b/pandora_console/include/graphs/functions_flot.php
@@ -262,8 +262,14 @@ function flot_area_graph(
(empty($params['line_width']) === true) ? $config['custom_graph_width'] : $params['line_width'],
true
);
+
+ $timestamp_top_fixed = '';
+ if (isset($params['timestamp_top_fixed']) === true && empty($params['timestamp_top_fixed']) === false) {
+ $timestamp_top_fixed = $params['timestamp_top_fixed'];
+ }
+
$return .= "";
$legend_top = 10;
diff --git a/pandora_console/include/styles/graph_analytics.css b/pandora_console/include/styles/graph_analytics.css
index 96dd1abc45..c9ae76fe8f 100644
--- a/pandora_console/include/styles/graph_analytics.css
+++ b/pandora_console/include/styles/graph_analytics.css
@@ -31,6 +31,17 @@ div.box-flat.white_table_graph > div[id^="tgl_div_"] > div.white-box-content {
justify-content: flex-start;
}
+div.box-flat.white_table_graph
+ > div[id^="tgl_div_"]
+ > div.white-box-content
+ > [data-id-agent],
+div.box-flat.white_table_graph
+ > div[id^="tgl_div_"]
+ > div.white-box-content
+ > [data-id-group] {
+ cursor: pointer;
+}
+
div#menu_tab ul li,
div#menu_tab ul li span {
display: flex;
@@ -158,7 +169,7 @@ div.graphs-div-main {
/* Draggable */
.draggable.ui-draggable-dragging {
- width: 100%;
+ width: 20%;
}
.draggable {
@@ -166,15 +177,13 @@ div.graphs-div-main {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
- width: 100px;
- height: 20px;
- background: #9efcab;
-}
-/* !Remove and set width 100% in .draggable */
-#droppable-graphs .draggable {
- width: 20px;
}
+#droppable-graphs * {
+ cursor: default;
+}
+
+/* Droppable */
.droppable {
width: 100%;
/* height: 20px; */
@@ -187,7 +196,10 @@ div.graphs-div-main {
border: 2px dashed #0077ff;
border-radius: 6px;
width: 100%;
- height: 20px;
+}
+
+#droppable-graphs .droppable-zone > div {
+ opacity: 0.5;
}
#droppable-graphs .drops-hover {
@@ -238,3 +250,72 @@ div.graphs-div-main {
> span.drop-here {
color: #82b92e;
}
+
+#droppable-graphs .parent_graph {
+ padding-top: 40px;
+}
+
+#droppable-graphs .timestamp_graph {
+ top: 15px;
+}
+
+#droppable-graphs .menu_graph {
+ left: 85%;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+}
+
+div.timestamp-top-fixed {
+ top: 15px !important;
+}
+
+div.graph-analytics-legend-main {
+ display: flex;
+}
+
+div.graph-analytics-legend-square {
+ width: 30px;
+ height: 30px;
+ max-width: 30px;
+ margin-right: 5px;
+ padding-right: 3px;
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+ flex-wrap: nowrap;
+ justify-content: center;
+}
+
+div.graph-analytics-legend-square > span {
+ text-align: right;
+ color: #fff;
+ line-height: 9pt;
+}
+
+div.graph-analytics-legend-square > span.square-unit {
+ width: 30px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+div.graph-analytics-legend {
+ display: flex;
+ flex-direction: column;
+ flex-wrap: nowrap;
+}
+
+div.graph-analytics-legend > span {
+ line-height: 12pt;
+}
+
+div.graph-analytics-legend > span:last-child {
+ font-weight: normal;
+ font-size: 8pt;
+ margin-left: 5px;
+}
+
+#droppable-graphs td.legendColorBox {
+ display: none;
+}
diff --git a/pandora_console/operation/reporting/graph_analytics.php b/pandora_console/operation/reporting/graph_analytics.php
index 7e68c92777..1b6751fa1a 100644
--- a/pandora_console/operation/reporting/graph_analytics.php
+++ b/pandora_console/operation/reporting/graph_analytics.php
@@ -34,12 +34,15 @@ check_login();
ui_require_css_file('graph_analytics');
require_once 'include/functions_custom_graphs.php';
-// Get parameters.
-$x = get_parameter('x');
-
// Ajax.
if (is_ajax()) {
$search_left = get_parameter('search_left');
+ $search_right = get_parameter('search_right');
+ $get_graphs = get_parameter('get_graphs');
+ $save_filter = get_parameter('save_filter');
+ $load_filter = get_parameter('load_filter');
+ $update_filter = get_parameter('update_filter');
+ $get_new_values = get_parameter('get_new_values');
if (empty($search_left) === false) {
$output = [];
@@ -114,13 +117,367 @@ if (is_ajax()) {
return;
}
+ if (empty($search_right) === false) {
+ $output = [];
+ $search = io_safe_input(get_parameter('free_search'));
+ $agent = get_parameter('search_agent');
+ $group = get_parameter('search_group');
+
+ $search_sql = ' AND (tam.nombre LIKE "%%'.$search.'%%" OR tam.descripcion LIKE "%%'.$search.'%%")';
+
+ // Agent.
+ if (empty($agent) === false) {
+ $sql = sprintf(
+ 'SELECT tam.id_agente_modulo, tam.nombre, tam.descripcion
+ FROM tagente_modulo tam
+ WHERE (tam.id_agente = %s)
+ %s
+ ORDER BY tam.nombre',
+ $agent,
+ $search_sql
+ );
+
+ $output['modules'] = db_get_all_rows_sql($sql);
+ }
+
+ // Group.
+ if (empty($group) === false) {
+ $sql = sprintf(
+ 'SELECT tam.id_agente_modulo, tam.nombre, tam.descripcion
+ FROM tagente_modulo tam
+ INNER JOIN tagente ta ON ta.id_agente = tam.id_agente
+ WHERE (ta.id_grupo = %s)
+ %s
+ ORDER BY tam.nombre',
+ $group,
+ $search_sql
+ );
+
+ $output['modules'] = db_get_all_rows_sql($sql);
+ }
+
+ // Return.
+ echo json_encode($output);
+ return;
+ }
+
+ // Graph.
+ if (empty($get_graphs) === false) {
+ $interval = (int) get_parameter('interval');
+ $modules = $get_graphs;
+
+ $params = [
+ 'period' => $interval,
+ 'width' => '100%',
+ 'graph_width' => '85%',
+ 'height' => 100,
+ 'date' => time(),
+ 'percentil' => null,
+ 'fullscale' => 1,
+ 'type_graph' => 'line',
+ 'timestamp_top_fixed' => 'timestamp-top-fixed',
+ 'graph_analytics' => true,
+ 'realtime' => true,
+ ];
+
+ $params_combined = [
+ 'stacked' => 2,
+ 'labels' => [],
+ 'modules_series' => $modules,
+ 'id_graph' => null,
+ 'return' => 1,
+ 'graph_analytics' => true,
+ ];
+
+ $graph_return = graphic_combined_module(
+ $modules,
+ $params,
+ $params_combined
+ );
+
+ $graph_return .= "
+
+ ";
+
+ echo $graph_return;
+ return;
+ }
+
+ // Save filter.
+ if (empty($save_filter) === false) {
+ $graphs = get_parameter('graphs');
+ $interval = (int) get_parameter('interval');
+
+ if (empty($save_filter) === true) {
+ echo __('Empty name');
+ return;
+ }
+
+ if (empty($graphs) === true) {
+ echo __('Empty graphs');
+ return;
+ }
+
+ $id_filter = db_process_sql_insert(
+ 'tgraph_analytics_filter',
+ [
+ 'filter_name' => $save_filter,
+ 'user_id' => $config['id_user'],
+ 'graph_modules' => json_encode($graphs),
+ 'interval' => $interval,
+ ]
+ );
+
+ if ($id_filter > 0) {
+ echo 'saved';
+ return;
+ } else {
+ echo __('Empty graphs');
+ return;
+ }
+ }
+
+ // Update filter.
+ if (empty($update_filter) === false) {
+ $graphs = get_parameter('graphs');
+ $interval = (int) get_parameter('interval');
+
+ if (empty($graphs) === true) {
+ echo __('Empty graphs');
+ return;
+ }
+
+ $update_filter = db_process_sql_update(
+ 'tgraph_analytics_filter',
+ [
+ 'graph_modules' => json_encode($graphs),
+ 'interval' => $interval,
+ ],
+ ['id' => $update_filter]
+ );
+
+ if ($update_filter > 0) {
+ echo 'updated';
+ return;
+ } else {
+ echo __('No updated');
+ return;
+ }
+
+ echo $update_filter;
+ return;
+ }
+
+ // Load filter.
+ if (empty($load_filter) === false) {
+ $data = [];
+ $data['graphs'] = json_decode(db_get_value('graph_modules', 'tgraph_analytics_filter', 'id', $load_filter));
+ $data['interval'] = db_get_value('tgraph_analytics_filter.interval', 'tgraph_analytics_filter', 'id', $load_filter);
+
+ echo json_encode($data);
+ return;
+ }
+
+ // Get new values.
+ if (empty($get_new_values) === false) {
+ $data = [];
+
+ $agent_module_id = $get_new_values;
+ $date_array = get_parameter('date_array');
+ $data_module_graph = get_parameter('data_module_graph');
+ $params = get_parameter('params');
+ $suffix = get_parameter('suffix');
+
+ // Stract data.
+ $array_data_module = grafico_modulo_sparse_data(
+ $agent_module_id,
+ $date_array,
+ $data_module_graph,
+ $params,
+ $suffix
+ );
+
+ echo json_encode($array_data_module);
+ return;
+ }
+
return;
}
+// Save filter modal.
+echo '';
+if (check_acl($config['id_user'], 0, 'RW') === 1 || check_acl($config['id_user'], 0, 'RM') === 1) {
+ echo '
';
+ $table = new StdClass;
+ $table->id = 'save_filter_form';
+ $table->width = '100%';
+ $table->cellspacing = 4;
+ $table->cellpadding = 4;
+ $table->class = 'databox no_border';
+
+ $table->styleTable = 'font-weight: bold; text-align:left;';
+
+ $data = [];
+ $table->rowid[0] = 'update_save_selector';
+ $data[0] = html_print_div(
+ [
+ 'style' => 'display: flex;',
+ 'content' => html_print_radio_button(
+ 'filter_mode',
+ 'new',
+ __('New filter'),
+ true,
+ true
+ ),
+ ],
+ true
+ );
+
+ $data[1] = html_print_div(
+ [
+ 'style' => 'display: flex;',
+ 'content' => html_print_radio_button(
+ 'filter_mode',
+ 'update',
+ __('Update filter'),
+ false,
+ true
+ ),
+ ],
+ true
+ );
+
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ $data = [];
+ $table->rowid[1] = 'save_filter_row1';
+ $data[0] = __('Filter name');
+ $data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
+
+ $data[1] = html_print_submit_button(
+ __('Save filter'),
+ 'save_filter',
+ false,
+ [
+ 'class' => 'mini ',
+ 'icon' => 'save',
+ 'style' => 'margin-left: 175px; width: 125px;',
+ 'onclick' => 'save_new_filter();',
+ ],
+ true
+ );
+
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ $data = [];
+ $table->rowid[2] = 'save_filter_row2';
+
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ $data = [];
+ $table->rowid[3] = 'update_filter_row1';
+ $data[0] = __('Overwrite filter');
+
+ $select_filters_update = graph_analytics_filter_select();
+
+ $data[0] .= html_print_select(
+ $select_filters_update,
+ 'overwrite_filter',
+ '',
+ '',
+ '',
+ 0,
+ true
+ );
+ $table->rowclass[] = 'display-grid';
+ $data[1] = html_print_submit_button(
+ __('Update filter'),
+ 'update_filter',
+ false,
+ [
+ 'class' => 'mini ',
+ 'icon' => 'save',
+ 'style' => 'margin-left: 155px; width: 145px;',
+ 'onclick' => 'save_update_filter();',
+ ],
+ true
+ );
+
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ html_print_table($table);
+} else {
+ include 'general/noaccess.php';
+}
+
+echo '
';
+
+// Load filter modal.
+$filters = graph_analytics_filter_select();
+
+echo '';
+
+$table = new StdClass;
+$table->id = 'load_filter_form';
+$table->width = '100%';
+$table->cellspacing = 4;
+$table->cellpadding = 4;
+$table->class = 'databox no_border';
+
+$table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
+$filter_id_width = 'w100p';
+
+$data = [];
+$table->rowid[3] = 'update_filter_row1';
+$data[0] = __('Load filter');
+$data[0] .= html_print_select(
+ $filters,
+ 'filter_id',
+ '',
+ '',
+ __('None'),
+ 0,
+ true,
+ false,
+ true,
+ '',
+ false,
+ 'width:'.$filter_id_width.';'
+);
+
+$table->rowclass[] = 'display-grid';
+$data[1] = html_print_submit_button(
+ __('Load filter'),
+ 'load_filter',
+ false,
+ [
+ 'class' => 'mini w30p',
+ 'icon' => 'load',
+ 'style' => 'margin-left: 208px; width: 130px;',
+ 'onclick' => 'load_filter_values();',
+ ],
+ true
+);
+$data[1] .= html_print_input_hidden('load_filter', 1, true);
+$table->data[] = $data;
+$table->rowclass[] = '';
+
+html_print_table($table);
+echo '
';
+
// Header & Actions.
$title_tab = __('Start realtime');
$tab_start_realtime = [
- 'text' => ''.html_print_image(
+ 'text' => ''.html_print_image(
'images/change-active.svg',
true,
[
@@ -130,9 +487,21 @@ $tab_start_realtime = [
).$title_tab.'',
];
+$title_tab = __('Pause realtime');
+$tab_pause_realtime = [
+ 'text' => ''.html_print_image(
+ 'images/change-pause.svg',
+ true,
+ [
+ 'title' => $title_tab,
+ 'class' => 'invert_filter main_menu_icon',
+ ]
+ ).$title_tab.'',
+];
+
$title_tab = __('New');
$tab_new = [
- 'text' => ''.html_print_image(
+ 'text' => ''.html_print_image(
'images/plus-black.svg',
true,
[
@@ -144,7 +513,7 @@ $tab_new = [
$title_tab = __('Save');
$tab_save = [
- 'text' => ''.html_print_image(
+ 'text' => ''.html_print_image(
'images/save_mc.png',
true,
[
@@ -156,7 +525,7 @@ $tab_save = [
$title_tab = __('Load');
$tab_load = [
- 'text' => ''.html_print_image(
+ 'text' => ''.html_print_image(
'images/logs@svg.svg',
true,
[
@@ -168,7 +537,7 @@ $tab_load = [
$title_tab = __('Share');
$tab_share = [
- 'text' => ''.html_print_image(
+ 'text' => ''.html_print_image(
'images/responses.svg',
true,
[
@@ -180,7 +549,7 @@ $tab_share = [
$title_tab = __('Export to custom graph');
$tab_export = [
- 'text' => ''.html_print_image(
+ 'text' => ''.html_print_image(
'images/module-graph.svg',
true,
[
@@ -202,6 +571,7 @@ ui_print_standard_header(
$tab_load,
$tab_save,
$tab_new,
+ $tab_pause_realtime,
$tab_start_realtime,
],
[
@@ -212,22 +582,10 @@ ui_print_standard_header(
]
);
-// Header options.
-// $options_content = 'Sample text';
-// html_print_div(
-// [
-// 'class' => 'options-graph-analytics',
-// 'content' => $options_content,
-// ]
-// );
// Content.
$left_content = '';
$right_content = '';
-// $left_content .= '';
-//
-//
-//
$left_content .= '
';
@@ -364,217 +725,38 @@ html_print_div(
);
-// Realtime graph.
-$table = new stdClass();
-$table->width = '100%';
-$table->id = 'table-form';
-$table->class = 'filter-table-adv';
-$table->style = [];
-$table->data = [];
-
-$graph_fields['cpu_load'] = __('%s Server CPU', get_product_name());
-$graph_fields['pending_packets'] = __(
- 'Pending packages from %s Server',
- get_product_name()
-);
-$graph_fields['disk_io_wait'] = __(
- '%s Server Disk IO Wait',
- get_product_name()
-);
-$graph_fields['apache_load'] = __(
- '%s Server Apache load',
- get_product_name()
-);
-$graph_fields['mysql_load'] = __(
- '%s Server MySQL load',
- get_product_name()
-);
-$graph_fields['server_load'] = __(
- '%s Server load',
- get_product_name()
-);
-$graph_fields['snmp_interface'] = __('SNMP Interface throughput');
-
-$graph = get_parameter('graph', 'cpu_load');
-$refresh = get_parameter('refresh', '1000');
-
-if ($graph != 'snmp_module') {
- $data['graph'] = html_print_label_input_block(
- __('Graph'),
- html_print_select(
- $graph_fields,
- 'graph',
- $graph,
- '',
- '',
- 0,
- true,
- false,
- true,
- '',
- false,
- 'width: 100%'
- )
- );
-}
-
-$refresh_fields[1000] = human_time_description_raw(1, true, 'large');
-$refresh_fields[5000] = human_time_description_raw(5, true, 'large');
-$refresh_fields[10000] = human_time_description_raw(10, true, 'large');
-$refresh_fields[30000] = human_time_description_raw(30, true, 'large');
-
-if ($graph == 'snmp_module') {
- $agent_alias = io_safe_output(get_parameter('agent_alias', ''));
- $module_name = io_safe_output(get_parameter('module_name', ''));
- $module_incremental = get_parameter('incremental', 0);
- $data['module_info'] = html_print_label_input_block(
- $agent_alias.': '.$module_name,
- html_print_input_hidden(
- 'incremental',
- $module_incremental,
- true
- ).html_print_select(
- ['snmp_module' => '-'],
- 'graph',
- 'snmp_module',
- '',
- '',
- 0,
- true,
- false,
- true,
- '',
- false,
- 'width: 100%; display: none;'
- )
- );
-}
-
-$data['refresh'] = html_print_label_input_block(
- __('Refresh interval'),
- html_print_select(
- $refresh_fields,
- 'refresh',
- $refresh,
- '',
- '',
- 0,
- true,
- false,
- true,
- '',
- false,
- 'width: 100%'
- )
-);
-
-if ($graph != 'snmp_module') {
- $data['incremental'] = html_print_label_input_block(
- __('Incremental'),
- html_print_checkbox_switch('incremental', 1, 0, true)
- );
-}
-
-$table->data[] = $data;
-
-// Print the relative path to AJAX calls.
-html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
-
-// Print the form.
-$searchForm = '';
-
-// echo $searchForm;
-echo '
-
-
-';
-
-// Canvas realtime graph.
-$canvas = '';
-$canvas .= '
';
-
-$width = 800;
-$height = 300;
-
-$data_array['realtime']['data'][0][0] = (time() - 10);
-$data_array['realtime']['data'][0][1] = 0;
-$data_array['realtime']['data'][1][0] = time();
-$data_array['realtime']['data'][1][1] = 0;
-$data_array['realtime']['color'] = 'green';
-
-$params = [
- 'agent_module_id' => false,
- 'period' => 300,
- 'width' => $width,
- 'height' => $height,
- 'only_image' => false,
- 'type_graph' => 'area',
- 'font' => $config['fontpath'],
- 'font-size' => $config['font_size'],
- 'array_data_create' => $data_array,
- 'show_legend' => false,
- 'show_menu' => false,
- 'backgroundColor' => 'transparent',
-];
-
-$canvas .= grafico_modulo_sparse($params);
-$canvas .= '
';
-echo $canvas;
-
-html_print_input_hidden(
- 'custom_action',
- urlencode(
- base64_encode(
- '
'
- )
- ),
- false
-);
-html_print_input_hidden('incremental_base', '0');
-
-echo '';
-echo '';
-
-if ($config['style'] !== 'pandora_black') {
- echo '';
-}
-
-// Store servers timezone offset to be retrieved from js.
-set_js_value('timezone_offset', date('Z', time()));
-
-extensions_add_operation_menu_option(
- __('Realtime graphs'),
- 'estado',
- null,
- 'v1r1',
- 'view'
-);
-extensions_add_main_function('pandora_realtime_graphs');
?>
\ No newline at end of file
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 0056868752..0d7fa28a71 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -4408,3 +4408,15 @@ CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
+
+-- ---------------------------------------------------------------------
+-- Table `tgraph_analytics_filter`
+-- ---------------------------------------------------------------------
+CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
+`id` INT NOT NULL auto_increment,
+`filter_name` VARCHAR(45) NULL,
+`user_id` VARCHAR(255) NULL,
+`graph_modules` TEXT NULL,
+`interval` INT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
\ No newline at end of file