2012-10-25 Vanessa Gil <vanessa.gil@artica.es>

* include/functions_reporting.php
	  include/functions_report.php
	  operation/reporting/reporting_xml.php
	  operation/reporting/reporting_viewer.php
	  godmode/reporting/reporting_builder.item_editor.php
	  godmode/reporting/reporting_builder.php: Changed XML reports
	and added two new types of report.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7095 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-10-25 15:03:18 +00:00
parent b26cbb23e4
commit 6f27f7ec28
7 changed files with 1142 additions and 154 deletions

View File

@ -1,3 +1,13 @@
2012-10-25 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_reporting.php
include/functions_report.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/reporting_builder.php: Changed XML reports
and added two new types of report.
2012-10-25 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb_data.sql: fixed the lost fields in the table "tgrupo"

View File

@ -339,6 +339,12 @@ switch ($action) {
$inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents'];
break;
case 'agent_configuration':
$idAgent = $item['id_agent'];
break;
case 'group_configuration':
$group = $item['id_group'];
break;
}
//Restore db connection
@ -1797,6 +1803,12 @@ function chooseType() {
break;
case 'inventory_changes':
break;
case 'agent_configuration':
$("#row_agent").show();
break;
case 'group_configuration':
$("#row_group").show();
break;
}
}
</script>
</script>

View File

