fixed errors in automatic combined graph
This commit is contained in:
parent
b18ace9ef6
commit
51104136a9
|
@ -1275,9 +1275,22 @@ function graphic_combined_module(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($count_modules > 0) {
|
if ($count_modules > 0) {
|
||||||
$sources = true;
|
foreach ($module_list as $key => $value) {
|
||||||
|
$sources[$key]['id_server'] = $value['server'];
|
||||||
|
$sources[$key]['id_agent_module'] = $value['module'];
|
||||||
|
$sources[$key]['weight'] = $weights[$key];
|
||||||
|
$sources[$key]['label'] = $params_combined['labels'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
$server = metaconsole_get_connection_by_id($params['server_id']);
|
||||||
|
if (metaconsole_connect($server) != NOERR) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sources = db_get_all_rows_field_filter(
|
$sources = db_get_all_rows_field_filter(
|
||||||
'tgraph_source',
|
'tgraph_source',
|
||||||
'id_graph',
|
'id_graph',
|
||||||
|
@ -1285,8 +1298,18 @@ function graphic_combined_module(
|
||||||
'field_order'
|
'field_order'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
if (isset($sources) && is_array($sources)) {
|
||||||
|
foreach ($sources as $key => $value) {
|
||||||
|
$sources[$key]['id_server'] = $params['server_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$series = db_get_all_rows_sql(
|
$series = db_get_all_rows_sql(
|
||||||
'SELECT summatory_series,average_series, modules_series
|
'SELECT summatory_series,
|
||||||
|
average_series,
|
||||||
|
modules_series
|
||||||
FROM tgraph
|
FROM tgraph
|
||||||
WHERE id_graph = '.$params_combined['id_graph']
|
WHERE id_graph = '.$params_combined['id_graph']
|
||||||
);
|
);
|
||||||
|
@ -1295,13 +1318,29 @@ function graphic_combined_module(
|
||||||
$average = $series[0]['average_series'];
|
$average = $series[0]['average_series'];
|
||||||
$modules_series = $series[0]['modules_series'];
|
$modules_series = $series[0]['modules_series'];
|
||||||
|
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($sources) && is_array($sources)) {
|
||||||
$weights = [];
|
$weights = [];
|
||||||
$labels = [];
|
$labels = [];
|
||||||
$modules = [];
|
$modules = [];
|
||||||
|
|
||||||
if (isset($sources) && is_array($sources)) {
|
|
||||||
foreach ($sources as $source) {
|
foreach ($sources as $source) {
|
||||||
array_push($modules, $source['id_agent_module']);
|
if (is_metaconsole() === true) {
|
||||||
|
$server = metaconsole_get_connection_by_id($source['id_server']);
|
||||||
|
if (metaconsole_connect($server) != NOERR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modulepush = [
|
||||||
|
'server' => (isset($source['id_server']) === true) ? $source['id_server'] : 0,
|
||||||
|
'module' => $source['id_agent_module'],
|
||||||
|
];
|
||||||
|
|
||||||
|
array_push($modules, $modulepush);
|
||||||
array_push($weights, $source['weight']);
|
array_push($weights, $source['weight']);
|
||||||
if ($source['label'] != '' || $params_combined['labels']) {
|
if ($source['label'] != '' || $params_combined['labels']) {
|
||||||
$id_agent = agents_get_module_id(
|
$id_agent = agents_get_module_id(
|
||||||
|
@ -1331,8 +1370,23 @@ function graphic_combined_module(
|
||||||
'module_description' => $module_description,
|
'module_description' => $module_description,
|
||||||
];
|
];
|
||||||
|
|
||||||
$labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($items_label, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
|
if ($source['label'] != '') {
|
||||||
|
$lab = reporting_label_macro(
|
||||||
|
$items_label,
|
||||||
|
$source['label']
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$lab = reporting_label_macro(
|
||||||
|
$items_label,
|
||||||
|
$params_combined['labels']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$labels[$source['id_agent_module']] = $lab;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1429,14 +1483,16 @@ function graphic_combined_module(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_metaconsole() && $params_combined['type_report'] == 'automatic_graph') {
|
if (is_metaconsole()) {
|
||||||
$server = metaconsole_get_connection_by_id($agent_module_id['server']);
|
$server = metaconsole_get_connection_by_id(
|
||||||
|
$agent_module_id['server']
|
||||||
|
);
|
||||||
if (metaconsole_connect($server) != NOERR) {
|
if (metaconsole_connect($server) != NOERR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$agent_module_id = $agent_module_id['module'];
|
$agent_module_id = $agent_module_id['module'];
|
||||||
}
|
|
||||||
|
|
||||||
$module_data = db_get_row_sql(
|
$module_data = db_get_row_sql(
|
||||||
'SELECT * FROM tagente_modulo
|
'SELECT * FROM tagente_modulo
|
||||||
|
@ -1516,7 +1572,12 @@ function graphic_combined_module(
|
||||||
if ($config['fixed_graph'] == false) {
|
if ($config['fixed_graph'] == false) {
|
||||||
$water_mark = [
|
$water_mark = [
|
||||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||||
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
|
'url' => ui_get_full_url(
|
||||||
|
'images/logo_vertical_water.png',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1525,9 +1586,7 @@ function graphic_combined_module(
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
if (is_metaconsole()
|
if (is_metaconsole()) {
|
||||||
&& $params_combined['type_report'] == 'automatic_graph'
|
|
||||||
) {
|
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7766,18 +7766,6 @@ function reporting_custom_graph(
|
||||||
|
|
||||||
include_once $config['homedir'].'/include/functions_graph.php';
|
include_once $config['homedir'].'/include/functions_graph.php';
|
||||||
|
|
||||||
if ($type_report == 'custom_graph') {
|
|
||||||
if (is_metaconsole()) {
|
|
||||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
|
||||||
$server = metaconsole_get_connection_by_id($id_meta);
|
|
||||||
if (metaconsole_connect($server) != NOERR) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$graph = db_get_row('tgraph', 'id_graph', $content['id_gs']);
|
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
$return['type'] = 'custom_graph';
|
$return['type'] = 'custom_graph';
|
||||||
|
|
||||||
|
@ -7791,10 +7779,47 @@ function reporting_custom_graph(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_meta = 0;
|
||||||
if ($type_report == 'custom_graph') {
|
if ($type_report == 'custom_graph') {
|
||||||
$graphs = db_get_all_rows_field_filter('tgraph', 'id_graph', $content['id_gs']);
|
|
||||||
$id_graph = $content['id_gs'];
|
$id_graph = $content['id_gs'];
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||||
|
$server = metaconsole_get_connection_by_id($id_meta);
|
||||||
|
if (metaconsole_connect($server) != NOERR) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$graphs = db_get_all_rows_field_filter(
|
||||||
|
'tgraph',
|
||||||
|
'id_graph',
|
||||||
|
$content['id_gs']
|
||||||
|
);
|
||||||
|
|
||||||
|
$module_source = db_get_all_rows_sql(
|
||||||
|
'SELECT id_agent_module
|
||||||
|
FROM tgraph_source
|
||||||
|
WHERE id_graph = '.$content['id_gs']
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($module_source) && is_array($module_source)) {
|
||||||
|
$modules = [];
|
||||||
|
foreach ($module_source as $key => $value) {
|
||||||
|
$modules[$key]['module'] = $value['id_agent_module'];
|
||||||
|
$modules[$key]['server'] = $id_meta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
} else if ($type_report == 'automatic_graph') {
|
} else if ($type_report == 'automatic_graph') {
|
||||||
|
$graphs = db_get_all_rows_field_filter(
|
||||||
|
'tgraph',
|
||||||
|
'id_graph',
|
||||||
|
$content['id_gs']
|
||||||
|
);
|
||||||
|
|
||||||
$graphs[0]['stacked'] = '';
|
$graphs[0]['stacked'] = '';
|
||||||
$graphs[0]['summatory_series'] = '';
|
$graphs[0]['summatory_series'] = '';
|
||||||
$graphs[0]['average_series'] = '';
|
$graphs[0]['average_series'] = '';
|
||||||
|
@ -7823,21 +7848,6 @@ function reporting_custom_graph(
|
||||||
$content['name'] = __('Simple graph');
|
$content['name'] = __('Simple graph');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type_report != 'automatic_graph') {
|
|
||||||
$module_source = db_get_all_rows_sql(
|
|
||||||
'SELECT id_agent_module
|
|
||||||
FROM tgraph_source
|
|
||||||
WHERE id_graph = '.$content['id_gs']
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isset($module_source) && is_array($module_source)) {
|
|
||||||
$modules = [];
|
|
||||||
foreach ($module_source as $key => $value) {
|
|
||||||
$modules[$key] = $value['id_agent_module'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$agent_description = agents_get_description($id_agent);
|
$agent_description = agents_get_description($id_agent);
|
||||||
$agent_group = agents_get_agent_group($id_agent);
|
$agent_group = agents_get_agent_group($id_agent);
|
||||||
$agent_address = agents_get_address($id_agent);
|
$agent_address = agents_get_address($id_agent);
|
||||||
|
@ -7853,7 +7863,7 @@ function reporting_custom_graph(
|
||||||
$return['title'] = $content['name'];
|
$return['title'] = $content['name'];
|
||||||
$return['landscape'] = $content['landscape'];
|
$return['landscape'] = $content['landscape'];
|
||||||
$return['pagebreak'] = $content['pagebreak'];
|
$return['pagebreak'] = $content['pagebreak'];
|
||||||
$return['subtitle'] = $graph['name'];
|
$return['subtitle'] = $graphs[0]['name'];
|
||||||
$return['agent_name'] = $agent_alias;
|
$return['agent_name'] = $agent_alias;
|
||||||
$return['module_name'] = $module_name;
|
$return['module_name'] = $module_name;
|
||||||
$return['description'] = $content['description'];
|
$return['description'] = $content['description'];
|
||||||
|
@ -7933,12 +7943,6 @@ function reporting_custom_graph(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type_report == 'custom_graph') {
|
|
||||||
if (is_metaconsole()) {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return reporting_check_structure_content($return);
|
return reporting_check_structure_content($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue