diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index edca0358b2..3a35b84b43 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2012-12-18 Juan Manuel Ramon + + * include/functions_reporting.php + include/functions_reports.php + extensions/resource_registration.php + extensions/resource_exportation.php + operation/reporting/reporting_xml.php + godmode/reporting/reporting_builder.list_items.php + godmode/reporting/reporting_builder.php + godmode/reporting/reporting_builder.item_editor.php: Fixed report + templates. + 2012-12-18 Miguel de Dios * include/functions_config.php: fixed check if it set the id_user diff --git a/pandora_console/extensions/resource_exportation.php b/pandora_console/extensions/resource_exportation.php index 73d388d471..6c3ab94c97 100644 --- a/pandora_console/extensions/resource_exportation.php +++ b/pandora_console/extensions/resource_exportation.php @@ -123,6 +123,7 @@ function output_xml_report($id) { break; case 2: case 'custom_graph': + case 'automatic_custom_graph': $graph = db_get_value('name', 'tgraph', 'id_graph', $item['id_gs']); echo "\n"; break; diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index f99dfb484c..3872449f17 100644 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -173,7 +173,8 @@ function process_upload_xml_report($xml, $group_filter = 0) { case 'simple_baseline_graph': break; case 2: - case 'custom_graph': + case 'custom_graph': + case 'automatic_custom_graph': $group = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($item['graph'])); $values['id_gs'] = $group; break; diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index e96426f132..1a527a1624 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -85,6 +85,7 @@ $resolution = 0; switch ($action) { case 'new': $actionParameter = 'save'; + $type = get_parameter('type', 'SLA'); $description = null; $sql = null; @@ -92,279 +93,309 @@ switch ($action) { $show_in_landscape = 0; $server_name = ''; break; + case 'save': default: - $actionParameter = 'update'; - $item = db_get_row_filter('treport_content', array('id_rc' => $idItem)); - $server_name = $item ['server_name']; - - // Metaconsole db connection - if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) { - $connection = metaconsole_get_connection($server_name); - if (metaconsole_load_external_db($connection) != NOERR) { - //ui_print_error_message ("Error connecting to ".$server_name); - } - } - - $style = json_decode(io_safe_output($item['style']), true); - $show_in_two_columns = $style['show_in_two_columns']; - $show_in_landscape = $style['show_in_landscape']; - $type = $item['type']; - + $actionParameter = 'update'; + + // If we are creating a new report item then clean interface and display creation view + $type = get_parameter('type', 'SLA'); switch ($type) { - case 'avg_value': - $period = $item['period']; - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - break; - case 'simple_baseline_graph': - case 'simple_graph': - case 'projection_graph': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $period = $item['period']; - // 'top_n_value' field will be reused for projection report - if ($type == 'projection_graph'){ - $projection_period = $item['top_n_value']; - $period_pg = $item['period']; - } - break; - case 'prediction_date': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - // 'top_n' field will be reused for prediction_date report - $max_interval = $item['top_n']; - $min_interval = $item['top_n_value']; - $intervals_text = $item['text']; - // Parse intervals text field - $max_interval = substr($intervals_text, 0, strpos($intervals_text, ';')); - $min_interval = substr($intervals_text, strpos($intervals_text, ';') + 1); - // 'top_n_value' field will be reused for prediction_date report - $period_pg = $item['period']; - break; - case 'custom_graph': - $description = $item['description']; - $period = $item['period']; - $idCustomGraph = $item['id_gs']; - break; case 'SLA': - $description = $item['description']; - $period = $item['period']; - $only_display_wrong = $item['only_display_wrong']; - $monday = $item['monday']; - $tuesday = $item['tuesday']; - $wednesday = $item['wednesday']; - $thursday = $item['thursday']; - $friday = $item['friday']; - $saturday = $item['saturday']; - $sunday = $item['sunday']; - $time_from = $item['time_from']; - $time_to = $item['time_to']; - $show_graph = $item['show_graph']; - // 'top_n' filed will be reused for SLA sort option - $sla_sorted_by = $item['top_n']; - break; - case 'monitor_report': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $idAgentModule = $item['id_agent_module']; - $period = $item['period']; - break; - case 'avg_value': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $idAgentModule = $item['id_agent_module']; - $period = $item['period']; - break; - case 'max_value': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $idAgentModule = $item['id_agent_module']; - $period = $item['period']; - break; - case 'min_value': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $idAgentModule = $item['id_agent_module']; - $period = $item['period']; - break; - case 'sumatory': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $idAgentModule = $item['id_agent_module']; - $period = $item['period']; - break; - case 'text': - $description = $item['description']; - $text = $item['text']; - break; - case 'sql': - $description = $item['description']; - $sql = $item['external_source']; - $idCustom = $item['treport_custom_sql_id']; - $header = $item['header_definition']; - $period = 0; - break; - case 'sql_graph_pie': - $description = $item['description']; - $sql = $item['external_source']; - $idCustom = $item['treport_custom_sql_id']; - $period = 0; - break; - case 'sql_graph_vbar': - $description = $item['description']; - $sql = $item['external_source']; - $idCustom = $item['treport_custom_sql_id']; - $period = 0; - break; - case 'sql_graph_hbar': - $description = $item['description']; - $sql = $item['external_source']; - $idCustom = $item['treport_custom_sql_id']; - $period = 0; - break; - case 'url': - $description = $item['description']; - $url = $item['external_source']; - break; - case 'database_serialized': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $header = $item['header_definition']; - $field = $item['column_separator']; - $line = $item['line_separator']; - $period = $item['period']; - break; - case 'TTRT': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $period = $item['period']; - break; - case 'TTO': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $period = $item['period']; - break; - case 'MTBF': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $period = $item['period']; - break; - case 'MTTR': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $period = $item['period']; - break; - case 'alert_report_module': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $period = $item['period']; - break; - case 'alert_report_agent': - $description = $item['description']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente' => $item['id_agent'])); - $period = $item['period']; - break; - case 'event_report_agent': - $description = $item['description']; - $idAgent = $item['id_agent']; - $period = $item['period']; - break; - case 'event_report_group': - $description = $item['description']; - $period = $item['period']; - $group = $item['id_group']; - break; - case 'event_report_module': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - $period = $item['period']; - break; - case 'general': - $description = $item['description']; - $group_by_agent = $item['group_by_agent']; - $period = $item['period']; - $order_uptodown = $item['order_uptodown']; - $show_resume = $item['show_resume']; - $show_graph = $item['show_graph']; - break; - case 'group_report': - $group = $item['id_group']; - break; case 'top_n': - $description = $item['description']; - $period = $item['period']; - $top_n = $item ['top_n']; - $top_n_value = $item ['top_n_value']; - $show_resume = $item['show_resume']; - $show_graph = $item['show_graph']; - $order_uptodown = $item['order_uptodown']; - break; case 'exception': - $description = $item['description']; - $period = $item['period']; - $exception_condition = $item['exception_condition']; - $exception_condition_value = $item['exception_condition_value']; - $show_resume = $item['show_resume']; - $show_graph = $item['show_graph']; - $order_uptodown = $item['order_uptodown']; + case 'general': + $get_data_editor = true; break; - case 'agent_module': - $description = $item['description']; - $group = $item['id_group']; - $modulegroup = $item ['id_module_group']; + default: + $actionParameter = 'save'; + $action = 'new'; + + $type = 'SLA'; + $description = null; + $sql = null; + $show_in_two_columns = 0; + $show_in_landscape = 0; + $server_name = ''; + $get_data_editor = false; break; - case 'inventory': - $description = $item['description']; - $es = json_decode($item['external_source'], true); - $date = $es['date']; - $inventory_modules = $es['inventory_modules']; - $id_agents = $es['id_agents']; - break; - case 'inventory_changes': - $period = $item['period']; - $description = $item['description']; - $es = json_decode($item['external_source'], true); - $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; - case 'netflow_area': - case 'netflow_pie': - case 'netflow_data': - case 'netflow_statistics': - case 'netflow_summary': - $netflow_filter = $item['text']; // Filter - $period = $item['period']; - $description = $item['description']; - $resolution = $item ['top_n']; // Interval resolution - $max_values = $item ['top_n_value']; // Max values - break; - } + } + + // Get data to fill editor if type is not SLA, top_n, exception, general + if ($get_data_editor) { - //Restore db connection - if (($config ['metaconsole'] == 1) && ($server_name != '') - && defined('METACONSOLE')) { - metaconsole_restore_db(); + $item = db_get_row_filter('treport_content', array('id_rc' => $idItem)); + $server_name = $item ['server_name']; + + // Metaconsole db connection + if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) { + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) != NOERR) { + //ui_print_error_message ("Error connecting to ".$server_name); + } + } + + $style = json_decode(io_safe_output($item['style']), true); + $show_in_two_columns = $style['show_in_two_columns']; + $show_in_landscape = $style['show_in_landscape']; + $type = $item['type']; + + switch ($type) { + case 'avg_value': + $period = $item['period']; + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + break; + case 'simple_baseline_graph': + case 'simple_graph': + case 'projection_graph': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + // 'top_n_value' field will be reused for projection report + if ($type == 'projection_graph'){ + $projection_period = $item['top_n_value']; + $period_pg = $item['period']; + } + break; + case 'prediction_date': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + // 'top_n' field will be reused for prediction_date report + $max_interval = $item['top_n']; + $min_interval = $item['top_n_value']; + $intervals_text = $item['text']; + // Parse intervals text field + $max_interval = substr($intervals_text, 0, strpos($intervals_text, ';')); + $min_interval = substr($intervals_text, strpos($intervals_text, ';') + 1); + // 'top_n_value' field will be reused for prediction_date report + $period_pg = $item['period']; + break; + case 'custom_graph': + case 'automatic_custom_graph': + $description = $item['description']; + $period = $item['period']; + $idCustomGraph = $item['id_gs']; + break; + case 'SLA': + $description = $item['description']; + $period = $item['period']; + $only_display_wrong = $item['only_display_wrong']; + $monday = $item['monday']; + $tuesday = $item['tuesday']; + $wednesday = $item['wednesday']; + $thursday = $item['thursday']; + $friday = $item['friday']; + $saturday = $item['saturday']; + $sunday = $item['sunday']; + $time_from = $item['time_from']; + $time_to = $item['time_to']; + $show_graph = $item['show_graph']; + // 'top_n' filed will be reused for SLA sort option + $sla_sorted_by = $item['top_n']; + break; + case 'monitor_report': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $idAgentModule = $item['id_agent_module']; + $period = $item['period']; + break; + case 'avg_value': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $idAgentModule = $item['id_agent_module']; + $period = $item['period']; + break; + case 'max_value': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $idAgentModule = $item['id_agent_module']; + $period = $item['period']; + break; + case 'min_value': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $idAgentModule = $item['id_agent_module']; + $period = $item['period']; + break; + case 'sumatory': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $idAgentModule = $item['id_agent_module']; + $period = $item['period']; + break; + case 'text': + $description = $item['description']; + $text = $item['text']; + break; + case 'sql': + $description = $item['description']; + $sql = $item['external_source']; + $idCustom = $item['treport_custom_sql_id']; + $header = $item['header_definition']; + $period = 0; + break; + case 'sql_graph_pie': + $description = $item['description']; + $sql = $item['external_source']; + $idCustom = $item['treport_custom_sql_id']; + $period = 0; + break; + case 'sql_graph_vbar': + $description = $item['description']; + $sql = $item['external_source']; + $idCustom = $item['treport_custom_sql_id']; + $period = 0; + break; + case 'sql_graph_hbar': + $description = $item['description']; + $sql = $item['external_source']; + $idCustom = $item['treport_custom_sql_id']; + $period = 0; + break; + case 'url': + $description = $item['description']; + $url = $item['external_source']; + break; + case 'database_serialized': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $header = $item['header_definition']; + $field = $item['column_separator']; + $line = $item['line_separator']; + $period = $item['period']; + break; + case 'TTRT': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'TTO': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'MTBF': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'MTTR': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'alert_report_module': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'alert_report_agent': + $description = $item['description']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente' => $item['id_agent'])); + $period = $item['period']; + break; + case 'event_report_agent': + $description = $item['description']; + $idAgent = $item['id_agent']; + $period = $item['period']; + break; + case 'event_report_group': + $description = $item['description']; + $period = $item['period']; + $group = $item['id_group']; + break; + case 'event_report_module': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'general': + $description = $item['description']; + $group_by_agent = $item['group_by_agent']; + $period = $item['period']; + $order_uptodown = $item['order_uptodown']; + $show_resume = $item['show_resume']; + $show_graph = $item['show_graph']; + break; + case 'group_report': + $group = $item['id_group']; + break; + case 'top_n': + $description = $item['description']; + $period = $item['period']; + $top_n = $item ['top_n']; + $top_n_value = $item ['top_n_value']; + $show_resume = $item['show_resume']; + $show_graph = $item['show_graph']; + $order_uptodown = $item['order_uptodown']; + break; + case 'exception': + $description = $item['description']; + $period = $item['period']; + $exception_condition = $item['exception_condition']; + $exception_condition_value = $item['exception_condition_value']; + $show_resume = $item['show_resume']; + $show_graph = $item['show_graph']; + $order_uptodown = $item['order_uptodown']; + break; + case 'agent_module': + $description = $item['description']; + $group = $item['id_group']; + $modulegroup = $item ['id_module_group']; + break; + case 'inventory': + $description = $item['description']; + $es = json_decode($item['external_source'], true); + $date = $es['date']; + $inventory_modules = $es['inventory_modules']; + $id_agents = $es['id_agents']; + break; + case 'inventory_changes': + $period = $item['period']; + $description = $item['description']; + $es = json_decode($item['external_source'], true); + $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; + case 'netflow_area': + case 'netflow_pie': + case 'netflow_data': + case 'netflow_statistics': + case 'netflow_summary': + $netflow_filter = $item['text']; // Filter + $period = $item['period']; + $description = $item['description']; + $resolution = $item ['top_n']; // Interval resolution + $max_values = $item ['top_n_value']; // Max values + break; + } + + //Restore db connection + if (($config ['metaconsole'] == 1) && ($server_name != '') + && defined('METACONSOLE')) { + metaconsole_restore_db(); + } } break; @@ -382,7 +413,7 @@ html_print_input_hidden('id_item', $idItem); ") - .attr ("value", 0) - .html ($("#module_general_text").html())); - - $("#id_operation_module_general").empty(); - $("#id_operation_module_general").attr('disabled', 'true'); - $("#id_operation_module_general").append( - $("") - .attr ("value", 0) - //.html ($("#id_operation_general_text").html())); - .html ($("#operation_general_text").html())); + } } }); @@ -1601,7 +1622,8 @@ function chooseType() { $("#row_interval").show(); $("#row_show_in_two_columns").show(); break; - case 'custom_graph': + case 'custom_graph': + case 'automatic_custom_graph': $("#row_description").show(); $("#row_period").show(); $("#row_custom_graph").show(); diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index ae4e8c6304..895444b159 100644 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -122,7 +122,10 @@ else { $types = array(); foreach ($rows as $row) { - $types[$row['type']] = get_report_name($row['type']); + if ($row['type'] == 'automatic_custom_graph') + $types['custom_graph'] = get_report_name($row['type']); + else + $types[$row['type']] = get_report_name($row['type']); } } @@ -163,7 +166,10 @@ echo ''; $where = '1=1'; if ($typeFilter != '0') { - $where .= ' AND type = "' . $typeFilter . '"'; + if ($typeFilter == 'custom_graph') + $where .= ' AND (type = "' . $typeFilter . '" or type = "automatic_custom_graph") '; + else + $where .= ' AND type = "' . $typeFilter . '"'; } if ($agentFilter != 0) { $where .= ' AND id_agent = ' . $agentFilter; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index fb074dc1f1..1033d497bc 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -463,11 +463,7 @@ switch ($action) { } html_print_table ($table); } - else { - ui_print_error_message(__('There are no defined reportings')); - } - - + if (check_acl ($config['id_user'], 0, "IW")) { echo '
'; echo '
'; @@ -706,14 +702,14 @@ switch ($action) { if ($values['server_name'] == '') $values['server_name'] = get_parameter ('combo_server'); - if (($values['type'] == 'custom_graph') && ($values['id_gs'] == 0 || $values['id_gs'] == '')) { + if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) { $resultOperationDB = false; break; } // If metaconsole is activated - if ($config['metaconsole'] == 1) { - if ($values['type'] == 'custom_graph') { + if ($config['metaconsole'] == 1 && defined('METACONSOLE')) { + if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) { $id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|')); if ($id_gs !== false) { $server_name = strstr($values ['id_gs'], '|'); @@ -899,13 +895,13 @@ switch ($action) { if ($values['server_name'] == '') $values['server_name'] = get_parameter ('combo_server'); - if (($values['type'] == 'custom_graph') && ($values['id_gs'] == 0 || $values['id_gs'] == '')) { + if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) { $resultOperationDB = false; break; } if ($config['metaconsole'] == 1 && defined('METACONSOLE')) { - if ($values['type'] == 'custom_graph') { + if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) { $id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|')); if ($id_gs !== false && $id_gs !== '') { $server_name = strstr($values ['id_gs'], '|'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 5eeec07210..3b7072768d 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2393,7 +2393,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 2: - case 'custom_graph': + case 'custom_graph': + case 'automatic_custom_graph': $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); reporting_header_content($mini, $content, $report, $table, __('Custom graph'), diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 5dfeb541ec..dc9db838a1 100644 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -419,6 +419,9 @@ function get_report_name ($type, $template = false) { $types = reports_get_report_types ($template); if (! isset ($types[$type])) return __('Unknown'); + + if ($type == 'automatic_custom_graph') + return __('Custom graph'); return $types[$type]['name']; } @@ -451,7 +454,8 @@ function get_report_type_data_source ($type) { return 'module'; break; case 2: - case 'custom_graph': + case 'custom_graph': + case 'automatic_custom_graph': return 'custom-graph'; break; case 3: @@ -477,10 +481,11 @@ function get_report_type_data_source ($type) { * Get report types in an array. * * @param boolean $template Set true for to get types for templates. By default false. + * @param boolean $not_editor When this function is not used in item editors. * * @return array An array with all the possible reports in Pandora where the array index is the report id. */ -function reports_get_report_types ($template = false) { +function reports_get_report_types ($template = false, $not_editor = false) { global $config; $types = array (); @@ -489,6 +494,9 @@ function reports_get_report_types ($template = false) { 'name' => __('Simple graph')); $types['simple_baseline_graph'] = array('optgroup' => __('Graphs'), 'name' => __('Simple baseline graph')); + if ($not_editor == false) + $types['automatic_custom_graph'] = array('optgroup' => __('Graphs'), + 'name' => __('Custom graph')); $types['custom_graph'] = array('optgroup' => __('Graphs'), 'name' => __('Custom graph')); # Only pandora managers have access to the whole database @@ -597,16 +605,19 @@ function reports_get_report_types ($template = false) { $types['group_configuration'] = array('optgroup' => __('Configuration'), 'name' => __('Group configuration')); - $types['netflow_area'] = array('optgroup' => __('Netflow'), - 'name' => __('Netflow area chart')); - $types['netflow_pie'] = array('optgroup' => __('Netflow'), - 'name' => __('Netflow pie chart')); - $types['netflow_data'] = array('optgroup' => __('Netflow'), - 'name' => __('Netflow data table')); - $types['netflow_statistics'] = array('optgroup' => __('Netflow'), - 'name' => __('Netflow statistics table')); - $types['netflow_summary'] = array('optgroup' => __('Netflow'), - 'name' => __('Netflow summary table')); + + if (!$template) { + $types['netflow_area'] = array('optgroup' => __('Netflow'), + 'name' => __('Netflow area chart')); + $types['netflow_pie'] = array('optgroup' => __('Netflow'), + 'name' => __('Netflow pie chart')); + $types['netflow_data'] = array('optgroup' => __('Netflow'), + 'name' => __('Netflow data table')); + $types['netflow_statistics'] = array('optgroup' => __('Netflow'), + 'name' => __('Netflow statistics table')); + $types['netflow_summary'] = array('optgroup' => __('Netflow'), + 'name' => __('Netflow summary table')); + } return $types; } diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 86377d3ad9..5b975f085c 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -379,7 +379,8 @@ foreach ($contents as $content) { /// break; case 2: - case 'custom_graph': + case 'custom_graph': + case 'automatic_custom_graph': $data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module'])); $data["agent"] = io_safe_output_xml (modules_get_agentmodule_agent_name ($content['id_agent_module']));