@ -663,7 +663,7 @@ switch ($action) {
$values['id_agent_module'] = '';
if (isset($values['type'])) {
if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent'))
if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent') or ($values['type'] == 'agent_configuration') or ($values['type'] == 'group_configuration'))
$values['id_agent_module'] = '';
else
$values['id_agent_module'] = get_parameter('id_agent_module');
@ -807,6 +807,14 @@ switch ($action) {
$values['external_source'] = json_encode($es);
$good_format = true;
break;
case 'agent_configuration':
$values['id_agent'] = get_parameter('id_agent');
$good_format = true;
break;
case 'group_configuration':
$values['id_group'] = get_parameter('id_group');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
@ -817,7 +825,7 @@ switch ($action) {
$values['id_agent'] = get_parameter('id_agent');
$values['id_gs'] = get_parameter('id_custom_graph');
if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent'))
if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent') or ($values['type'] == 'agent_configuration') or ($values['type'] == 'group_configuration'))
$values['id_agent_module'] = '';
else
$values['id_agent_module'] = get_parameter('id_agent_module');
@ -1329,4 +1337,4 @@ switch ($activeTab) {
reporting_enterprise_select_tab($activeTab);
break;
}
?>
?>

View File

@ -4474,6 +4474,274 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data);
break;
case 'agent_configuration':
reporting_header_content($mini, $content, $report, $table, __('Agent configuration: ').$agent_name);
$agent_name = agents_get_name ($content['id_agent']);
$modules = agents_get_modules ($content['id_agent']);
$data= array ();
$table->colspan[0][1] = 9;
//Agent's data
$data[0] = '<b>'.__('Agent name').'</b>';
$data[1] = '<b>'.__('Group').'</b>';
$data[2] = '<b>'.__('SO').'</b>';
$data[3] = '<b>'.__('IP').'</b>';
$data[4] = '<b>'.__('Description').'</b>';
$data[5] = '<b>'.__('Status').'</b>';
$table->colspan[1][1] = 2;
$table->colspan[1][2] = 2;
$table->colspan[1][4] = 3;
array_push ($table->data, $data);
unset($data);
$sql = "SELECT * FROM tagente WHERE id_agente=".$content['id_agent'];
$agent_data = db_get_row_sql($sql);
$data[0] = $agent_data['nombre'];
$data[1] = ui_print_group_icon ($agent_data['id_grupo'], true, '', '', false);
$data[2] = ui_print_os_icon ($agent_data["id_os"], true, true);
$data[3] = $agent_data['direccion'];
$data[4] = $agent_data['comentarios'];
if ($agent_data['disabled'] == 0)
$data[5] = __('Enabled');
else
$data[5] = __('Disabled');
$table->colspan[2][1] = 2;
$table->colspan[2][2] = 2;
$table->colspan[2][4] = 3;
array_push ($table->data, $data);
unset($data);
//Agent's modules
$data[0] = '<b>'.agents_get_name ($content['id_agent'], 'upper').__(' MODULES').'</b>';
$data[1] = '';
$table->colspan[3][1] = 9;
array_push ($table->data, $data);
unset($data);
if ($modules == null) {
$modules = array();
} else {
$data[0] = '<b>'.__('Name').'</b>';
$data[1] = '<b>'.__('Type').'</b>';
$data[2] = '<b>'.__('Warning/Critical').'</b>';
$data[3] = '<b>'.__('Threshold').'</b>';
$data[4] = '<b>'.__('Group').'</b>';
$data[5] = '<b>'.__('Description').'</b>';
$data[6] = '<b>'.__('Interval').'</b>';
$data[7] = '<b>'.__('Unit').'</b>';
$data[8] = '<b>'.__('Status').'</b>';
$data[9] = '<b>'.__('Tags').'</b>';
$table->style[0] = 'text-align: left';
$table->style[1] = 'text-align: center';
$table->style[2] = 'text-align: center';
$table->style[3] = 'text-align: center';
$table->style[4] = 'text-align: center';
$table->style[5] = 'text-align: left';
$table->style[6] = 'text-align: center';
$table->style[7] = 'text-align: center';
$table->style[8] = 'text-align: left';
$table->style[9] = 'text-align: left';
array_push ($table->data, $data);
}
foreach ($modules as $id_agent_module=>$module) {
$sql = "SELECT * FROM tagente_modulo WHERE id_agente_modulo=$id_agent_module";
$data_module = db_get_row_sql($sql);
$data = array();
if ($data_module['disabled'] == 0)
$disabled = '';
else
$disabled = ' (Disabled)';
$data[0] = $data_module['nombre'].$disabled;
$data[1] = ui_print_moduletype_icon ($data_module['id_tipo_modulo'], true);
$data[2] = $data_module['max_warning'].'/'.$data_module['min_warning'].' - '.$data_module['max_critical'].'/'.$data_module['min_critical'];
$data[3] = $data_module['module_ff_interval'];
$data[4] = groups_get_name ($content['id_group'], true);
$data[5] = $data_module['descripcion'];
if (($data_module['module_interval'] == 0) || ($data_module['module_interval'] == ''))
$data[6] = db_get_value('intervalo', 'tagente', 'id_agente', $content['id_agent']);
else
$data[6] = $data_module['module_interval'];
$data[7] = $data_module['unit'];
$module_status = db_get_row('tagente_estado', 'id_agente_modulo', $id_agent_module);
modules_get_status($id_agent_module, $module_status['estado'], $module_status['datos'], $status, $title);
$data[8] = ui_print_status_image($status, $title, true);
$sql_tag = "SELECT name FROM ttag WHERE id_tag IN (
SELECT id_tag FROM ttag_module
WHERE id_agente_modulo=$id_agent_module)";
$tags = db_get_all_rows_sql($sql_tag);
if ($tags === false)
$tags = '';
else
$tags = implode (",", $tags);
$data[9] = $tags;
array_push ($table->data, $data);
}
break;
case 'group_configuration':
$group_name = groups_get_name($content['id_group']);
reporting_header_content($mini, $content, $report, $table, __('Group configuration: ').$group_name);
$sql = "SELECT * FROM tagente WHERE id_grupo=".$content['id_group'];
$agents_list = db_get_all_rows_sql($sql);
if ($agents_list === false)
$agents_list = array();
$table->colspan[0][1] = 9;
$i = 1;
foreach ($agents_list as $agent) {
$data= array ();
$table->colspan[$i][1] = 2;
$table->colspan[$i][2] = 2;
$table->colspan[$i][4] = 3;
$i++;
//Agent's data
$data[0] = '<b>'.__('Agent name').'</b>';
$data[1] = '<b>'.__('Group').'</b>';
$data[2] = '<b>'.__('SO').'</b>';
$data[3] = '<b>'.__('IP').'</b>';
$data[4] = '<b>'.__('Description').'</b>';
$data[5] = '<b>'.__('Status').'</b>';
array_push ($table->data, $data);
unset($data);
$sql = "SELECT * FROM tagente WHERE id_agente=".$agent['id_agente'];
$agent_data = db_get_row_sql($sql);
$data[0] = $agent_data['nombre'];
$data[1] = ui_print_group_icon ($agent_data['id_grupo'], true, '', '', false);
$data[2] = ui_print_os_icon ($agent_data["id_os"], true, true);
$data[3] = $agent_data['direccion'];
$data[4] = $agent_data['comentarios'];
if ($agent_data['disabled'] == 0)
$data[5] = __('Enabled');
else
$data[5] = __('Disabled');
$table->colspan[$i][1] = 2;
$table->colspan[$i][2] = 2;
$table->colspan[$i][4] = 3;
$i++;
array_push ($table->data, $data);
unset($data);
$modules = agents_get_modules ($agent['id_agente']);
if ($modules == null) {
$modules = array();
} else {
//Agent's modules
$data[0] = '<b>'.agents_get_name ($agent['id_agente'], 'upper').__(' MODULES').'</b>';
$data[1] = '';
$table->colspan[$i][1] = 9;
$i++;
array_push ($table->data, $data);
unset($data);
$data[0] = '<b>'.__('Name').'</b>';
$data[1] = '<b>'.__('Type').'</b>';
$data[2] = '<b>'.__('Warning/Critical').'</b>';
$data[3] = '<b>'.__('Threshold').'</b>';
$data[4] = '<b>'.__('Group').'</b>';
$data[5] = '<b>'.__('Description').'</b>';
$data[6] = '<b>'.__('Interval').'</b>';
$data[7] = '<b>'.__('Unit').'</b>';
$data[8] = '<b>'.__('Status').'</b>';
$data[9] = '<b>'.__('Tags').'</b>';
$table->style[0] = 'text-align: left';
$table->style[1] = 'text-align: center';
$table->style[2] = 'text-align: center';
$table->style[3] = 'text-align: center';
$table->style[4] = 'text-align: center';
$table->style[5] = 'text-align: left';
$table->style[6] = 'text-align: center';
$table->style[7] = 'text-align: center';
$table->style[8] = 'text-align: left';
$table->style[9] = 'text-align: left';
array_push ($table->data, $data);
$i++;
}
foreach ($modules as $id_agent_module=>$module) {
$sql = "SELECT * FROM tagente_modulo WHERE id_agente_modulo=$id_agent_module";
$data_module = db_get_row_sql($sql);
$data = array();
if ($data_module['disabled'] == 0)
$disabled = '';
else
$disabled = ' (Disabled)';
$data[0] = $data_module['nombre'].$disabled;
$data[1] = ui_print_moduletype_icon ($data_module['id_tipo_modulo'], true);
$data[2] = $data_module['max_warning'].'/'.$data_module['min_warning'].' - '.$data_module['max_critical'].'/'.$data_module['min_critical'];
$data[3] = $data_module['module_ff_interval'];
$data[4] = groups_get_name ($content['id_group'], true);
$data[5] = $data_module['descripcion'];
if (($data_module['module_interval'] == 0) || ($data_module['module_interval'] == ''))
$data[6] = db_get_value('intervalo', 'tagente', 'id_agente', $content['id_agent']);
else
$data[6] = $data_module['module_interval'];
$data[7] = $data_module['unit'];
$module_status = db_get_row('tagente_estado', 'id_agente_modulo', $id_agent_module);
modules_get_status($id_agent_module, $module_status['estado'], $module_status['datos'], $status, $title);
$data[8] = ui_print_status_image($status, $title, true);
$sql_tag = "SELECT name FROM ttag WHERE id_tag IN (
SELECT id_tag FROM ttag_module
WHERE id_agente_modulo=$id_agent_module)";
$tags = db_get_all_rows_sql($sql_tag);
if ($tags === false)
$tags = '';
else
$tags = implode (",", $tags);
$data[9] = $tags;
array_push ($table->data, $data);
$i++;
}
}
break;
}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {

View File

@ -592,6 +592,11 @@ function reports_get_report_types ($template = false) {
'name' => __('Inventory changes'));
}
$types['agent_configuration'] = array('optgroup' => __('Configuration'),
'name' => __('Agent configuration'));
$types['group_configuration'] = array('optgroup' => __('Configuration'),
'name' => __('Group configuration'));
return $types;
}
?>
?>

View File

@ -285,4 +285,4 @@ $(document).ready (function () {
}
});
});
</script>
</script>

File diff suppressed because it is too large Load Diff