Fixed the 'simple_graph' item in metaconsole reports. TICKET: #2249

This commit is contained in:
mdtrooper 2015-05-22 17:05:17 +02:00
parent 8107a78791
commit c004c2c1b6
2 changed files with 32 additions and 2 deletions

View File

@ -1987,6 +1987,8 @@ function reporting_exception($report, $content, $type = 'dinamic',
function reporting_group_report($report, $content) { function reporting_group_report($report, $content) {
global $config; global $config;
$metaconsole_on = ($config['metaconsole'] == 1) && defined('METACONSOLE');
$return['type'] = 'group_report'; $return['type'] = 'group_report';
@ -2004,7 +2006,14 @@ function reporting_group_report($report, $content) {
$events = events_get_group_events( $events = events_get_group_events(
$content['id_group'], $content['id_group'],
$content['period'], $content['period'],
$report['datetime']); $report['datetime'],
false,
false,
false,
false,
false,
$metaconsole_on);
if (empty($events)) { if (empty($events)) {
$events = array(); $events = array();
} }
@ -2012,6 +2021,8 @@ function reporting_group_report($report, $content) {
$return["data"]["group_stats"] = reporting_get_group_stats($content['id_group']); $return["data"]["group_stats"] = reporting_get_group_stats($content['id_group']);
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
@ -3953,6 +3964,16 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
global $config; global $config;
if ($config['metaconsole']) {
$id_meta = metaconsole_get_id_server($content["server_name"]);
$server = metaconsole_get_connection_by_id ($id_meta);
metaconsole_connect($server);
}
$return = array(); $return = array();
$return['type'] = 'simple_graph'; $return['type'] = 'simple_graph';
@ -3960,12 +3981,16 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
$content['name'] = __('Simple graph'); $content['name'] = __('Simple graph');
} }
$module_name = io_safe_output( $module_name = io_safe_output(
modules_get_agentmodule_name($content['id_agent_module'])); modules_get_agentmodule_name($content['id_agent_module']));
$agent_name = io_safe_output( $agent_name = io_safe_output(
modules_get_agentmodule_agent_name ($content['id_agent_module'])); modules_get_agentmodule_agent_name ($content['id_agent_module']));
$return['title'] = $content['name']; $return['title'] = $content['name'];
$return['subtitle'] = $agent_name . " - " . $module_name; $return['subtitle'] = $agent_name . " - " . $module_name;
$return["description"] = $content["description"]; $return["description"] = $content["description"];
@ -4060,6 +4085,10 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
break; break;
} }
if ($config['metaconsole']) {
metaconsole_restore_db();
}
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
@ -4698,7 +4727,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
// ----------------------------------------------------------------- // -----------------------------------------------------------------
if ($config["realtimestats"] == 0) { if ($config["realtimestats"] == 0) {
if (!is_array($id_group)){ if (!is_array($id_group)) {
$my_group = $id_group; $my_group = $id_group;
$id_group = array(); $id_group = array();
$id_group[0] = $my_group; $id_group[0] = $my_group;

View File

@ -988,6 +988,7 @@ function reporting_html_exception($table, $item) {
function reporting_html_group_report($table, $item) { function reporting_html_group_report($table, $item) {
global $config; global $config;
$table->colspan['group_report']['cell'] = 3; $table->colspan['group_report']['cell'] = 3;
$table->cellstyle['group_report']['cell'] = 'text-align: center;'; $table->cellstyle['group_report']['cell'] = 'text-align: center;';
$table->data['group_report']['cell'] = "<table width='100%'> $table->data['group_report']['cell'] = "<table width='100%'>