diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fc6d3d0b09..578b1c678c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2010-06-01 Miguel de Dios + + * include/functions_reporting.php, include/functions.php, + godmode/reporting/reporting_builder.php, + godmode/reporting/reporting_builder.item_editor.php: added the code for + show a new item event_report_group. + 2010-06-02 Ramon Novoa * operation/messages/message.php: Small fixes. Fixed bug #3008779. diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 354165951a..180a122ae8 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -38,6 +38,7 @@ switch ($action) { $line = null; $description = null; $sql = null; + $group = null; break; default: $actionParameter = 'update'; @@ -175,6 +176,11 @@ switch ($action) { $idAgent = $item['id_agent']; $period = $item['period']; break; + case 'event_report_group': + $description = $item['description']; + $period = $item['period']; + $group = $item['id_agent']; + break; case 'event_report_module': $description = $item['description']; $idAgentModule = $item['id_agent_module']; @@ -241,6 +247,10 @@ print_input_hidden('id_item', $idItem); + + + + @@ -539,8 +549,14 @@ function chooseType() { $("#row_line_separator").css('display', 'none'); $("#sla_list").css('display', 'none'); $("#row_custom_example").css('display', 'none'); + $("#row_group").css('display', 'none'); switch (type) { + case 'event_report_group': + $("#row_description").css('display', ''); + $("#row_period").css('display', ''); + $("#row_group").css('display', ''); + break; case 'simple_graph': $("#row_description").css('display', ''); $("#row_agent").css('display', ''); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index b171f4bc1a..92d4d5ef36 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -180,6 +180,9 @@ switch ($action) { else if ($values['type'] == 'url') { $values['external_source'] = get_parameter('url'); } + else if ($values['type'] == 'event_report_group') { + $values['id_agent'] = get_parameter('group'); + } $values['header_definition'] = get_parameter('header'); $values['column_separator'] = get_parameter('field'); @@ -207,6 +210,9 @@ switch ($action) { else if ($values['type'] == 'url') { $values['external_source'] = get_parameter('url'); } + else if ($values['type'] == 'event_report_group') { + $values['id_agent'] = get_parameter('group'); + } $values['header_definition'] = get_parameter('header'); $values['column_separator'] = get_parameter('field'); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index d6bb8b34ab..32e53abf2f 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -628,6 +628,7 @@ function get_report_types () { $types['alert_report_agent'] = __('Alert report agent'); $types['event_report_agent'] = __('Event report agent'); $types['event_report_module'] = __('Event report module'); + $types['event_report_group'] = __('Event report group'); // $types['agent_detailed_event'] = __('Agent detailed event'); // $types['list_events_module'] = __('List events of module'); // $types['list_events_agent'] = __('List events of agent'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c5b757088f..1bbc71848c 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1251,6 +1251,56 @@ function get_agents_detailed_event_reporting ($id_agents, $period = 0, $date = 0 return print_table ($table, $return); } +/** + * + * @param unknown_type $id_group + * @param unknown_type $period + * @param unknown_type $date + * @param unknown_type $return + * @param unknown_type $html + */ +function get_group_detailed_event_reporting ($id_group, $period = 0, $date = 0, $return = false, $html = true) { + if (!is_numeric ($date)) { + $date = strtotime ($date); + } + if (empty ($date)) { + $date = get_system_time (); + } + if (empty ($period)) { + global $config; + $period = $config["sla_period"]; + } + + $table->width = '99%'; + $table->data = array (); + $table->head = array (); + $table->head[0] = __('Event name'); + $table->head[1] = __('Event type'); + $table->head[2] = __('Criticity'); + $table->head[3] = __('Timestamp'); + + $events = get_group_events($id_group, $period, $date); + + if ($events) + foreach ($events as $event) { + $data = array (); + $data[0] = $event['evento']; + $data[1] = $event['event_type']; + $data[2] = get_priority_name ($event['criticity']); + $data[3] = $event['timestamp']; + array_push ($table->data, $data); + } + + if ($events) { + if ($html) { + return print_table ($table, $return); + } + else { + return $table; + } + } +} + /** * Get a detailed report of summarized events per agent * @@ -1686,54 +1736,6 @@ function render_report_html_item ($content, $table, $report, $mini = false) { } break; -// case 4: -// case 'event_report': -// $id_agent = get_agent_id ($agent_name); -// $data = array (); -// $data[0] = $sizh.__('Event report').$sizhfin; -// $data[1] = $sizh.human_time_description ($content['period']).$sizhfin; -// array_push ($table->data, $data); -// -// // Put description at the end of the module (if exists) -// if ($content["description"] != ""){ -// $table->colspan[1][0] = 3; -// $data_desc = array(); -// $data_desc[0] = $content["description"]; -// array_push ($table->data, $data_desc); -// } -// -// $table->colspan[2][0] = 3; -// $data = array (); -// $table_report = event_reporting ($report['id_group'], $content['period'], $report["datetime"], true); -// -// $table_report->class = 'databox'; -// $table_report->width = '100%'; -// $data[0] = print_table ($table_report, true); -// array_push ($table->data, $data); -// -// break; -// case 5: -// case 'alert_report': -// $data = array (); -// $data[0] = $sizh.__('Alert report').$sizhfin; -// $data[1] = $sizh.$report['group_name'].$sizhfin; -// $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; -// array_push ($table->data, $data); -// -// // Put description at the end of the module (if exists) -// if ($content["description"] != ""){ -// $table->colspan[1][0] = 3; -// $data_desc = array(); -// $data_desc[0] = $content["description"]; -// array_push ($table->data, $data_desc); -// } -// -// $data = array (); -// $table->colspan[2][0] = 3; -// $data[0] = alert_reporting ($report['id_group'], $content['period'], $report["datetime"], true); -// array_push ($table->data, $data); -// -// break; case 6: case 'monitor_report': //RUNNING @@ -1857,70 +1859,6 @@ function render_report_html_item ($content, $table, $report, $mini = false) { array_push ($table->data, $data); break; -// case 11: -// case 'general_group_report': -// $data = array (); -// $data[0] = $sizh.__('Group').$sizhfin; -// $data[1] = $sizh.$report['group_name'].$sizhfin; -// array_push ($table->data, $data); -// -// // Put description at the end of the module (if exists) -// if ($content["description"] != ""){ -// $table->colspan[0][0] = 2; -// $data_desc = array(); -// $data_desc[0] = $content["description"]; -// array_push ($table->data, $data_desc); -// } -// -// $data = array (); -// $table->colspan[1][0] = 2; -// $data[0] = print_group_reporting ($report['id_group'], true); -// array_push ($table->data, $data); -// -// break; -// case 12: -// case 'monitor_health': -// $data = array (); -// $data[0] = $sizh.__('Monitor health').$sizhfin; -// $data[1] = $sizh.$report["group_name"].$sizhfin; -// $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; -// array_push ($table->data, $data); -// -// // Put description at the end of the module (if exists) -// if ($content["description"] != ""){ -// $table->colspan[0][0] = 4; -// $data_desc = array(); -// $data_desc[0] = $content["description"]; -// array_push ($table->data, $data_desc); -// } -// -// $data = array (); -// $table->colspan[1][0] = 4; -// $data[0] = monitor_health_reporting ($report['id_group'], $content['period'], $report["datetime"], true); -// array_push ($table->data, $data); -// -// break; -// case 13: -// case 'agents_detailed': -// $data = array (); -// $data[0] = $sizh.__('Agents detailed view').$sizhfin; -// $data[1] = $sizh.$report["group_name"].$sizhfin; -// array_push ($table->data, $data); -// -// // Put description at the end of the module (if exists) -// if ($content["description"] != ""){ -// $table->colspan[0][0] = 2; -// $data_desc = array(); -// $data_desc[0] = $content["description"]; -// array_push ($table->data, $data_desc); -// } -// -// $table->colspan[0][0] = 2; -// $data = array (); -// $table->colspan[1][0] = 3; -// $data[0] = get_group_agents_detailed_reporting ($report['id_group'], $content['period'], $report["datetime"], true); -// array_push ($table->data, $data); -// break; case 'agent_detailed_event': case 'event_report_agent': //RUNNING @@ -2008,6 +1946,24 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $cellContent = print_table($table2, true); array_push($table->data, array($cellContent)); break; + case 'event_report_group': + $data = array (); + $data[0] = $sizh . __('Group detailed event') . $sizhfin; + $data[1] = $sizh . get_group_name($content['id_agent']) . $sizhfin; + array_push ($table->data, $data); + + if ($content["description"] != ""){ + $table->colspan[1][0] = 3; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + + $data = array (); + $table->colspan[2][0] = 3; + $data[0] = get_group_detailed_event_reporting($content['id_agent'], $content['period'], $report["datetime"], true); + array_push ($table->data, $data); + break; case 'event_report_module': $data = array (); $data[0] = $sizh. __('Module detailed event') . $sizhfin;