diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 03c5427d60..a4dbe7685d 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -261,7 +261,7 @@ function reporting_make_reporting_data( } if (isset($content['style']['name_label'])) { - // Add macros name + // Add macros name. $items_label = []; $items_label['type'] = $content['type']; $items_label['id_agent'] = $content['id_agent']; @@ -272,11 +272,10 @@ function reporting_make_reporting_data( $metaconsole_on = is_metaconsole(); $server_name = $content['server_name']; - // Metaconsole connection + // Metaconsole connection. if ($metaconsole_on && $server_name != '') { $connection = metaconsole_get_connection($server_name); if (!metaconsole_load_external_db($connection)) { - // ui_print_error_message ("Error connecting to ".$server_name); continue; } } @@ -889,7 +888,6 @@ function reporting_SLA( if ($metaconsole_on && $server_name != '') { $connection = metaconsole_get_connection($server_name); if (!metaconsole_load_external_db($connection)) { - // ui_print_error_message ("Error connecting to ".$server_name); continue; } } @@ -898,7 +896,7 @@ function reporting_SLA( || modules_is_not_init($sla['id_agent_module']) ) { if ($metaconsole_on) { - // Restore db connection + // Restore db connection. metaconsole_restore_db(); } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 8bc7c973f3..84396cfb91 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -102,12 +102,12 @@ function html_do_report_info($report) $date_today = date($config['date_format']); - $html = '
'.' - - - - - '; + $html = '
'.__('Generated').': '.$date_today.'
'.__('Report date').':
+ + + + + '; if (isset($report['period'])) { if (is_numeric($report['datetime']) && is_numeric($report['period'])) { $html .= ''; @@ -119,10 +119,10 @@ function html_do_report_info($report) } $html .= ' - - - -
'.__('Generated').': '.$date_today.'
'.__('Report date').': '.date($config['date_format'], ($report['datetime'] - $report['period'])).'
'.__('Description').': '.io_safe_output($report['description']).'
'.'
'; + + '.__('Description').': '.io_safe_output($report['description']).' + + '.''; echo $html; } @@ -397,9 +397,20 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) } -function reporting_html_SLA($table, $item, $mini) +function reporting_html_SLA($table, $item, $mini, $pdf=0) { - $style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']); + if ($table === false) { + $table = new stdClass(); + $table->width = '99%'; + $table->class = 'table_beauty'; + } + + $style = db_get_value( + 'style', + 'treport_content', + 'id_rc', + $item['id_rc'] + ); $style = json_decode(io_safe_output($style), true); $same_agent_in_resume = ''; @@ -423,7 +434,9 @@ function reporting_html_SLA($table, $item, $mini) $table->data['sla']['cell'] = $item['failed']; } else { if (!empty($item['planned_downtimes'])) { - $downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']); + $downtimes_table = reporting_html_planned_downtimes_table( + $item['planned_downtimes'] + ); if (!empty($downtimes_table)) { $table->colspan['planned_downtime']['cell'] = 3; @@ -459,7 +472,7 @@ function reporting_html_SLA($table, $item, $mini) $table1->headstyle[4] = 'text-align: right'; $table1->headstyle[5] = 'text-align: right'; - // second_table for time globals + // Second_table for time globals. $table2 = new stdClass(); $table2->width = '99%'; @@ -490,7 +503,7 @@ function reporting_html_SLA($table, $item, $mini) $table2->headstyle[5] = 'text-align: right'; $table2->headstyle[6] = 'text-align: right'; - // third_table for time globals + // Third_table for time globals. $table3 = new stdClass(); $table3->width = '99%'; @@ -520,15 +533,23 @@ function reporting_html_SLA($table, $item, $mini) foreach ($item['data'] as $sla) { if (isset($sla)) { - $the_first_men_time = get_agent_first_time(io_safe_output($sla['agent'])); + $the_first_men_time = get_agent_first_time( + io_safe_output($sla['agent']) + ); - // first_table + // First_table. $row = []; $row[] = $sla['agent']; $row[] = $sla['module']; if (is_numeric($sla['dinamic_text'])) { - $row[] = sla_truncate($sla['max'], $config['graph_precision']).' / '.sla_truncate($sla['min'], $config['graph_precision']); + $row[] = sla_truncate( + $sla['max'], + $config['graph_precision'] + ).' / '.sla_truncate( + $sla['min'], + $config['graph_precision'] + ); } else { $row[] = $sla['dinamic_text']; } @@ -550,47 +571,64 @@ function reporting_html_SLA($table, $item, $mini) $row[] = ''.__('Fail').''; } - // second table for time globals + // Second table for time globals. $row2 = []; $row2[] = $sla['agent'].' -- ['.$sla['module'].']'; if ($sla['time_total'] != 0) { - $row2[] = human_time_description_raw($sla['time_total']); + $row2[] = human_time_description_raw( + $sla['time_total'] + ); } else { $row2[] = '--'; } if ($sla['time_error'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_error'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_error'], + true + ).''; } else { $row2[] = '--'; } if ($sla['time_ok'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_ok'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_ok'], + true + ).''; } else { $row2[] = '--'; } if ($sla['time_unknown'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_unknown'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_unknown'], + true + ).''; } else { $row2[] = '--'; } if ($sla['time_not_init'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_not_init'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_not_init'], + true + ).''; } else { $row2[] = '--'; } if ($sla['time_downtime'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_downtime'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_downtime'], + true + ).''; } else { $row2[] = '--'; } - // third table for checks globals + // Third table for checks globals. $row3 = []; $row3[] = $sla['agent'].' -- ['.$sla['module'].']'; $row3[] = $sla['checks_total']; @@ -605,11 +643,20 @@ function reporting_html_SLA($table, $item, $mini) } $table->colspan['sla']['cell'] = 2; - $table->data['sla']['cell'] = html_print_table($table1, true); + $table->data['sla']['cell'] = html_print_table( + $table1, + true + ); $table->colspan['time_global']['cell'] = 2; - $table->data['time_global']['cell'] = html_print_table($table2, true); + $table->data['time_global']['cell'] = html_print_table( + $table2, + true + ); $table->colspan['checks_global']['cell'] = 2; - $table->data['checks_global']['cell'] = html_print_table($table3, true); + $table->data['checks_global']['cell'] = html_print_table( + $table3, + true + ); } else { $table->colspan['error']['cell'] = 3; $table->data['error']['cell'] = __('There are no Agent/Modules defined'); @@ -631,9 +678,12 @@ function reporting_html_SLA($table, $item, $mini) } $table->colspan['charts']['cell'] = 2; - $table->data['charts']['cell'] = html_print_table($table1, true); + $table->data['charts']['cell'] = html_print_table( + $table1, + true + ); - // table_legend_graphs; + // Table_legend_graphs. $table1 = new stdClass(); $table1->width = '99%'; $table1->data = []; @@ -669,9 +719,16 @@ function reporting_html_SLA($table, $item, $mini) $table1->data[0][11] = ''.__('Ignore time').''; $table->colspan['legend']['cell'] = 2; - $table->data['legend']['cell'] = html_print_table($table1, true); + $table->data['legend']['cell'] = html_print_table( + $table1, + true + ); } } + + if ($pdf !== 0) { + return html_print_table($table, true); + } } @@ -794,7 +851,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0) } foreach ($item['data'] as $k => $event) { - // First pass along the class of this row + // First pass along the class of this row. if ($item['show_summary_group']) { $table1->cellclass[$k][1] = $table1->cellclass[$k][2] = $table1->cellclass[$k][4] = $table1->cellclass[$k][5] = $table1->cellclass[$k][6] = $table1->cellclass[$k][7] = get_priority_class($event['criticity']); } else { @@ -1559,53 +1616,53 @@ function reporting_html_group_report($table, $item) $table->colspan['group_report']['cell'] = 3; $table->cellstyle['group_report']['cell'] = 'text-align: center;'; $table->data['group_report']['cell'] = " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".__('Total')."
".__('Unknown')."
".__('Agents')."
".$item['data']['group_stats']['total_agents']."
".$item['data']['group_stats']['agents_unknown']."
".__('Total')."
".__('Normal')."
".__('Critical')."
".__('Warning')."
".__('Unknown')."
".__('Not init')."
".__('Monitors')."
".$item['data']['group_stats']['monitor_checks']."
".$item['data']['group_stats']['monitor_ok']."
".$item['data']['group_stats']['monitor_critical']."
".$item['data']['group_stats']['monitor_warning']."
".$item['data']['group_stats']['monitor_unknown']."
".$item['data']['group_stats']['monitor_not_init']."
".__('Defined')."
".__('Fired')."
".__('Alerts')."
".$item['data']['group_stats']['monitor_alerts']."
".$item['data']['group_stats']['monitor_alerts_fired']."
".__('Last %s', human_time_description_raw($item['date']['period']))."
".__('Events')."
".$item['data']['count_events'].'
'; + + +
".__('Total')."
+
".__('Unknown')."
+ + +
".__('Agents')."
+
".$item['data']['group_stats']['total_agents']."
+
".$item['data']['group_stats']['agents_unknown']."
+ + + +
".__('Total')."
+
".__('Normal')."
+
".__('Critical')."
+
".__('Warning')."
+
".__('Unknown')."
+
".__('Not init')."
+ + +
".__('Monitors')."
+
".$item['data']['group_stats']['monitor_checks']."
+
".$item['data']['group_stats']['monitor_ok']."
+
".$item['data']['group_stats']['monitor_critical']."
+
".$item['data']['group_stats']['monitor_warning']."
+
".$item['data']['group_stats']['monitor_unknown']."
+
".$item['data']['group_stats']['monitor_not_init']."
+ + + +
".__('Defined')."
+
".__('Fired')."
+ + +
".__('Alerts')."
+
".$item['data']['group_stats']['monitor_alerts']."
+
".$item['data']['group_stats']['monitor_alerts_fired']."
+ + + +
".__('Last %s', human_time_description_raw($item['date']['period']))."
+ + +
".__('Events')."
+
".$item['data']['count_events'].'
+ + '; } @@ -2302,15 +2359,15 @@ function reporting_html_url(&$table, $item, $key) $table->colspan['data']['cell'] = 3; $table->cellstyle['data']['cell'] = 'text-align: left;'; $table->data['data']['cell'] = ' - '; + '; // TODO: make this dynamic and get the height if the iframe to resize this item $table->data['data']['cell'] .= ' - '; + '; } @@ -2635,8 +2692,8 @@ function get_agent_first_time($agent_name) $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' + (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = '.$id.') + ORDER BY utimestamp ASC LIMIT 1' ); $utimestamp = $utimestamp[0]['utimestamp']; @@ -2878,7 +2935,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) $table_sum->data[] = $tdata; $output = '
- '.__('Summary').''.html_print_table($table_sum, true).'
'; + '.__('Summary').''.html_print_table($table_sum, true).''; return $output; } @@ -3459,12 +3516,12 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1 if (!defined('METACONSOLE')) { $agents_data = '
- '.__('Agents by status').''.html_print_table($table_agent, true).'
'; + '.__('Agents by status').''.html_print_table($table_agent, true).''; } else { $table_agent->style = []; $table_agent->class = 'tactical_view'; $agents_data = '
- '.__('Agents by status').''.html_print_table($table_agent, true).'
'; + '.__('Agents by status').''.html_print_table($table_agent, true).''; } return $agents_data; @@ -3487,7 +3544,7 @@ function reporting_get_total_agents_and_monitors($data, $graph_width=250, $graph $total_data[3] = $total_module <= 0 ? '-' : $total_module; $table_total->data[] = $total_data; $total_agent_module = '
- '.__('Total agents and monitors').''.html_print_table($table_total, true).'
'; + '.__('Total agents and monitors').''.html_print_table($table_total, true).''; return $total_agent_module; } @@ -3506,12 +3563,12 @@ function reporting_get_total_servers($num_servers) if (!defined('METACONSOLE')) { $node_overview = '
- '.__('Node overview').''.html_print_table($table_node, true).'
'; + '.__('Node overview').''.html_print_table($table_node, true).''; } else { $table_node->style = []; $table_node->class = 'tactical_view'; $node_overview = '
- '.__('Node overview').''.html_print_table($table_node, true).'
'; + '.__('Node overview').''.html_print_table($table_node, true).''; } return $node_overview; @@ -3555,7 +3612,7 @@ function reporting_get_events($data, $links=false) if (!defined('METACONSOLE')) { $event_view = '
- '.__('Events by severity').''.html_print_table($table_events, true).'
'; + '.__('Events by severity').''.html_print_table($table_events, true).''; } else { $table_events->class = 'tactical_view'; $table_events->styleTable = 'text-align:center;'; @@ -3565,7 +3622,7 @@ function reporting_get_events($data, $links=false) $table_events->size[3] = '10%'; $event_view = '
- '.__('Important Events by Criticity').''.html_print_table($table_events, true).'
'; + '.__('Important Events by Criticity').''.html_print_table($table_events, true).''; } return $event_view; @@ -3597,9 +3654,9 @@ function reporting_get_last_activity() case 'mysql': $sql = sprintf( 'SELECT id_usuario,accion,fecha,ip_origen,descripcion,utimestamp - FROM tsesion - WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.") - AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 5", + FROM tsesion + WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.") + AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 5", $config['id_user'] ); break; @@ -3607,9 +3664,9 @@ function reporting_get_last_activity() case 'postgresql': $sql = sprintf( "SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion, utimestamp - FROM tsesion - WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_1WEEK.") - AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 5", + FROM tsesion + WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_1WEEK.") + AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 5", $config['id_user'] ); break; @@ -3617,9 +3674,9 @@ function reporting_get_last_activity() case 'oracle': $sql = sprintf( "SELECT id_usuario, accion, fecha, ip_origen, descripcion, utimestamp - FROM tsesion - WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_1WEEK.") - AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", + FROM tsesion + WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_1WEEK.") + AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config['id_user'] ); break; @@ -3797,7 +3854,7 @@ function reporting_get_event_histogram($events, $text_header_event=false) if (!defined('METACONSOLE')) { if (!$text_header_event) { $event_graph = '
- '.$text_header_event.''.html_print_table($table, true).'
'; + '.$text_header_event.''.html_print_table($table, true).''; } else { $table->class = 'noclass'; $event_graph = html_print_table($table, true); @@ -3895,9 +3952,9 @@ function reporting_get_event_histogram_meta($width) $time_condition = 'utimestamp > '.$bottom.' AND utimestamp < '.$top; $sql = sprintf( 'SELECT criticity,utimestamp - FROM tmetaconsole_event - WHERE %s %s %s - ORDER BY criticity DESC', + FROM tmetaconsole_event + WHERE %s %s %s + ORDER BY criticity DESC', $time_condition, $groups_condition, $status_condition @@ -3981,7 +4038,7 @@ function reporting_get_event_histogram_meta($width) if (!$text_header_event) { $event_graph = '
- '.$text_header_event.''.html_print_table($table, true).'
'; + '.$text_header_event.''.html_print_table($table, true).''; } else { $table->class = 'noclass'; $event_graph = html_print_table($table, true); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index f42c64f70a..cd5a3d8eaf 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1,24 +1,30 @@ -/* -Author: The Pandora FMS team -Name: Default theme -Description: The default Pandora FMS theme layout - -// Pandora FMS - http://pandorafms.com -// ========================================================== -// Copyright (c) 2004-2011 Artica Soluciones Tecnológicas S.L - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ +/** + * Extension to manage a list of gateways and the node address where they should + * point to. + * + * @category Extensions + * @package Pandora FMS + * @subpackage Community + * @version 1.0.0 + * @license See below + * + * ______ ___ _______ _______ ________ + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| + * + * ============================================================================ + * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas + * Please see http://pandorafms.org for full contribution list + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation for version 2. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * ============================================================================ + */ /* Tree view styles */ @import url(tree.css); diff --git a/pandora_console/include/styles/pandoraPDF.css b/pandora_console/include/styles/pandoraPDF.css new file mode 100644 index 0000000000..10dc892ec6 --- /dev/null +++ b/pandora_console/include/styles/pandoraPDF.css @@ -0,0 +1,71 @@ +/** + * Extension to manage a list of gateways and the node address where they should + * point to. + * + * @category Extensions + * @package Pandora FMS + * @subpackage Community + * @version 1.0.0 + * @license See below + * + * ______ ___ _______ _______ ________ + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| + * + * ============================================================================ + * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas + * Please see http://pandorafms.org for full contribution list + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation for version 2. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * ============================================================================ + */ + +.content_table { + width: 100%; + font-size: 20pt !important; + page-break-inside: avoid; + border-collapse: collapse; +} + +.content_table tr th, +.content_table tr td { + padding: 10px; +} + +thead.header_tr tr { + background: #e6e6e6; +} +thead.header_tr tr th { + font-weight: normal; + text-align: right; +} +thead.header_tr tr th.th_first { + font-weight: bold; + text-align: left; +} + +.table_beauty { + font-size: 20pt !important; + border-collapse: collapse; + width: 100%; +} + +.table_beauty tr td { + font-size: 20pt !important; + padding: 5px; + border: 0.1pt solid #acacac; +} + +.table_beauty tr td table { + font-size: 20pt !important; +} + +.table_beauty tr td table tr td { + font-size: 20pt !important; +} diff --git a/pandora_console/index.php b/pandora_console/index.php index ad4b93465a..321b5956dc 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1363,4 +1363,3 @@ require 'include/php_to_js_values.php'; if (__PAN_XHPROF__ === 1) { pandora_xhprof_display_result('node_index'); } -