add render graph to reports

This commit is contained in:
daniel 2020-10-02 14:16:55 +02:00 committed by Daniel Rodriguez
parent 1cdb91a02d
commit a5d5a45cac
19 changed files with 577 additions and 231 deletions

View File

@ -22,4 +22,7 @@ ALTER TABLE talert_actions ADD COLUMN `field18_recovery` TEXT NOT NULL DEFAULT "
ALTER TABLE talert_actions ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE `treport_content` add column `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` add column `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
COMMIT; COMMIT;

View File

@ -849,7 +849,8 @@ ALTER TABLE `treport_content_template` MODIFY COLUMN `historical_db` tinyint(1)
MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0'; MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0';
ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Table `tnews` -- Table `tnews`
@ -1370,13 +1371,13 @@ ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 41); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 42);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '749'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', 750);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields'; UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password'; DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@ -1692,7 +1693,8 @@ ALTER TABLE `treport_content` MODIFY COLUMN `historical_db` tinyint(1) unsigned
MODIFY COLUMN `failover_type` tinyint(1) NULL DEFAULT '1'; MODIFY COLUMN `failover_type` tinyint(1) NULL DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`

View File

@ -156,6 +156,8 @@ $agent_max_value = true;
$agent_min_value = true; $agent_min_value = true;
$uncompressed_module = true; $uncompressed_module = true;
$graph_render = (empty($config['type_mode_graph']) === true) ? 0 : $config['type_mode_graph'];
switch ($action) { switch ($action) {
case 'new': case 'new':
$actionParameter = 'save'; $actionParameter = 'save';
@ -259,7 +261,8 @@ switch ($action) {
case 'simple_graph': case 'simple_graph':
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? $config['percentil'] : 0; $percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0;
$graph_render = $item['graph_render'];
// The break hasn't be forgotten. // The break hasn't be forgotten.
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'projection_graph': case 'projection_graph':
@ -653,6 +656,7 @@ switch ($action) {
$period = $item['period']; $period = $item['period'];
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$recursion = $item['recursion']; $recursion = $item['recursion'];
$graph_render = $item['graph_render'];
break; break;
case 'top_n': case 'top_n':
@ -2091,18 +2095,24 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_time_compare_overlapped" style="" class="datos"> <tr id="row_graph_render" style="" class="datos">
<td style="font-weight:bold;"> <td style="font-weight:bold;">
<?php <?php
echo __('Time compare (Overlapped)'); echo __('Graph render');
?> ?>
</td> </td>
<td> <td>
<?php <?php
html_print_checkbox_switch( $list_graph_render = [
'time_compare_overlapped', 1 => __('Avg, max & min'),
1, 2 => __('Max only'),
$time_compare_overlapped 3 => __('Min only'),
0 => __('Avg only'),
];
html_print_select(
$list_graph_render,
'graph_render',
$graph_render
); );
?> ?>
</td> </td>
@ -2128,9 +2138,26 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_time_compare_overlapped" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Time compare (Overlapped)');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'time_compare_overlapped',
1,
$time_compare_overlapped
);
?>
</td>
</tr>
<tr id="row_percentil" style="" class="datos"> <tr id="row_percentil" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Percentil'); ?></td> <td style="font-weight:bold;"><?php echo __('Percentil'); ?></td>
<td><?php html_print_checkbox('percentil', 1, $percentil); ?></td> <td><?php html_print_checkbox_switch('percentil', 1, $percentil); ?></td>
</tr> </tr>
<tr id="row_exception_condition_value" style="" class="datos"> <tr id="row_exception_condition_value" style="" class="datos">
@ -3891,6 +3918,16 @@ $(document).ready (function () {
}); });
}); });
$("#checkbox-fullscale").change(function(e){
if(e.target.checked === true) {
$("#graph_render").prop('disabled', 'disabled');
} else {
$("#graph_render").prop('disabled', false);
}
});
$('#checkbox-fullscale').trigger('change');
$("#submit-create_item").click(function () { $("#submit-create_item").click(function () {
var type = $('#type').val(); var type = $('#type').val();
var name = $('#text-name').val(); var name = $('#text-name').val();
@ -4906,6 +4943,7 @@ function chooseType() {
$("#row_show_graph").hide(); $("#row_show_graph").hide();
$("#row_max_min_avg").hide(); $("#row_max_min_avg").hide();
$("#row_fullscale").hide(); $("#row_fullscale").hide();
$("#row_graph_render").hide();
$("#row_time_compare_overlapped").hide(); $("#row_time_compare_overlapped").hide();
$("#row_quantity").hide(); $("#row_quantity").hide();
$("#row_exception_condition_value").hide(); $("#row_exception_condition_value").hide();
@ -5010,8 +5048,14 @@ function chooseType() {
case 'simple_graph': case 'simple_graph':
$("#row_time_compare_overlapped").show(); $("#row_time_compare_overlapped").show();
$("#row_fullscale").show(); $("#row_fullscale").show();
if ($("#checkbox-percentil").prop("checked")) $("#row_graph_render").show();
$("#row_percentil").show(); $("#row_percentil").show();
// Force type.
if('<?php echo $action; ?>' === 'new'){
$("#graph_render").val(<?php echo $graph_render; ?>);
}
// The break hasn't be forgotten, this element // The break hasn't be forgotten, this element
// only should be shown on the simple graphs. // only should be shown on the simple graphs.
case 'simple_baseline_graph': case 'simple_baseline_graph':
@ -5377,7 +5421,12 @@ function chooseType() {
$("#row_description").show(); $("#row_description").show();
$("#row_period").show(); $("#row_period").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_graph_render").show();
$("#row_fullscale").show(); $("#row_fullscale").show();
// Force MAX type.
if('<?php echo $action; ?>' === 'new'){
$("#graph_render").val(2);
}
break; break;
case 'top_n': case 'top_n':

View File

@ -1632,6 +1632,9 @@ switch ($action) {
break; break;
case 'simple_graph': case 'simple_graph':
$values['graph_render'] = (int) get_parameter(
'graph_render'
);
case 'simple_baseline_graph': case 'simple_baseline_graph':
// HACK it is saved in show_graph field. // HACK it is saved in show_graph field.
$values['show_graph'] = (int) get_parameter( $values['show_graph'] = (int) get_parameter(
@ -1641,6 +1644,14 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'network_interfaces_report':
$values['graph_render'] = (int) get_parameter(
'graph_render'
);
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'min_value': case 'min_value':
case 'max_value': case 'max_value':
case 'avg_value': case 'avg_value':
@ -2274,6 +2285,9 @@ switch ($action) {
break; break;
case 'simple_graph': case 'simple_graph':
$values['graph_render'] = (int) get_parameter(
'graph_render'
);
case 'simple_baseline_graph': case 'simple_baseline_graph':
// HACK it is saved in show_graph field. // HACK it is saved in show_graph field.
$values['show_graph'] = (int) get_parameter( $values['show_graph'] = (int) get_parameter(
@ -2283,6 +2297,14 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'network_interfaces_report':
$values['graph_render'] = (int) get_parameter(
'graph_render'
);
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'min_value': case 'min_value':
case 'max_value': case 'max_value':
case 'avg_value': case 'avg_value':

View File

@ -738,67 +738,166 @@ $row++;
$table_chars->data = []; $table_chars->data = [];
$table_chars->data[$row][0] = __('Graph color #1'); $table_chars->data[$row][0] = __('Graph color #1');
$table_chars->data[$row][1] = html_print_input_text('graph_color1', $config['graph_color1'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color1',
$config['graph_color1'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #2'); $table_chars->data[$row][0] = __('Graph color #2');
$table_chars->data[$row][1] = html_print_input_text('graph_color2', $config['graph_color2'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color2',
$config['graph_color2'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #3'); $table_chars->data[$row][0] = __('Graph color #3');
$table_chars->data[$row][1] = html_print_input_text('graph_color3', $config['graph_color3'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color3',
$config['graph_color3'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #4'); $table_chars->data[$row][0] = __('Graph color #4');
$table_chars->data[$row][1] = html_print_input_text('graph_color4', $config['graph_color4'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color4',
$config['graph_color4'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #5'); $table_chars->data[$row][0] = __('Graph color #5');
$table_chars->data[$row][1] = html_print_input_text('graph_color5', $config['graph_color5'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color5',
$config['graph_color5'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #6'); $table_chars->data[$row][0] = __('Graph color #6');
$table_chars->data[$row][1] = html_print_input_text('graph_color6', $config['graph_color6'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color6',
$config['graph_color6'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #7'); $table_chars->data[$row][0] = __('Graph color #7');
$table_chars->data[$row][1] = html_print_input_text('graph_color7', $config['graph_color7'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color7',
$config['graph_color7'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #8'); $table_chars->data[$row][0] = __('Graph color #8');
$table_chars->data[$row][1] = html_print_input_text('graph_color8', $config['graph_color8'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color8',
$config['graph_color8'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #9'); $table_chars->data[$row][0] = __('Graph color #9');
$table_chars->data[$row][1] = html_print_input_text('graph_color9', $config['graph_color9'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color9',
$config['graph_color9'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #10'); $table_chars->data[$row][0] = __('Graph color #10');
$table_chars->data[$row][1] = html_print_input_text('graph_color10', $config['graph_color10'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color10',
$config['graph_color10'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Value to interface graphics'); $table_chars->data[$row][0] = __('Value to interface graphics');
$table_chars->data[$row][1] = html_print_input_text('interface_unit', $config['interface_unit'], '', 20, 20, true); $table_chars->data[$row][1] = html_print_input_text(
'interface_unit',
$config['interface_unit'],
'',
20,
20,
true
);
$row++; $row++;
$disabled_graph_precision = false; $disabled_graph_precision = false;
if (!enterprise_installed()) { if (enterprise_installed() === false) {
$disabled_graph_precision = true; $disabled_graph_precision = true;
} }
$table_chars->data[$row][0] = __('Data precision'); $table_chars->data[$row][0] = __('Data precision');
$table_chars->data[$row][1] = html_print_input_text('graph_precision', $config['graph_precision'], '', 5, 5, true, $disabled_graph_precision, false, 'onChange="change_precision()"'); $table_chars->data[$row][1] = html_print_input_text(
'graph_precision',
$config['graph_precision'],
'',
5,
5,
true,
$disabled_graph_precision,
false,
'onChange="change_precision()"'
);
$row++; $row++;
if (!isset($config['short_module_graph_data'])) { if (isset($config['short_module_graph_data']) === false) {
$config['short_module_graph_data'] = true; $config['short_module_graph_data'] = true;
} }
$table_chars->data[$row][0] = __('Data precision in graphs'); $table_chars->data[$row][0] = __('Data precision in graphs');
$table_chars->data[$row][1] = html_print_input_text('short_module_graph_data', $config['short_module_graph_data'], '', 5, 5, true, $disabled_graph_precision, false, 'onChange="change_precision()"'); $table_chars->data[$row][1] = html_print_input_text(
'short_module_graph_data',
$config['short_module_graph_data'],
'',
5,
5,
true,
$disabled_graph_precision,
false,
'onChange="change_precision()"'
);
$row++; $row++;
$table_chars->data[$row][0] = __('Default line thickness for the Custom Graph.'); $table_chars->data[$row][0] = __(
'Default line thickness for the Custom Graph.'
);
$table_chars->data[$row][1] = html_print_input_text( $table_chars->data[$row][1] = html_print_input_text(
'custom_graph_width', 'custom_graph_width',
$config['custom_graph_width'], $config['custom_graph_width'],
@ -853,7 +952,14 @@ $row++;
$row++; $row++;
$table_chars->data[$row][0] = __('Percentile'); $table_chars->data[$row][0] = __('Percentile');
$table_chars->data[$row][1] = html_print_input_text('percentil', $config['percentil'], '', 20, 20, true); $table_chars->data[$row][1] = html_print_input_text(
'percentil',
$config['percentil'],
'',
20,
20,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph TIP view:'); $table_chars->data[$row][0] = __('Graph TIP view:');
@ -863,17 +969,37 @@ $row++;
$options_full_escale[1] = __('All'); $options_full_escale[1] = __('All');
$options_full_escale[2] = __('On Boolean graphs'); $options_full_escale[2] = __('On Boolean graphs');
$table_chars->data[$row][1] = html_print_select($options_full_escale, 'full_scale_option', $config['full_scale_option'], '', '', 0, true, false, false); $table_chars->data[$row][1] = html_print_select(
$options_full_escale,
'full_scale_option',
$config['full_scale_option'],
'',
'',
0,
true,
false,
false
);
$row++; $row++;
$table_chars->data[$row][0] = __('Show only average'); $table_chars->data[$row][0] = __('Graph mode');
$options_soft_graphs = []; $options_soft_graphs = [];
$options_soft_graphs[0] = __('Show only average by default'); $options_soft_graphs[0] = __('Show only average by default');
$options_soft_graphs[1] = __('Show MAX/AVG/MIN by default'); $options_soft_graphs[1] = __('Show MAX/AVG/MIN by default');
$table_chars->data[$row][1] = html_print_select($options_soft_graphs, 'type_mode_graph', $config['type_mode_graph'], '', '', 0, true, false, false); $table_chars->data[$row][1] = html_print_select(
$options_soft_graphs,
'type_mode_graph',
$config['type_mode_graph'],
'',
'',
0,
true,
false,
false
);
$row++; $row++;
$table_chars->data[$row][0] = __('Zoom graphs:'); $table_chars->data[$row][0] = __('Zoom graphs:');
@ -885,18 +1011,19 @@ $row++;
$options_zoom_graphs[4] = 'x4'; $options_zoom_graphs[4] = 'x4';
$options_zoom_graphs[5] = 'x5'; $options_zoom_graphs[5] = 'x5';
$table_chars->data[$row][1] = html_print_select($options_zoom_graphs, 'zoom_graph', $config['zoom_graph'], '', '', 0, true, false, false); $table_chars->data[$row][1] = html_print_select(
$options_zoom_graphs,
'zoom_graph',
$config['zoom_graph'],
'',
'',
0,
true,
false,
false
);
$row++; $row++;
/*
$table_font->data[$row][0] = __('Font path');
$fonts = load_fonts();
$table_font->data[$row][1] = html_print_select($fonts, 'fontpath',
io_safe_output($config["fontpath"]), '', '', 0, true);
$row++;
*/
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Charts configuration').' '.ui_print_help_icon('charts_conf_tab', true).'</legend>'; echo '<legend>'.__('Charts configuration').' '.ui_print_help_icon('charts_conf_tab', true).'</legend>';
html_print_table($table_chars); html_print_table($table_chars);

View File

@ -198,6 +198,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
break; break;
case 'sparse': case 'sparse':
$params['pdf'] = true;
echo grafico_modulo_sparse($params); echo grafico_modulo_sparse($params);
break; break;

View File

@ -3771,7 +3771,11 @@ function series_type_graph_array($data, $show_elements_graph)
} }
} else { } else {
$name_legend = ''; $name_legend = '';
if ((int) $config['type_mode_graph'] === 1) { if (isset($show_elements_graph['fullscale']) === true
&& (int) $show_elements_graph['fullscale'] === 1
) {
$name_legend .= 'Tip: ';
} else {
$name_legend .= 'Avg: '; $name_legend .= 'Avg: ';
} }
@ -3839,7 +3843,8 @@ function series_type_graph_array($data, $show_elements_graph)
$data_return['series_type'][$key] = $type_graph; $data_return['series_type'][$key] = $type_graph;
$name_legend = ''; $name_legend = '';
if ((int) $config['type_mode_graph'] === 1) {
if ((int) $show_elements_graph['type_mode_graph'] != 0) {
if (strpos($key, 'min') !== false) { if (strpos($key, 'min') !== false) {
$name_legend .= 'Min: '; $name_legend .= 'Min: ';
} }

View File

@ -2957,7 +2957,6 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
} }
$ni_by_agents = []; $ni_by_agents = [];
foreach ($agents as $agent) { foreach ($agents as $agent) {
$agent_id = $agent['id_agente']; $agent_id = $agent['id_agente'];
$agent_group_id = $agent['id_grupo']; $agent_group_id = $agent['id_grupo'];
@ -2965,27 +2964,52 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
$agent_interfaces = []; $agent_interfaces = [];
$accepted_module_types = []; $accepted_module_types = [];
$remote_snmp_proc = (int) db_get_value('id_tipo', 'ttipo_modulo', 'nombre', 'remote_snmp_proc'); $remote_snmp_proc = (int) db_get_value(
'id_tipo',
'ttipo_modulo',
'nombre',
'remote_snmp_proc'
);
if ($remote_snmp_proc) { if ($remote_snmp_proc) {
$accepted_module_types[] = $remote_snmp_proc; $accepted_module_types[] = $remote_snmp_proc;
} }
$remote_icmp_proc = (int) db_get_value('id_tipo', 'ttipo_modulo', 'nombre', 'remote_icmp_proc'); $remote_icmp_proc = (int) db_get_value(
'id_tipo',
'ttipo_modulo',
'nombre',
'remote_icmp_proc'
);
if ($remote_icmp_proc) { if ($remote_icmp_proc) {
$accepted_module_types[] = $remote_icmp_proc; $accepted_module_types[] = $remote_icmp_proc;
} }
$remote_tcp_proc = (int) db_get_value('id_tipo', 'ttipo_modulo', 'nombre', 'remote_tcp_proc'); $remote_tcp_proc = (int) db_get_value(
'id_tipo',
'ttipo_modulo',
'nombre',
'remote_tcp_proc'
);
if ($remote_tcp_proc) { if ($remote_tcp_proc) {
$accepted_module_types[] = $remote_tcp_proc; $accepted_module_types[] = $remote_tcp_proc;
} }
$generic_proc = (int) db_get_value('id_tipo', 'ttipo_modulo', 'nombre', 'generic_proc'); $generic_proc = (int) db_get_value(
'id_tipo',
'ttipo_modulo',
'nombre',
'generic_proc'
);
if ($generic_proc) { if ($generic_proc) {
$accepted_module_types[] = $generic_proc; $accepted_module_types[] = $generic_proc;
} }
$remote_snmp = (int) db_get_value('id_tipo', 'ttipo_modulo', 'nombre', 'remote_snmp'); $remote_snmp = (int) db_get_value(
'id_tipo',
'ttipo_modulo',
'nombre',
'remote_snmp'
);
if ($remote_snmp) { if ($remote_snmp) {
$accepted_module_types[] = $remote_snmp; $accepted_module_types[] = $remote_snmp;
} }
@ -3008,8 +3032,13 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
} }
$filter = " tagente_modulo.id_agente = $agent_id AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo IN (".implode(',', $accepted_module_types).") AND (tagente_modulo.nombre LIKE '%_ifOperStatus' OR tagente_modulo.nombre LIKE 'ifOperStatus_%')"; $filter = " tagente_modulo.id_agente = $agent_id AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo IN (".implode(',', $accepted_module_types).") AND (tagente_modulo.nombre LIKE '%_ifOperStatus' OR tagente_modulo.nombre LIKE 'ifOperStatus_%')";
$modules = agents_get_modules($agent_id, $columns, $filter, true, false); $modules = agents_get_modules(
$agent_id,
$columns,
$filter,
true,
false
);
if (!empty($modules)) { if (!empty($modules)) {
$interfaces = []; $interfaces = [];

View File

@ -299,6 +299,9 @@ function grafico_modulo_sparse_data(
return false; return false;
} }
if ((int) $params['type_mode_graph'] !== 2
&& (int) $params['type_mode_graph'] !== 3
) {
$array_data = series_suffix_leyend( $array_data = series_suffix_leyend(
'sum', 'sum',
$series_suffix, $series_suffix,
@ -306,6 +309,7 @@ function grafico_modulo_sparse_data(
$data_module_graph, $data_module_graph,
$array_data $array_data
); );
}
if ($params['percentil']) { if ($params['percentil']) {
$array_data = series_suffix_leyend( $array_data = series_suffix_leyend(
@ -317,7 +321,10 @@ function grafico_modulo_sparse_data(
); );
} }
if ($params['type_mode_graph']) { if ($params['type_mode_graph'] > 0) {
if ((int) $params['type_mode_graph'] === 1
|| (int) $params['type_mode_graph'] === 3
) {
$array_data = series_suffix_leyend( $array_data = series_suffix_leyend(
'min', 'min',
$series_suffix, $series_suffix,
@ -325,7 +332,11 @@ function grafico_modulo_sparse_data(
$data_module_graph, $data_module_graph,
$array_data $array_data
); );
}
if ((int) $params['type_mode_graph'] === 1
|| (int) $params['type_mode_graph'] === 2
) {
$array_data = series_suffix_leyend( $array_data = series_suffix_leyend(
'max', 'max',
$series_suffix, $series_suffix,
@ -334,6 +345,7 @@ function grafico_modulo_sparse_data(
$array_data $array_data
); );
} }
}
// This is for a specific type of report that consists in passing // This is for a specific type of report that consists in passing
// an interval and doing the average sum and avg. // an interval and doing the average sum and avg.
@ -614,6 +626,7 @@ function grafico_modulo_sparse_data(
* 'return_img_base_64' => false, * 'return_img_base_64' => false,
* 'image_treshold' => false, * 'image_treshold' => false,
* 'graph_combined' => false, * 'graph_combined' => false,
* 'graph_render' => 0,
* 'zoom' => 1, * 'zoom' => 1,
* 'server_id' => null, * 'server_id' => null,
* 'stacked' => 0. * 'stacked' => 0.
@ -776,14 +789,28 @@ function grafico_modulo_sparse($params, $server_name='')
if (!isset($params['type_mode_graph'])) { if (!isset($params['type_mode_graph'])) {
$params['type_mode_graph'] = $config['type_mode_graph']; $params['type_mode_graph'] = $config['type_mode_graph'];
if (isset($params['graph_render']) === true) {
$params['type_mode_graph'] = $params['graph_render'];
}
} }
if (!isset($params['projection'])) { if (!isset($params['projection'])) {
$params['projection'] = false; $params['projection'] = false;
} }
if (isset($params['pdf']) === false) {
$params['pdf'] = false;
}
if (!isset($params['agent_module_id'])) { if (!isset($params['agent_module_id'])) {
return graph_nodata_image($params['width'], $params['height']); return graph_nodata_image(
$params['width'],
$params['height'],
'area',
'',
false,
$params['pdf']
);
} else { } else {
$agent_module_id = $params['agent_module_id']; $agent_module_id = $params['agent_module_id'];
} }
@ -816,12 +843,6 @@ function grafico_modulo_sparse($params, $server_name='')
$date_array['final_date'] = $params['date']; $date_array['final_date'] = $params['date'];
$date_array['start_date'] = ($params['date'] - $params['period']); $date_array['start_date'] = ($params['date'] - $params['period']);
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($server_name);
$server = metaconsole_get_connection_by_id($id_meta);
metaconsole_connect($server);
}
if ($agent_module_id) { if ($agent_module_id) {
$module_data = db_get_row_sql( $module_data = db_get_row_sql(
'SELECT * FROM tagente_modulo 'SELECT * FROM tagente_modulo
@ -979,7 +1000,14 @@ function grafico_modulo_sparse($params, $server_name='')
$array_events_alerts $array_events_alerts
); );
} else { } else {
$return = graph_nodata_image($params['width'], $params['height']); $return = graph_nodata_image(
$params['width'],
$params['height'],
'area',
'',
false,
$params['pdf']
);
} }
$return .= '<br>'; $return .= '<br>';
@ -1006,7 +1034,14 @@ function grafico_modulo_sparse($params, $server_name='')
$array_events_alerts $array_events_alerts
); );
} else { } else {
$return .= graph_nodata_image($params['width'], $params['height']); $return = graph_nodata_image(
$params['width'],
$params['height'],
'area',
'',
false,
$params['pdf']
);
} }
} else { } else {
if (empty($array_data) === false) { if (empty($array_data) === false) {
@ -1027,15 +1062,13 @@ function grafico_modulo_sparse($params, $server_name='')
$params['width'], $params['width'],
$params['height'], $params['height'],
'area', 'area',
__('No data to display within the selected interval') __('No data to display within the selected interval'),
false,
$params['pdf']
); );
} }
} }
if (is_metaconsole()) {
metaconsole_restore_db();
}
return $return; return $return;
} }
@ -1247,8 +1280,17 @@ function graphic_combined_module(
} }
if (!isset($params['type_mode_graph'])) { if (!isset($params['type_mode_graph'])) {
// $config['type_mode_graph']
$params['type_mode_graph'] = 0; $params['type_mode_graph'] = 0;
if (isset($params['graph_render']) === true) {
$params['type_mode_graph'] = $params['graph_render'];
$params_combined['type_mode_graph'] = $params['graph_render'];
}
}
if (isset($params['fullscale']) === false) {
$params_combined['fullscale'] = false;
} else {
$params_combined['fullscale'] = $params['fullscale'];
} }
$params['graph_combined'] = true; $params['graph_combined'] = true;
@ -1281,7 +1323,7 @@ function graphic_combined_module(
$sources = false; $sources = false;
if ($params_combined['id_graph'] == 0) { if ((int) $params_combined['id_graph'] === 0) {
$count_modules = count($module_list); $count_modules = count($module_list);
if (!$params_combined['weight_list']) { if (!$params_combined['weight_list']) {
@ -1290,7 +1332,7 @@ function graphic_combined_module(
if ($count_modules > 0) { if ($count_modules > 0) {
foreach ($module_list as $key => $value) { foreach ($module_list as $key => $value) {
$sources[$key]['id_server'] = (isset($value['id_server']) === true) ? $value['id_server'] : $params['id_server']; $sources[$key]['id_server'] = (isset($value['id_server']) === true) ? $value['id_server'] : $params['server_id'];
$sources[$key]['id_agent_module'] = $value['module']; $sources[$key]['id_agent_module'] = $value['module'];
$sources[$key]['weight'] = $weights[$key]; $sources[$key]['weight'] = $weights[$key];
$sources[$key]['label'] = $params_combined['labels']; $sources[$key]['label'] = $params_combined['labels'];
@ -4258,11 +4300,14 @@ function fullscale_data(
} }
} }
if (isset($v['datos']) && $v['datos']) {
// Max. // Max.
if ($v['datos'] >= $max_value) { if ($v['datos'] === false || $v['datos'] >= $max_value) {
if ($v['datos'] === false) {
$max_value = 0;
} else {
$max_value = $v['datos']; $max_value = $v['datos'];
} }
}
// Min. // Min.
if ($v['datos'] <= $min_value) { if ($v['datos'] <= $min_value) {
@ -4271,7 +4316,6 @@ function fullscale_data(
// Avg sum. // Avg sum.
$sum_data += $v['datos']; $sum_data += $v['datos'];
}
// Avg count. // Avg count.
$count_data++; $count_data++;
@ -4291,24 +4335,31 @@ function fullscale_data(
$real_date = ($k['data'][0]['utimestamp'] * 1000); $real_date = ($k['data'][0]['utimestamp'] * 1000);
} }
if ($type_mode_graph <= 1) {
$data['sum'.$series_suffix]['data'][] = [ $data['sum'.$series_suffix]['data'][] = [
$real_date, $real_date,
($sum_data / $count_data), ($sum_data / $count_data),
]; ];
}
if ($type_mode_graph && !$params['baseline']) { if ($type_mode_graph && !$params['baseline']) {
if ((int) $type_mode_graph === 1 || (int) $type_mode_graph === 3) {
if ($min_value != PHP_INT_MAX) { if ($min_value != PHP_INT_MAX) {
$data['min'.$series_suffix]['data'][] = [ $data['min'.$series_suffix]['data'][] = [
$real_date, $real_date,
$min_value, $min_value,
]; ];
} }
}
if ((int) $type_mode_graph === 1 || (int) $type_mode_graph === 2) {
if ($max_value != (-PHP_INT_MAX)) { if ($max_value != (-PHP_INT_MAX)) {
$data['max'.$series_suffix]['data'][] = [ $data['max'.$series_suffix]['data'][] = [
$real_date, $real_date,
$max_value, $max_value,
]; ];
} }
}
} else { } else {
if ($min_value != PHP_INT_MAX) { if ($min_value != PHP_INT_MAX) {
$data['sum'.$series_suffix]['slice_data'][$real_date]['min'] = $min_value; $data['sum'.$series_suffix]['slice_data'][$real_date]['min'] = $min_value;
@ -4400,26 +4451,34 @@ function fullscale_data(
} }
} }
if ($type_mode_graph <= 1) {
$data['sum'.$series_suffix]['min'] = $min_value_total; $data['sum'.$series_suffix]['min'] = $min_value_total;
$data['sum'.$series_suffix]['max'] = $max_value_total; $data['sum'.$series_suffix]['max'] = $max_value_total;
$data['sum'.$series_suffix]['avg'] = 0; $data['sum'.$series_suffix]['avg'] = 0;
if (isset($count_data_total) === true) { if (isset($count_data_total) === true) {
$data['sum'.$series_suffix]['avg'] = ($sum_data_total / $count_data_total); $data['sum'.$series_suffix]['avg'] = ($sum_data_total / $count_data_total);
} }
}
if ($type_mode_graph && !$params['baseline']) { if ($type_mode_graph && !$params['baseline']) {
if ((int) $type_mode_graph === 1 || (int) $type_mode_graph === 3) {
$data['min'.$series_suffix]['min'] = $min_value_min; $data['min'.$series_suffix]['min'] = $min_value_min;
$data['min'.$series_suffix]['max'] = $min_value_max; $data['min'.$series_suffix]['max'] = $min_value_max;
$data['min'.$series_suffix]['avg'] = ($sum_data_min / $count_data_total); $data['min'.$series_suffix]['avg'] = ($sum_data_min / $count_data_total);
}
if ((int) $type_mode_graph === 1 || (int) $type_mode_graph === 2) {
$data['max'.$series_suffix]['min'] = $max_value_min; $data['max'.$series_suffix]['min'] = $max_value_min;
$data['max'.$series_suffix]['max'] = $max_value_max; $data['max'.$series_suffix]['max'] = $max_value_max;
$data['max'.$series_suffix]['avg'] = ($sum_data_max / $count_data_total); $data['max'.$series_suffix]['avg'] = ($sum_data_max / $count_data_total);
}
if ($type_mode_graph <= 1) {
$data['sum'.$series_suffix]['min'] = $avg_value_min; $data['sum'.$series_suffix]['min'] = $avg_value_min;
$data['sum'.$series_suffix]['max'] = $avg_value_max; $data['sum'.$series_suffix]['max'] = $avg_value_max;
$data['sum'.$series_suffix]['avg'] = ($sum_data_avg / $count_data_total); $data['sum'.$series_suffix]['avg'] = ($sum_data_avg / $count_data_total);
} }
}
} else { } else {
foreach ($data_uncompress as $k) { foreach ($data_uncompress as $k) {
foreach ($k['data'] as $v) { foreach ($k['data'] as $v) {
@ -4543,20 +4602,28 @@ function fullscale_data(
$last_data, $last_data,
]; ];
} else { } else {
if ($type_mode_graph <= 1) {
$data['sum'.$series_suffix]['data'][] = [ $data['sum'.$series_suffix]['data'][] = [
($date_array['final_date'] * 1000), ($date_array['final_date'] * 1000),
$last_data, $last_data,
]; ];
}
if ($data_slice) { if ($data_slice) {
if ($type_mode_graph && !$params['baseline']) { if ($type_mode_graph && !$params['baseline']) {
if ((int) $type_mode_graph === 1 || (int) $type_mode_graph === 3) {
$data['min'.$series_suffix]['data'][] = [ $data['min'.$series_suffix]['data'][] = [
($date_array['final_date'] * 1000), ($date_array['final_date'] * 1000),
$min_value, $min_value,
]; ];
}
if ((int) $type_mode_graph === 1 || (int) $type_mode_graph === 2) {
$data['max'.$series_suffix]['data'][] = [ $data['max'.$series_suffix]['data'][] = [
($date_array['final_date'] * 1000), ($date_array['final_date'] * 1000),
$max_value, $max_value,
]; ];
}
} else { } else {
$data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['min'] = $min_value; $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['min'] = $min_value;
$data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['avg'] = 0; $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['avg'] = 0;
@ -4975,8 +5042,20 @@ function graph_nodata_image(
$height=110, $height=110,
$type='area', $type='area',
$text='', $text='',
$percent=false $percent=false,
$base64=false
) { ) {
if ($base64 === true) {
$dataImg = file_get_contents(
html_print_image(
'images/image_problem_area.png',
false,
['style' => 'width:150px;']
)
);
return base64_encode($dataImg);
}
$image = ui_get_full_url( $image = ui_get_full_url(
'images/image_problem_area.png', 'images/image_problem_area.png',
false, false,

View File

@ -3684,17 +3684,24 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic',
$return['failed'] = null; $return['failed'] = null;
$return['data'] = []; $return['data'] = [];
if (is_metaconsole()) { if (is_metaconsole() === true) {
metaconsole_restore_db(); metaconsole_restore_db();
$server_names = metaconsole_get_connection_names(); $server_names = metaconsole_get_connection_names();
if (isset($server_names) && is_array($server_names)) {
if (isset($server_names) === true
&& is_array($server_names) === true
) {
foreach ($server_names as $key => $value) { foreach ($server_names as $key => $value) {
$id_meta = metaconsole_get_id_server($value); $id_meta = metaconsole_get_id_server($value);
$connection = metaconsole_get_connection_by_id($id_meta); $connection = metaconsole_get_connection_by_id($id_meta);
if (metaconsole_connect($connection) != NOERR) { if (metaconsole_connect($connection) != NOERR) {
continue; continue;
} else { } else {
$network_interfaces_by_agents = agents_get_network_interfaces(false, $filter); $network_interfaces_by_agents = agents_get_network_interfaces(
false,
$filter
);
$return = agents_get_network_interfaces_array( $return = agents_get_network_interfaces_array(
$network_interfaces_by_agents, $network_interfaces_by_agents,
$return, $return,
@ -3737,10 +3744,19 @@ function agents_get_network_interfaces_array(
$pdf, $pdf,
$id_meta $id_meta
) { ) {
if (empty($network_interfaces_by_agents)) { global $config;
$return['failed'] = __('The group has no agents or none of the agents has any network interface');
if (empty($network_interfaces_by_agents) === true
&& is_metaconsole() === false
) {
$return['failed'] = __(
'The group has no agents or none of the agents has any network interface'
);
$return['data'] = []; $return['data'] = [];
} else { } else {
if (isset($network_interfaces_by_agents) === true
&& is_array($network_interfaces_by_agents) === true
) {
foreach ($network_interfaces_by_agents as $agent_id => $agent) { foreach ($network_interfaces_by_agents as $agent_id => $agent) {
$row_data = []; $row_data = [];
$row_data['agent'] = $agent['name']; $row_data['agent'] = $agent['name'];
@ -3753,11 +3769,8 @@ function agents_get_network_interfaces_array(
$row_interface['status'] = $interface['status_image']; $row_interface['status'] = $interface['status_image'];
$row_interface['chart'] = null; $row_interface['chart'] = null;
$width = null;
$params = [ $params = [
'period' => $content['period'], 'period' => $content['period'],
'width' => $width,
'unit_name' => array_fill(0, count($interface['traffic']), __('bytes/s')), 'unit_name' => array_fill(0, count($interface['traffic']), __('bytes/s')),
'date' => $report['datetime'], 'date' => $report['datetime'],
'only_image' => $pdf, 'only_image' => $pdf,
@ -3767,11 +3780,13 @@ function agents_get_network_interfaces_array(
'height' => $config['graph_image_height'], 'height' => $config['graph_image_height'],
'landscape' => $content['landscape'], 'landscape' => $content['landscape'],
'return_img_base_64' => true, 'return_img_base_64' => true,
'graph_render' => $content['graph_render'],
]; ];
$params_combined = [ $params_combined = [
'labels' => array_keys($interface['traffic']), 'labels' => array_keys($interface['traffic']),
'modules_series' => array_values($interface['traffic']), 'modules_series' => array_values($interface['traffic']),
'stacked' => CUSTOM_GRAPH_LINE,
]; ];
switch ($type) { switch ($type) {
@ -3814,6 +3829,7 @@ function agents_get_network_interfaces_array(
$return['data'][] = $row_data; $return['data'][] = $row_data;
} }
} }
}
return $return; return $return;
} }
@ -8435,6 +8451,7 @@ function reporting_simple_graph(
'landscape' => $content['landscape'], 'landscape' => $content['landscape'],
'backgroundColor' => 'transparent', 'backgroundColor' => 'transparent',
'return_img_base_64' => true, 'return_img_base_64' => true,
'graph_render' => $content['graph_render'],
]; ];
if ($only_image === false) { if ($only_image === false) {

View File

@ -2516,7 +2516,7 @@ function reporting_html_group_configuration($table, $item, $pdf=0)
function reporting_html_network_interfaces_report($table, $item, $pdf=0) function reporting_html_network_interfaces_report($table, $item, $pdf=0)
{ {
$return_pdf = ''; $return_pdf = '';
if (!empty($item['failed'])) { if (empty($item['failed']) === false) {
if ($pdf === 0) { if ($pdf === 0) {
$table->colspan['interfaces']['cell'] = 3; $table->colspan['interfaces']['cell'] = 3;
$table->cellstyle['interfaces']['cell'] = 'text-align: left;'; $table->cellstyle['interfaces']['cell'] = 'text-align: left;';
@ -5120,7 +5120,7 @@ function reporting_get_last_activity()
function reporting_get_event_histogram($events, $text_header_event=false) function reporting_get_event_histogram($events, $text_header_event=false)
{ {
global $config; global $config;
if (!defined('METACONSOLE')) { if (!is_metaconsole()) {
include_once $config['homedir'].'/include/graphs/functions_gd.php'; include_once $config['homedir'].'/include/graphs/functions_gd.php';
} else { } else {
include_once '../../include/graphs/functions_gd.php'; include_once '../../include/graphs/functions_gd.php';
@ -5128,7 +5128,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
$max_value = count($events); $max_value = count($events);
if (defined('METACONSOLE')) { if (is_metaconsole()) {
$max_value = SECONDS_1HOUR; $max_value = SECONDS_1HOUR;
} }
@ -5149,7 +5149,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
EVENT_CRIT_CRITICAL => COL_CRITICAL, EVENT_CRIT_CRITICAL => COL_CRITICAL,
]; ];
if (defined('METACONSOLE')) { if (is_metaconsole()) {
$full_legend = []; $full_legend = [];
$cont = 0; $cont = 0;
} }
@ -5193,7 +5193,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
break; break;
} }
if (defined('METACONSOLE')) { if (is_metaconsole()) {
$full_legend[$cont] = $data['timestamp']; $full_legend[$cont] = $data['timestamp'];
$graph_data[] = [ $graph_data[] = [
'data' => $color, 'data' => $color,
@ -5212,17 +5212,18 @@ function reporting_get_event_histogram($events, $text_header_event=false)
$table->width = '100%'; $table->width = '100%';
$table->data = []; $table->data = [];
$table->size = []; $table->size = [];
$table->size[0] = '100%';
$table->head = []; $table->head = [];
$table->title = '<span>'.$text_header_event.'</span>'; $table->title = '<span>'.$text_header_event.'</span>';
$table->data[0][0] = ''; $table->data[0][0] = '';
if (!empty($graph_data)) { if (empty($graph_data) === false) {
$url_slice = defined('METACONSOLE') ? $url : $urlImage; $url_slice = is_metaconsole() ? $url : $urlImage;
$slicebar = flot_slicesbar_graph( $slicebar = flot_slicesbar_graph(
$graph_data, $graph_data,
$max_value, $max_value,
100, '450px;border:0',
25, 25,
$full_legend, $full_legend,
$colors, $colors,
@ -5235,8 +5236,8 @@ function reporting_get_event_histogram($events, $text_header_event=false)
0, 0,
[], [],
true, true,
$ttl, 1,
true, false,
false false
); );
@ -5245,7 +5246,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
$table->data[0][0] = __('No events'); $table->data[0][0] = __('No events');
} }
if (!defined('METACONSOLE')) { if (!is_metaconsole()) {
if (!$text_header_event) { if (!$text_header_event) {
$event_graph = '<fieldset class="databox tactical_set"> $event_graph = '<fieldset class="databox tactical_set">
<legend>'.$text_header_event.'</legend>'.html_print_table($table, true).'</fieldset>'; <legend>'.$text_header_event.'</legend>'.html_print_table($table, true).'</fieldset>';

View File

@ -2469,7 +2469,9 @@ function pandoraFlotArea(
}); });
label_aux = label_aux =
legend[series.label].split(":")[0] + data_legend[series.label]; legend[series.label].split(": Min")[0] +
": " +
data_legend[series.label];
$("#legend_" + graph_id + " .legendLabel") $("#legend_" + graph_id + " .legendLabel")
.eq(i) .eq(i)
.html(label_aux); .html(label_aux);

View File

@ -8,7 +8,7 @@ div#bullets_modules span {
} }
table#agent_interface_info .noresizevc.graph { table#agent_interface_info .noresizevc.graph {
width: 500px; margin-bottom: 10px;
} }
div.agent_details_agent_alias { div.agent_details_agent_alias {

View File

@ -3077,6 +3077,7 @@ div.nodata_container {
display: table; display: table;
} }
div#stat-win-interface-graph div.nodata_container,
div#stat-win-module-graph div.nodata_container { div#stat-win-module-graph div.nodata_container {
width: 30%; width: 30%;
height: 100%; height: 100%;

View File

@ -215,8 +215,6 @@ class Agent
$status_chart_width = 160; $status_chart_width = 160;
$graph_width = 160; $graph_width = 160;
hd($this->agent, true);
$html = '<div class="agent_graphs">'; $html = '<div class="agent_graphs">';
$html .= '<b>'.__('Modules by status').'</b>'; $html .= '<b>'.__('Modules by status').'</b>';
$html .= '<div id="status_pie" style="margin: auto; width: '.$status_chart_width.'px; margin-bottom: 10px;">'; $html .= '<div id="status_pie" style="margin: auto; width: '.$status_chart_width.'px; margin-bottom: 10px;">';

View File

@ -32,7 +32,6 @@ global $config;
require_once 'include/functions_agents.php'; require_once 'include/functions_agents.php';
require_once $config['homedir'].'/include/functions_graph.php'; require_once $config['homedir'].'/include/functions_graph.php';
include_graphs_dependencies();
require_once $config['homedir'].'/include/functions_groups.php'; require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_ui.php'; require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_incidents.php'; require_once $config['homedir'].'/include/functions_incidents.php';
@ -611,7 +610,7 @@ if (!empty($network_interfaces)) {
$table_interface->style = []; $table_interface->style = [];
$table_interface->style['interface_status'] = 'width: 30px;padding-top:0px;padding-bottom:0px;'; $table_interface->style['interface_status'] = 'width: 30px;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_graph'] = 'width: 20px;padding-top:0px;padding-bottom:0px;'; $table_interface->style['interface_graph'] = 'width: 20px;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_event_graph'] = 'width: 100%;padding-top:0px;padding-bottom:0px;'; $table_interface->style['interface_event_graph'] = 'width: 35%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_event_graph'] = 'right'; $table_interface->align['interface_event_graph'] = 'right';
// $table_interface->style['interface_event_graph'] = 'width: 5%;padding-top:0px;padding-bottom:0px;'; // $table_interface->style['interface_event_graph'] = 'width: 5%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_event_graph_text'] = 'left'; $table_interface->align['interface_event_graph_text'] = 'left';
@ -619,7 +618,7 @@ if (!empty($network_interfaces)) {
$table_interface->align['interface_name'] = 'left'; $table_interface->align['interface_name'] = 'left';
$table_interface->align['interface_ip'] = 'left'; $table_interface->align['interface_ip'] = 'left';
$table_interface->align['last_contact'] = 'left'; $table_interface->align['last_contact'] = 'left';
$table_interface->style['last_contact'] = 'width: 40%;padding-top:0px;padding-bottom:0px;'; $table_interface->style['last_contact'] = 'width: 20%;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_ip'] = 'width: 8%;padding-top:0px;padding-bottom:0px;'; $table_interface->style['interface_ip'] = 'width: 8%;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_mac'] = 'width: 12%;padding-top:0px;padding-bottom:0px;'; $table_interface->style['interface_mac'] = 'width: 12%;padding-top:0px;padding-bottom:0px;';
@ -729,9 +728,15 @@ if (!empty($network_interfaces)) {
$text_event_header = __('Events info (24hr.)'); $text_event_header = __('Events info (24hr.)');
if (!$events) { if (!$events) {
$no_events = ['color' => ['criticity' => 2]]; $no_events = ['color' => ['criticity' => 2]];
$e_graph = reporting_get_event_histogram($no_events, $text_event_header); $e_graph = reporting_get_event_histogram(
$no_events,
$text_event_header
);
} else { } else {
$e_graph = reporting_get_event_histogram($events, $text_event_header); $e_graph = reporting_get_event_histogram(
$events,
$text_event_header
);
} }
$data = []; $data = [];
@ -865,6 +870,9 @@ echo $agent_incidents;
if (isset($table_interface)) { if (isset($table_interface)) {
ui_toggle( ui_toggle(
html_print_table($table_interface, true), html_print_table($table_interface, true),
'<b>'.__('Interface information (SNMP)').'</b>' '<b>'.__('Interface information (SNMP)').'</b>',
'',
'interface-table-status-agent',
true
); );
} }

View File

@ -302,7 +302,7 @@ html_print_div(
); );
// Graph. // Graph.
echo '<div>'; echo '<div id="stat-win-interface-graph">';
$height = 280; $height = 280;
$width = '90%'; $width = '90%';

View File

@ -1544,6 +1544,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`landscape` tinyint(1) UNSIGNED NOT NULL default 0, `landscape` tinyint(1) UNSIGNED NOT NULL default 0,
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0, `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
`compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0, `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
`graph_render` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_rc`), PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
@ -3123,6 +3124,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`landscape` tinyint(1) UNSIGNED NOT NULL default 0, `landscape` tinyint(1) UNSIGNED NOT NULL default 0,
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0, `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
`compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0, `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
`graph_render` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_rc`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''), ('custom_report_front_header', ''),
('custom_report_front_footer', ''), ('custom_report_front_footer', ''),
('MR', 41), ('MR', 42),
('identification_reminder', 1), ('identification_reminder', 1),
('identification_reminder_timestamp', 0), ('identification_reminder_timestamp', 0),
('current_package_enterprise', '749'), ('current_package_enterprise', 750),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'), ('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
('custom_docs_logo', 'default_docs.png'), ('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'), ('custom_support_logo', 'default_support.png'),