diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 1339d965a1..1bda6fc7c8 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -124,6 +124,7 @@ switch ($action) { $sql = null; $show_in_two_columns = 0; $show_in_landscape = 0; + $hide_notinit_agents = 0; $server_name = ''; $server_id = 0; break; @@ -156,6 +157,7 @@ switch ($action) { $sql = null; $show_in_two_columns = 0; $show_in_landscape = 0; + $hide_notinit_agents = 0; $server_name = ''; $server_id = 0; $get_data_editor = false; @@ -177,8 +179,10 @@ switch ($action) { } $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']; + $hide_notinit_agents = $style['hide_notinit_agents']; $type = $item['type']; $name = $item['name']; @@ -1302,6 +1306,16 @@ $class = 'databox filters'; + + + + + + + @@ -1395,6 +1409,7 @@ function print_SLA_list($width, $action, $idItem = null) { 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])); $nameAgent = agents_get_name ($idAgent); + $nameModule = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])); @@ -2139,7 +2154,7 @@ function addGeneralRow() { params.push("id_module=" + idModule); params.push("id_server=" + serverId); params.push("operation=" + operation); - + params.push("id_agent=" + idAgent); params.push("page=include/ajax/reporting.ajax"); jQuery.ajax ({ data: params.join ("&"), @@ -2212,6 +2227,7 @@ function chooseType() { $("#row_exception_condition").hide(); $("#row_show_in_two_columns").hide(); $("#row_show_in_landscape").hide(); + $('#row_hide_notinit_agents').hide(); $("#row_module_group").hide(); $("#row_servers").hide(); $("#row_sort").hide(); @@ -2313,6 +2329,7 @@ function chooseType() { $("#row_show_graph").show(); $("#row_show_in_two_columns").show(); $("#row_sort").show(); + $('#row_hide_notinit_agents').show(); break; case 'SLA_monthly': @@ -2564,6 +2581,7 @@ function chooseType() { $("#row_show_in_two_columns").show(); $("#row_show_resume").show(); $("#row_working_time").show(); + $('#row_hide_notinit_agents').show(); break; case 'group_report': diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 9a74d60757..f35c50bbb0 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1101,6 +1101,7 @@ switch ($action) { $style = array(); $style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0); $style['show_in_landscape'] = get_parameter('show_in_landscape', 0); + $style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0); switch ($values['type']) { case 'event_report_agent': @@ -1362,6 +1363,7 @@ switch ($action) { $style = array(); $style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0); $style['show_in_landscape'] = get_parameter('show_in_landscape', 0); + $style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0); switch ($values['type']) { case 'event_report_agent': diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 034c6b855e..d189ff2b8f 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -476,6 +476,7 @@ function reporting_SLA($report, $content, $type = 'dinamic', $height = $force_height_chart; } + $return["id_rc"] = $content['id_rc']; $edge_interval = 10; @@ -3733,7 +3734,6 @@ function reporting_sql($report, $content) { } function reporting_availability($report, $content) { - global $config; $return = array(); @@ -3751,6 +3751,8 @@ function reporting_availability($report, $content) { $report, $content); + $return['id_rc'] = $content['id_rc']; + if ($content['show_graph']) { $return['kind_availability'] = "address"; } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 7b553c9c59..23b6a77518 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -281,6 +281,11 @@ function reporting_html_print_report($report, $mini = false) { } function reporting_html_SLA($table, $item, $mini) { + $style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']); + $style = json_decode(io_safe_output($style), true); + $hide_notinit_agent = $style['hide_notinit_agents']; + $same_agent_in_resume = ""; + if ($mini) { $font_size = '1.5'; } @@ -331,29 +336,60 @@ function reporting_html_SLA($table, $item, $mini) { $table1->headstyle[5] = 'text-align: right'; foreach ($item['data'] as $sla) { - $row = array(); - $row[] = $sla['agent']; - $row[] = $sla['module']; - $row[] = $sla['max'] . " / " . $sla['min']; - $row[] = round($sla['sla_limit'], 2) . "%"; - - if ($sla['sla_value_unknown']) { - $row[] = '' . - __('N/A') . ''; - $row[] = '' . - __('Unknown') . ''; - } - elseif ($sla['sla_status']) { - $row[] = '' . - round($sla['sla_value'], 2) . "%" . ''; - $row[] = '' . - __('OK') . ''; + $the_first_men_time = get_agent_first_time(io_safe_output($sla['agent'])); + if (!$hide_notinit_agent) { + $row = array(); + $row[] = $sla['agent']; + $row[] = $sla['module']; + $row[] = $sla['max'] . " / " . $sla['min']; + $row[] = round($sla['sla_limit'], 2) . "%"; + + if ($sla['sla_value_unknown']) { + $row[] = '' . + __('N/A') . ''; + $row[] = '' . + __('Unknown') . ''; + } + elseif ($sla['sla_status']) { + $row[] = '' . + round($sla['sla_value'], 2) . "%" . ''; + $row[] = '' . + __('OK') . ''; + } + else { + $row[] = '' . + round($sla['sla_value'], 2) . "%" . ''; + $row[] = '' . + __('Fail') . ''; + } } else { - $row[] = '' . - round($sla['sla_value'], 2) . "%" . ''; - $row[] = '' . - __('Fail') . ''; + if ($item['date']['to'] > $the_first_men_time) { + $row = array(); + $row[] = $sla['agent']; + $row[] = $sla['module']; + $row[] = $sla['max'] . " / " . $sla['min']; + $row[] = round($sla['sla_limit'], 2) . "%"; + + if ($sla['sla_value_unknown']) { + $row[] = '' . + __('N/A') . ''; + $row[] = '' . + __('Unknown') . ''; + } + elseif ($sla['sla_status']) { + $row[] = '' . + round($sla['sla_value'], 2) . "%" . ''; + $row[] = '' . + __('OK') . ''; + } + else { + $row[] = '' . + round($sla['sla_value'], 2) . "%" . ''; + $row[] = '' . + __('Fail') . ''; + } + } } $table1->data[] = $row; @@ -1641,6 +1677,10 @@ function reporting_html_text(&$table, $item) { } function reporting_html_availability(&$table, $item) { + $style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']); + $style = json_decode(io_safe_output($style), true); + $hide_notinit_agent = $style['hide_notinit_agents']; + $same_agent_in_resume = ""; if (!empty($item["data"])) { $table1 = new stdClass(); @@ -1682,15 +1722,35 @@ function reporting_html_availability(&$table, $item) { $table1->style[7] = 'text-align: right'; foreach ($item['data'] as $row) { - $table_row = array(); - $table_row[] = $row['agent']; - $table_row[] = $row['availability_item']; - $table_row[] = $row['checks']; - $table_row[] = $row['failed']; - $table_row[] = $row['fail']; - $table_row[] = $row['poling_time']; - $table_row[] = $row['time_unavaliable']; - $table_row[] = $row['ok']; + $the_first_men_time = get_agent_first_time(io_safe_output($row['agent'])); + + if (!$hide_notinit_agent) { + $table_row = array(); + $table_row[] = $row['agent']; + $table_row[] = $row['availability_item']; + $table_row[] = $row['checks']; + $table_row[] = $row['failed']; + $table_row[] = $row['fail']; + $table_row[] = $row['poling_time']; + $table_row[] = $row['time_unavaliable']; + $table_row[] = $row['ok']; + } + else { + if ($item['date']['to'] > $the_first_men_time) { + $table_row = array(); + $table_row[] = $row['agent']; + $table_row[] = $row['availability_item']; + $table_row[] = $row['checks']; + $table_row[] = $row['failed']; + $table_row[] = $row['fail']; + $table_row[] = $row['poling_time']; + $table_row[] = $row['time_unavaliable']; + $table_row[] = $row['ok']; + } + else { + $same_agent_in_resume = $row['agent']; + } + } $table1->data[] = $table_row; } @@ -1710,45 +1770,56 @@ function reporting_html_availability(&$table, $item) { $table1->width = '99%'; $table1->data = array (); - - - $table1->head = array (); - $table1->head['min_text'] = __('Agent max'); - $table1->head['min'] = __('Min Value'); - $table1->head['avg'] = __('Average Value'); - $table1->head['max_text'] = __('Agent min'); - $table1->head['max'] = __('Max Value'); - - $table1->headstyle = array(); - $table1->headstyle['min_text'] = 'text-align: left'; - $table1->headstyle['min'] = 'text-align: right'; - $table1->headstyle['avg'] = 'text-align: right'; - $table1->headstyle['max_text'] = 'text-align: left'; - $table1->headstyle['max'] = 'text-align: right'; - - - $table1->style = array(); - $table1->style['min_text'] = 'text-align: left'; - $table1->style['min'] = 'text-align: right'; - $table1->style['avg'] = 'text-align: right'; - $table1->style['max_text'] = 'text-align: left'; - $table1->style['max'] = 'text-align: right'; - - $table1->data[] = array( - 'min_text' => $item['resume']['min_text'], - 'min' => format_numeric($item['resume']['min'], 2) . "%", - 'avg' => format_numeric($item['resume']['avg'], 2) . "%", - 'max_text' => $item['resume']['max_text'], - 'max' => format_numeric($item['resume']['max'], 2) . "%" - ); - - $table->colspan[2][0] = 3; - $data = array(); - $data[0] = html_print_table($table1, true); - array_push ($table->data, $data); + if (($same_agent_in_resume == "") && (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)) { + $table1->head = array (); + $table1->head['min_text'] = __('Agent max'); + $table1->head['min'] = __('Min Value'); + $table1->head['avg'] = __('Average Value'); + $table1->head['max_text'] = __('Agent min'); + $table1->head['max'] = __('Max Value'); + + $table1->headstyle = array(); + $table1->headstyle['min_text'] = 'text-align: left'; + $table1->headstyle['min'] = 'text-align: right'; + $table1->headstyle['avg'] = 'text-align: right'; + $table1->headstyle['max_text'] = 'text-align: left'; + $table1->headstyle['max'] = 'text-align: right'; + + + $table1->style = array(); + $table1->style['min_text'] = 'text-align: left'; + $table1->style['min'] = 'text-align: right'; + $table1->style['avg'] = 'text-align: right'; + $table1->style['max_text'] = 'text-align: left'; + $table1->style['max'] = 'text-align: right'; + + $table1->data[] = array( + 'min_text' => $item['resume']['min_text'], + 'min' => format_numeric($item['resume']['min'], 2) . "%", + 'avg' => format_numeric($item['resume']['avg'], 2) . "%", + 'max_text' => $item['resume']['max_text'], + 'max' => format_numeric($item['resume']['max'], 2) . "%" + ); + + $table->colspan[2][0] = 3; + $data = array(); + $data[0] = html_print_table($table1, true); + array_push ($table->data, $data); + } } } +function get_agent_first_time ($agent_name) { + $id = agents_get_agent_id($agent_name, true); + + $utimestamp = db_get_all_rows_sql("SELECT utimestamp FROM tagente_datos WHERE id_agente_modulo IN + (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = " . $id . ") + ORDER BY utimestamp ASC LIMIT 1"); + $utimestamp = $utimestamp[0]['utimestamp']; + + return $utimestamp; +} + function reporting_html_general(&$table, $item) { if (!empty($item["data"])) {