Revert "Added the 'automatic custom graphs' in the template reports in metaconsole."

This reverts commit 447550ed500db8ad1b7502f8e5c1a3a68da1e45d.
This commit is contained in:
m-lopez-f 2016-06-01 15:58:18 +02:00
parent ea77a5bb89
commit 46158fedfc
9 changed files with 47 additions and 202 deletions

View File

@ -182,7 +182,6 @@ ALTER TABLE tagente_estado ADD COLUMN `last_dynamic_update` bigint(20) NOT NULL
-- Table `tgraph_source` -- Table `tgraph_source`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tgraph_source ADD COLUMN `label` varchar(150) DEFAULT ''; ALTER TABLE tgraph_source ADD COLUMN `label` varchar(150) DEFAULT '';
ALTER TABLE tgraph_source ADD COLUMN `id_server` int(11) NOT NULL default 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tevent_filter` -- Table `tevent_filter`

View File

@ -130,4 +130,3 @@ ALTER TABLE tevent_filter ADD COLUMN id_agent int(25) DEFAULT 0;
-- Table `tgraph_source` -- Table `tgraph_source`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tgraph_source ADD COLUMN label VARCHAR2(150) DEFAULT ''; ALTER TABLE tgraph_source ADD COLUMN label VARCHAR2(150) DEFAULT '';
ALTER TABLE tgraph_source ADD COLUMN "id_server" BIGINT NOT NULL default 0;

View File

@ -121,9 +121,3 @@ UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN id_agent_module int(25) DEFAULT 0; ALTER TABLE tevent_filter ADD COLUMN id_agent_module int(25) DEFAULT 0;
ALTER TABLE tevent_filter ADD COLUMN id_agent int(25) DEFAULT 0; ALTER TABLE tevent_filter ADD COLUMN id_agent int(25) DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tgraph_source`
-- ---------------------------------------------------------------------
ALTER TABLE tgraph_source ADD COLUMN label VARCHAR2(150) DEFAULT '';
ALTER TABLE tgraph_source ADD COLUMN id_graph NUMBER(19, 0) DEFAULT 0;

View File

