fixed autocombined report metaconsole
Former-commit-id: f277a1302c0b84ca0417693673ca3da0a4956f6c
This commit is contained in:
parent
ca414d30b6
commit
358532c4a8
|
@ -1082,13 +1082,15 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
|
||||
}
|
||||
$all_agent_log = db_get_all_rows_sql($sql_log_report);
|
||||
|
||||
foreach ($all_agent_log as $key => $value) {
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
|
||||
if(isset($all_agent_log) && is_array($all_agent_log)){
|
||||
foreach ($all_agent_log as $key => $value) {
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((empty($agents2)) || $agents2 == -1) $agents = array();
|
||||
|
||||
|
||||
$agents_select = array();
|
||||
if (is_array($id_agents) || is_object($id_agents)){
|
||||
foreach ($id_agents as $id) {
|
||||
|
|
|
@ -1049,6 +1049,10 @@ function graphic_combined_module (
|
|||
$params_combined['id_graph'] = 0;
|
||||
}
|
||||
|
||||
if(!isset($params_combined['type_report'])){
|
||||
$params_combined['type_report'] = '';
|
||||
}
|
||||
|
||||
if(!isset($params['percentil'])){
|
||||
$params_combined['percentil'] = null;
|
||||
}
|
||||
|
@ -1207,8 +1211,8 @@ function graphic_combined_module (
|
|||
);
|
||||
|
||||
$series = db_get_all_rows_sql(
|
||||
'SELECT summatory_series,average_series,modules_series
|
||||
FROM tgraph
|
||||
'SELECT summatory_series,average_series, modules_series
|
||||
FROM tgraph
|
||||
WHERE id_graph = '.
|
||||
$params_combined['id_graph']
|
||||
);
|
||||
|
@ -1301,7 +1305,6 @@ function graphic_combined_module (
|
|||
);
|
||||
}
|
||||
|
||||
//XXX arreglar estas
|
||||
$long_index = '';
|
||||
switch ($params_combined['stacked']) {
|
||||
default:
|
||||
|
@ -1324,7 +1327,16 @@ function graphic_combined_module (
|
|||
|
||||
$i=0;
|
||||
$array_data = array();
|
||||
|
||||
foreach ($module_list as $key => $agent_module_id) {
|
||||
if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){
|
||||
$server = metaconsole_get_connection_by_id ($agent_module_id['server']);
|
||||
if (metaconsole_connect ($server) != NOERR){
|
||||
continue;
|
||||
}
|
||||
$agent_module_id = $agent_module_id['module'];
|
||||
}
|
||||
|
||||
$module_data = db_get_row_sql (
|
||||
'SELECT * FROM tagente_modulo
|
||||
WHERE id_agente_modulo = ' .
|
||||
|
@ -1340,12 +1352,12 @@ function graphic_combined_module (
|
|||
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
|
||||
$data_module_graph['module_type'] = modules_get_moduletype_name($data_module_graph['id_module_type']);
|
||||
$data_module_graph['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']);
|
||||
$data_module_graph['w_min'] = $module_data['min_warning'];
|
||||
$data_module_graph['w_max'] = $module_data['max_warning'];
|
||||
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
|
||||
$data_module_graph['c_min'] = $module_data['min_critical'];
|
||||
$data_module_graph['c_max'] = $module_data['max_critical'];
|
||||
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
||||
$data_module_graph['w_min'] = $module_data['min_warning'];
|
||||
$data_module_graph['w_max'] = $module_data['max_warning'];
|
||||
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
|
||||
$data_module_graph['c_min'] = $module_data['min_critical'];
|
||||
$data_module_graph['c_max'] = $module_data['max_critical'];
|
||||
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
||||
$data_module_graph['module_id'] = $agent_module_id;
|
||||
|
||||
//stract data
|
||||
|
@ -1357,7 +1369,7 @@ function graphic_combined_module (
|
|||
$i
|
||||
);
|
||||
|
||||
$series_suffix = $i;
|
||||
$series_suffix = $i;
|
||||
|
||||
//convert to array graph and weight
|
||||
foreach ($array_data_module as $key => $value) {
|
||||
|
@ -1386,6 +1398,10 @@ function graphic_combined_module (
|
|||
|
||||
//$array_events_alerts[$series_suffix] = $events;
|
||||
$i++;
|
||||
|
||||
if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
if($params_combined['projection']){
|
||||
|
@ -1544,7 +1560,6 @@ function graphic_combined_module (
|
|||
$water_mark,
|
||||
$array_events_alerts
|
||||
);
|
||||
|
||||
break;
|
||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||
case CUSTOM_GRAPH_BULLET_CHART:
|
||||
|
|
|
@ -6343,13 +6343,18 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
|||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
$id_meta = metaconsole_get_id_server($content["server_name"]);
|
||||
$server = metaconsole_get_connection_by_id ($id_meta);
|
||||
metaconsole_connect($server);
|
||||
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 = array();
|
||||
$return['type'] = 'custom_graph';
|
||||
|
||||
|
@ -6373,30 +6378,25 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
|||
$graphs[0]["average_series"] = '';
|
||||
$graphs[0]["modules_series"] = '';
|
||||
$graphs[0]["fullscale"] = $content['style']['fullscale'];
|
||||
$modules = $content['id_agent_module'];
|
||||
|
||||
if(is_array($content['id_agent_module'])){
|
||||
foreach ($content['id_agent_module'] as $key => $value) {
|
||||
if($content['each_agent']){
|
||||
$modules[] = $value;
|
||||
}
|
||||
else{
|
||||
$modules[] = $value['module'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ($content['id_agent_module']) {
|
||||
$modules[] = $content['id_agent_module'];
|
||||
} else {
|
||||
// restore to metaconsole database
|
||||
metaconsole_restore_db();
|
||||
$module_source = db_get_all_rows_sql("SELECT id_agent_module FROM tgraph_source WHERE id_graph = " . $content['id_gs']);
|
||||
if(!$modules){
|
||||
$module_source = db_get_all_rows_sql(
|
||||
"SELECT id_agent_module, id_server
|
||||
FROM tgraph_source
|
||||
WHERE id_graph = " .
|
||||
$content['id_gs']
|
||||
);
|
||||
|
||||
if(isset($module_source) && is_array($module_source)){
|
||||
$modules = array();
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key] = $value['id_agent_module'];
|
||||
$modules[$key]['module'] = $value['id_agent_module'];
|
||||
$modules[$key]['server'] = $value['id_server'];
|
||||
}
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
}
|
||||
|
||||
$id_graph = 0;
|
||||
}
|
||||
else {
|
||||
|
@ -6436,7 +6436,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
|||
'summatory' => $graphs[0]["summatory_series"],
|
||||
'average' => $graphs[0]["average_series"],
|
||||
'modules_series' => $graphs[0]["modules_series"],
|
||||
'id_graph' => $id_graph
|
||||
'id_graph' => $id_graph,
|
||||
'type_report' => $type_report
|
||||
);
|
||||
|
||||
$return['chart'] = graphic_combined_module(
|
||||
|
@ -6445,13 +6446,13 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
|||
$params_combined
|
||||
);
|
||||
|
||||
break;
|
||||
case 'data':
|
||||
break;
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
metaconsole_restore_db();
|
||||
if ($type_report == "custom_graph") {
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
|
|
Loading…
Reference in New Issue