@ -484,7 +484,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$show_alerts = false, $avg_only = 0, $date = 0, $unit = '', $show_alerts = false, $avg_only = 0, $date = 0, $unit = '',
$baseline = 0, $return_data = 0, $show_title = true, $projection = false, $baseline = 0, $return_data = 0, $show_title = true, $projection = false,
$adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '', $adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '',
$show_unknown = false, $percentil = null) { $show_unknown = false, $percentil = null, $dashboard = false, $vconsole = false) {
global $config; global $config;
global $chart; global $chart;
@ -733,13 +733,19 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$chart_extra_data['legend_alerts'] = $legend['alert'.$series_suffix_str]; $chart_extra_data['legend_alerts'] = $legend['alert'.$series_suffix_str];
} }
if (!$avg_only) { if ($dashboard || $vconsole) {
$legend['sum'.$series_suffix] =
__('Last') . ': ' . rtrim(number_format($graph_stats['sum']['last'], 2), '.0') . ($unit ? ' ' . $unit : '') . ' ; '
. __('Avg') . ': ' . rtrim(number_format($graph_stats['sum']['avg'], 2), '.0') . ($unit ? ' ' . $unit : '');
}
else if (!$avg_only) {
$legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['max']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['max']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['max']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['max']['min'], 2), '.0').' '.$unit.'--> '.__('Selected'); $legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['max']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['max']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['max']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['max']['min'], 2), '.0').' '.$unit.'--> '.__('Selected');
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit.'--> '.__('Selected'); $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit.'--> '.__('Selected');
$legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['min']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['min']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['min']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['min']['min'], 2), '.0').' '.$unit.'--> '.__('Selected'); $legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['min']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['min']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['min']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['min']['min'], 2), '.0').' '.$unit.'--> '.__('Selected');
} }
else else {
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit.'--> '.__('Selected'); $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit.'--> '.__('Selected');
}
//Baseline was replaced by compare graph feature //Baseline was replaced by compare graph feature
/*if ($baseline) { /*if ($baseline) {
$legend['baseline'.$series_suffix] = __('Baseline'); $legend['baseline'.$series_suffix] = __('Baseline');
@ -765,7 +771,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$unit = '', $baseline = 0, $return_data = 0, $show_title = true, $unit = '', $baseline = 0, $return_data = 0, $show_title = true,
$only_image = false, $homeurl = '', $ttl = 1, $projection = false, $only_image = false, $homeurl = '', $ttl = 1, $projection = false,
$adapt_key = '', $compare = false, $show_unknown = false, $adapt_key = '', $compare = false, $show_unknown = false,
$menu = true, $backgroundColor = 'white', $percentil = null) { $menu = true, $backgroundColor = 'white', $percentil = null,
$dashboard = false, $vconsole = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -796,7 +803,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$show_alerts, $avg_only, $date-$period, $unit, $baseline, $show_alerts, $avg_only, $date-$period, $unit, $baseline,
$return_data, $show_title, $projection, $adapt_key, $return_data, $show_title, $projection, $adapt_key,
$compare, $series_suffix, $series_suffix_str, $compare, $series_suffix, $series_suffix_str,
$show_unknown, $percentil); $show_unknown, $percentil, $dashboard, $vconsole);
@ -832,7 +839,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$show_alerts, $avg_only, $show_alerts, $avg_only,
$date, $unit, $baseline, $return_data, $show_title, $date, $unit, $baseline, $return_data, $show_title,
$projection, $adapt_key, $compare, '', '', $show_unknown, $projection, $adapt_key, $compare, '', '', $show_unknown,
$percentil); $percentil, $dashboard, $vconsole);
if ($return_data) { if ($return_data) {
@ -867,7 +874,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
area_graph($flash_chart, $chart, $width, $height/2, $color, area_graph($flash_chart, $chart, $width, $height/2, $color,
$legend, $long_index, $legend, $long_index,
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark, $config['fontpath'], $title, $unit, $homeurl, $water_mark, $config['fontpath'],
$config['font_size'], $unit, $ttl, $series_type, $config['font_size'], $unit, $ttl, $series_type,
$chart_extra_data, $warning_min, $critical_min, $chart_extra_data, $warning_min, $critical_min,
$adapt_key, false, $series_suffix_str, $menu, $adapt_key, false, $series_suffix_str, $menu,
@ -876,7 +883,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
area_graph($flash_chart, $chart_prev, $width, $height/2, area_graph($flash_chart, $chart_prev, $width, $height/2,
$color_prev, $legend_prev, $long_index_prev, $color_prev, $legend_prev, $long_index_prev,
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark, $config['fontpath'], $title, $unit, $homeurl, $water_mark, $config['fontpath'],
$config['font_size'], $unit, $ttl, $series_type_prev, $config['font_size'], $unit, $ttl, $series_type_prev,
$chart_extra_data, $warning_min, $critical_min, $chart_extra_data, $warning_min, $critical_min,
$adapt_key, false, $series_suffix_str, $menu, $adapt_key, false, $series_suffix_str, $menu,
@ -888,11 +895,11 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
area_graph($flash_chart, $chart, $width, $height, $color, area_graph($flash_chart, $chart, $width, $height, $color,
$legend, $long_index, $legend, $long_index,
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark, $config['fontpath'], $title, $unit, $homeurl, $water_mark, $config['fontpath'],
$config['font_size'], $unit, $ttl, $series_type, $config['font_size'], $unit, $ttl, $series_type,
$chart_extra_data, $warning_min, $critical_min, $chart_extra_data, $warning_min, $critical_min,
$adapt_key, false, $series_suffix_str, $menu, $adapt_key, false, $series_suffix_str, $menu,
$backgroundColor); $backgroundColor, $dashboard, $vconsole, $agent_module_id);
} }
} }
elseif ($config['type_module_charts'] === 'line') { elseif ($config['type_module_charts'] === 'line') {
@ -969,7 +976,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$only_image = false, $homeurl = '', $ttl = 1, $projection = false, $only_image = false, $homeurl = '', $ttl = 1, $projection = false,
$prediction_period = false, $background_color = 'white', $prediction_period = false, $background_color = 'white',
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true, $name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
$show_min = true, $show_avg = true, $labels = false, $dashboard = false) { $show_min = true, $show_avg = true, $labels = false, $dashboard = false, $vconsole = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -1079,36 +1086,16 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// Calculate data for each module // Calculate data for each module
for ($i = 0; $i < $module_number; $i++) { for ($i = 0; $i < $module_number; $i++) {
$automatic_custom_graph_meta = false; // If its a projection graph, first module will be data and second will be the projection
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_list[$i])) {
$server = metaconsole_get_connection_by_id ($module_list[$i]['server']);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
$search_in_history_db = db_search_in_history_db($datelimit);
// If its a projection graph,
// first module will be data and second will be the projection
if ($projection != false && $i != 0) { if ($projection != false && $i != 0) {
if ($automatic_custom_graph_meta) $agent_module_id = $module_list[0];
$agent_module_id = $module_list[0]['module'];
else
$agent_module_id = $module_list[0];
$id_module_type = modules_get_agentmodule_type ($agent_module_id); $id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type); $module_type = modules_get_moduletype_name ($id_module_type);
$uncompressed_module = is_module_uncompressed ($module_type); $uncompressed_module = is_module_uncompressed ($module_type);
} }
else { else {
if ($automatic_custom_graph_meta) $agent_module_id = $module_list[$i];
$agent_module_id = $module_list[$i]['module'];
else
$agent_module_id = $module_list[$i];
$id_module_type = modules_get_agentmodule_type ($agent_module_id); $id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type); $module_type = modules_get_moduletype_name ($id_module_type);
@ -1198,7 +1185,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
//Get and process module name //Get and process module name
$module_name = io_safe_output( $module_name = io_safe_output(
modules_get_agentmodule_name ($agent_module_id)); modules_get_agentmodule_name ($agent_module_id));
$module_name = sprintf(__("projection for %s"), $module_name); $module_name = sprintf(__("%s"), $module_name);
$module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false); $module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false);
if ($labels[$agent_module_id] != '') if ($labels[$agent_module_id] != '')
@ -1391,13 +1378,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
//unset($graph_values[$i]); //unset($graph_values[$i]);
//$graph_values[$i] = $graph_values[$i]; //$graph_values[$i] = $graph_values[$i];
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
}
} }
$temp = array(); $temp = array();
@ -1405,24 +1385,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
switch ($stacked) { switch ($stacked) {
case CUSTOM_GRAPH_BULLET_CHART: case CUSTOM_GRAPH_BULLET_CHART:
$datelimit = $date - $period; $datelimit = $date - $period;
foreach ($module_list as $module_item) { foreach ($module_list as $module) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_item)) {
$server = metaconsole_get_connection_by_id ($module_item['server']);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta)
$module = $module_item['module'];
else
$module = $module_item;
$search_in_history_db = db_search_in_history_db($datelimit);
$temp[$module] = modules_get_agentmodule($module); $temp[$module] = modules_get_agentmodule($module);
$query_last_value = sprintf(' $query_last_value = sprintf('
SELECT datos SELECT datos
@ -1448,37 +1411,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$temp[$module]['value'] = $value; $temp[$module]['value'] = $value;
$temp[$module]['max'] = reporting_get_agentmodule_data_max($module,$period,$date); $temp[$module]['max'] = reporting_get_agentmodule_data_max($module,$period,$date);
$temp[$module]['min'] = reporting_get_agentmodule_data_min($module,$period,$date); $temp[$module]['min'] = reporting_get_agentmodule_data_min($module,$period,$date);
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_item)) {
metaconsole_restore_db();
}
}
} }
break; break;
case CUSTOM_GRAPH_HBARS: case CUSTOM_GRAPH_HBARS:
case CUSTOM_GRAPH_VBARS: case CUSTOM_GRAPH_VBARS:
$datelimit = $date - $period; $datelimit = $date - $period;
$label = ''; $label = '';
foreach ($module_list as $module_item) { foreach ($module_list as $module) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_item)) {
$server = metaconsole_get_connection_by_id ($module_item['server']);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta)
$module = $module_item['module'];
else
$module = $module_item;
$module_data = modules_get_agentmodule($module); $module_data = modules_get_agentmodule($module);
$query_last_value = sprintf(' $query_last_value = sprintf('
SELECT datos SELECT datos
@ -1497,36 +1437,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else else
$label = $agent_name . " - " .$module_data['nombre']; $label = $agent_name . " - " .$module_data['nombre'];
$temp[$label]['g'] = round($temp_data,4); $temp[$label]['g'] = round($temp_data,4);
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_item)) {
metaconsole_restore_db();
}
}
} }
break; break;
case CUSTOM_GRAPH_PIE: case CUSTOM_GRAPH_PIE:
$datelimit = $date - $period; $datelimit = $date - $period;
$total_modules = 0; $total_modules = 0;
foreach ($module_list as $module_item) { foreach ($module_list as $module) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_item)) {
$server = metaconsole_get_connection_by_id ($module_item['server']);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta)
$module = $module_item['module'];
else
$module = $module_item;
$data_module = modules_get_agentmodule($module); $data_module = modules_get_agentmodule($module);
$query_last_value = sprintf(' $query_last_value = sprintf('
SELECT datos SELECT datos
@ -1553,39 +1469,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$label = $data_module['nombre']; $label = $data_module['nombre'];
$label = io_safe_output($label); $label = io_safe_output($label);
$temp[$label] = array( $temp[$label] = array('value'=>$value,
'value'=>$value, 'unit'=>$data_module['unit']);
'unit'=>$data_module['unit']);
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_item)) {
metaconsole_restore_db();
}
}
} }
$temp['total_modules'] = $total_modules; $temp['total_modules'] = $total_modules;
break; break;
case CUSTOM_GRAPH_GAUGE: case CUSTOM_GRAPH_GAUGE:
$datelimit = $date - $period; $datelimit = $date - $period;
$i = 0;
foreach ($module_list as $module) { foreach ($module_list as $module) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_item)) {
$server = metaconsole_get_connection_by_id ($module_item['server']);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta)
$module = $module_item['module'];
else
$module = $module_item;
$temp[$module] = modules_get_agentmodule($module); $temp[$module] = modules_get_agentmodule($module);
$query_last_value = sprintf(' $query_last_value = sprintf('
SELECT datos SELECT datos
@ -1623,14 +1514,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max; $temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
} }
$temp[$module]['gauge'] = uniqid('gauge_'); $temp[$module]['gauge'] = uniqid('gauge_');
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_item)) {
metaconsole_restore_db();
}
}
} }
break; break;
default: default:
@ -1717,7 +1600,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
'color' => COL_GRAPH13, 'color' => COL_GRAPH13,
'alpha' => CHART_DEFAULT_ALPHA); 'alpha' => CHART_DEFAULT_ALPHA);
switch ($stacked) { switch ($stacked) {
case CUSTOM_GRAPH_AREA: case CUSTOM_GRAPH_AREA:
return area_graph($flash_charts, $graph_values, $width, return area_graph($flash_charts, $graph_values, $width,
@ -1725,7 +1607,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $homeurl, $water_mark, $config['fontpath'], "", "", $homeurl, $water_mark, $config['fontpath'],
$fixed_font_size, $unit, $ttl, array(), array(), 0, 0, '', $fixed_font_size, $unit, $ttl, array(), array(), 0, 0, '',
false, '', true, $background_color,$dashboard); false, '', true, $background_color,$dashboard, $vconsole);
break; break;
default: default:
case CUSTOM_GRAPH_STACKED_AREA: case CUSTOM_GRAPH_STACKED_AREA:
@ -1733,21 +1615,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$width, $height, $color, $module_name_list, $long_index, $width, $height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], $fixed_font_size, "", "", $water_mark, $config['fontpath'], $fixed_font_size,
"", $ttl, $homeurl, $background_color,$dashboard); "", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
break; break;
case CUSTOM_GRAPH_LINE: case CUSTOM_GRAPH_LINE:
return line_graph($flash_charts, $graph_values, $width, return line_graph($flash_charts, $graph_values, $width,
$height, $color, $module_name_list, $long_index, $height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], $fixed_font_size, "", "", $water_mark, $config['fontpath'], $fixed_font_size,
$unit, $ttl, $homeurl, $background_color,$dashboard); $unit, $ttl, $homeurl, $background_color,$dashboard, $vconsole);
break; break;
case CUSTOM_GRAPH_STACKED_LINE: case CUSTOM_GRAPH_STACKED_LINE:
return stacked_line_graph($flash_charts, $graph_values, return stacked_line_graph($flash_charts, $graph_values,
$width, $height, $color, $module_name_list, $long_index, $width, $height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], $fixed_font_size, "", "", $water_mark, $config['fontpath'], $fixed_font_size,
"", $ttl, $homeurl, $background_color,$dashboard); "", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
break; break;
case CUSTOM_GRAPH_BULLET_CHART: case CUSTOM_GRAPH_BULLET_CHART:
return stacked_bullet_chart($flash_charts, $graph_values, return stacked_bullet_chart($flash_charts, $graph_values,
@ -2121,7 +2003,7 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek
// If the data is not provided, we got it // If the data is not provided, we got it
if ($data === false) { if ($data === false) {
$data = reporting_get_agentmodule_sla_array ($id, $period, $data = reporting_get_agentmodule_sla_array ($id, $period,
$sla_min, $sla_max, $date, $daysWeek, $time_from, $time_to); $sla_min, $sla_max, $date, $daysWeek, null, null);
} }
$col_planned_downtime = '#20973F'; $col_planned_downtime = '#20973F';

View File

@ -160,22 +160,14 @@ function reporting_make_reporting_data($report = null, $id_report,
$content); $content);
break; break;
case 'custom_graph': case 'custom_graph':
case 'automatic_custom_graph':
$report['contents'][] = $report['contents'][] =
reporting_custom_graph( reporting_custom_graph(
$report, $report,
$content, $content,
$type, $type,
$force_width_chart, $force_width_chart,
$force_height_chart, 'custom_graph'); $force_height_chart);
break;
case 'automatic_graph':
$report['contents'][] =
reporting_custom_graph(
$report,
$content,
$type,
$force_width_chart,
$force_height_chart, 'automatic_graph');
break; break;
case 'text': case 'text':
$report['contents'][] = reporting_text( $report['contents'][] = reporting_text(
@ -4275,23 +4267,18 @@ function reporting_general($report, $content) {
} }
function reporting_custom_graph($report, $content, $type = 'dinamic', function reporting_custom_graph($report, $content, $type = 'dinamic',
$force_width_chart = null, $force_height_chart = null, $type_report = "custom_graph") { $force_width_chart = null, $force_height_chart = null) {
global $config; global $config;
require_once ($config["homedir"] . '/include/functions_graph.php'); require_once ($config["homedir"] . '/include/functions_graph.php');
if ($type_report == 'automatic_graph') { if ($config['metaconsole']) {
// Do none $id_meta = metaconsole_get_id_server($content["server_name"]);
}
else {
if ($config['metaconsole']) {
$id_meta = metaconsole_get_id_server($content["server_name"]);
$server = metaconsole_get_connection_by_id ($id_meta); $server = metaconsole_get_connection_by_id ($id_meta);
metaconsole_connect($server); metaconsole_connect($server);
}
} }
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
@ -4318,15 +4305,7 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$graphs = array(); $graphs = array();
foreach ($graphs as $graph_item) { foreach ($graphs as $graph_item) {
if ($type_report == 'automatic_graph') { array_push ($modules, $graph_item['id_agent_module']);
array_push ($modules, array(
'module' => $graph_item['id_agent_module'],
'server' => $graph_item['id_server']));
}
else {
array_push ($modules, $graph_item['id_agent_module']);
}
array_push ($weights, $graph_item["weight"]); array_push ($weights, $graph_item["weight"]);
} }
@ -4360,13 +4339,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
break; break;
} }
if ($type_report == 'automatic_graph') { if ($config['metaconsole']) {
// Do none metaconsole_restore_db();
}
else {
if ($config['metaconsole']) {
metaconsole_restore_db();
}
} }
return reporting_check_structure_content($return); return reporting_check_structure_content($return);

View File

@ -514,6 +514,7 @@ function reports_get_report_types ($template = false, $not_editor = false) {
$types['sql_graph_hbar'] = array('optgroup' => __('Graphs'), $types['sql_graph_hbar'] = array('optgroup' => __('Graphs'),
'name' => __('SQL horizonal bar graph')); 'name' => __('SQL horizonal bar graph'));
} }
if ($template) { if ($template) {
$types['automatic_graph'] = array('optgroup' => __('Graphs'), $types['automatic_graph'] = array('optgroup' => __('Graphs'),
'name' => __('Automatic combined Graph')); 'name' => __('Automatic combined Graph'));

View File

@ -1194,7 +1194,6 @@ CREATE OR REPLACE TRIGGER tgraph_inc BEFORE INSERT ON tgraph REFERENCING NEW AS
CREATE TABLE tgraph_source ( CREATE TABLE tgraph_source (
id_gs NUMBER(10, 0) PRIMARY KEY, id_gs NUMBER(10, 0) PRIMARY KEY,
id_graph NUMBER(19, 0) DEFAULT 0, id_graph NUMBER(19, 0) DEFAULT 0,
id_server NUMBER(19, 0) DEFAULT 0,
id_agent_module NUMBER(19, 0) DEFAULT 0, id_agent_module NUMBER(19, 0) DEFAULT 0,
weight BINARY_DOUBLE DEFAULT 0, weight BINARY_DOUBLE DEFAULT 0,
label VARCHAR2(150) DEFAULT '' label VARCHAR2(150) DEFAULT ''

View File

@ -984,11 +984,9 @@ CREATE TABLE "tgraph" (
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE "tgraph_source" ( CREATE TABLE "tgraph_source" (
"id_gs" SERIAL NOT NULL PRIMARY KEY, "id_gs" SERIAL NOT NULL PRIMARY KEY,
"id_server" BIGINT NOT NULL default 0,
"id_graph" BIGINT NOT NULL default 0, "id_graph" BIGINT NOT NULL default 0,
"id_agent_module" BIGINT NOT NULL default 0, "id_agent_module" BIGINT NOT NULL default 0,
"weight" DOUBLE PRECISION default 0, "weight" DOUBLE PRECISION default 0
"label" VARCHAR2(150) DEFAULT ''
); );
-- ----------------------------------------------------- -- -----------------------------------------------------

View File

@ -1071,7 +1071,6 @@ CREATE TABLE IF NOT EXISTS `tgraph` (
CREATE TABLE IF NOT EXISTS `tgraph_source` ( CREATE TABLE IF NOT EXISTS `tgraph_source` (
`id_gs` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `id_gs` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_graph` int(11) NOT NULL default 0, `id_graph` int(11) NOT NULL default 0,
`id_server` int(11) NOT NULL default 0,
`id_agent_module` int(11) NOT NULL default 0, `id_agent_module` int(11) NOT NULL default 0,
`weight` float(8,3) NOT NULL DEFAULT 0, `weight` float(8,3) NOT NULL DEFAULT 0,
`label` varchar(150) DEFAULT '', `label` varchar(150) DEFAULT '',