From 4fb7e1719b1d8cc53d5c8e61c90bd76a37eb747f Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 18 Oct 2023 12:49:47 +0200 Subject: [PATCH 01/47] add periodicity graph pandora_enterprise#9640 --- pandora_console/extensions/agents_modules.php | 2 +- pandora_console/include/ajax/module.php | 17 +- pandora_console/include/functions_graph.php | 537 ++++++++++++++++ pandora_console/include/graphs/fgraph.php | 67 +- pandora_console/include/styles/pandora.css | 33 +- .../operation/agentes/stat_win.php | 572 +++++++----------- pandora_console/operation/search_modules.php | 2 +- 7 files changed, 845 insertions(+), 385 deletions(-) diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index d6c4f3bb32..f372f45812 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -1007,7 +1007,7 @@ function mainAgentsModules() echo ""; $win_handle = dechex(crc32($module_id.$module['name'])); $graph_type = return_graphtype(modules_get_agentmodule_type($module_id)); - $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."', 800, 480)"; + $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&id='.$module_id.'&period_graph=0&refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."', 800, 480)"; echo ''; diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 78daacb0a0..2951ad495a 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1283,7 +1283,7 @@ if (check_login()) { } if (is_snapshot_data($module['datos']) === false) { - $link = 'winopeng_var(\'operation/agentes/stat_win.php?type='.$graph_type.'&period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&refresh='.SECONDS_10MINUTES.'&draw_events='.$draw_events.'\', \'day_'.$win_handle.'\', 800, 480)'; + $link = 'winopeng_var(\'operation/agentes/stat_win.php?type='.$graph_type.'&period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&refresh='.SECONDS_10MINUTES.'&period_graph=0&draw_events='.$draw_events.'\', \'day_'.$win_handle.'\', 800, 480)'; $graphButtons[] = html_print_anchor( [ 'href' => 'javascript:'.$link, @@ -1499,9 +1499,14 @@ if (check_login()) { $output = ''; $graph_data = get_parameter('graph_data', ''); $params = json_decode(base64_decode($graph_data), true); + $form_data = json_decode(base64_decode(get_parameter('form_data', [])), true); $server_id = (int) get_parameter('server_id', 0); include_once $config['homedir'].'/include/functions_graph.php'; + $tab_active = get_parameter('active', 'tabs-chart-module-graph'); + + $output .= draw_form_stat_win($form_data, $tab_active); + // Metaconsole connection to the node. if (is_metaconsole() === true && empty($server_id) === false) { $server = metaconsole_get_connection_by_id($server_id); @@ -1553,7 +1558,15 @@ if (check_login()) { $output .= $graph['chart']; $output .= ''; } else { - $output .= grafico_modulo_sparse($params); + if ($tab_active === 'tabs-chart-module-graph') { + $output .= grafico_modulo_sparse($params); + } else { + $output .= graphic_periodicity_module($params); + if ($params['compare'] === 'separated') { + $params['date'] = ($params['date'] - $params['period']); + $output .= graphic_periodicity_module($params); + } + } } } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index e6605a488b..006870757e 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2422,6 +2422,147 @@ function graphic_combined_module( } +/** + * Draw periodicity graph + * + * @param array $params Params for draw chart. + * + * @return string Html output. + */ +function graphic_periodicity_module(array $params): string +{ + $date_array = []; + $date_array['period'] = $params['period']; + $date_array['final_date'] = $params['date']; + $date_array['start_date'] = ($params['date'] - $params['period']); + + $array_data = fullscale_data( + $params['agent_module_id'], + $date_array, + false, + false, + 1, + false, + $params['period_slice_chart'], + 0 + ); + + if (empty($array_data) === false) { + $graph_labels = []; + $multiple_labels = []; + foreach ($array_data['sum1']['slice_data'] as $time => $array_data) { + $graph_labels[] = date('H:i', ($time / 1000)); + + $avg = [ + 'y' => $array_data['avg'], + 'x' => $time, + ]; + + $max = [ + 'y' => $array_data['max'], + 'x' => $time, + ]; + + $min = [ + 'y' => $array_data['min'], + 'x' => $time, + ]; + + $sum = [ + 'y' => $array_data['sum'], + 'x' => $time, + ]; + if ((int) $params['period_mode'] === CUSTOM_GRAPH_HBARS) { + $avg = [ + 'x' => $array_data['avg'], + 'y' => $time, + ]; + + $max = [ + 'x' => $array_data['max'], + 'y' => $time, + ]; + + $min = [ + 'x' => $array_data['min'], + 'y' => $time, + ]; + + $sum = [ + 'x' => $array_data['sum'], + 'y' => $time, + ]; + } + + $graph_values_avg[] = $avg; + $graph_values_max[] = $max; + $graph_values_min[] = $min; + $graph_values_sum[] = $sum; + } + + if ((bool) $params['period_average'] === true) { + $graph_values['avg'] = $graph_values_avg; + $multiple_labels['avg'] = [ + 'label' => __('Average'), + 'fill' => ((int) $params['period_mode'] === CUSTOM_GRAPH_AREA) ? true : false, + ]; + } + + if ((bool) $params['period_maximum'] === true) { + $graph_values['max'] = $graph_values_max; + $multiple_labels['max'] = [ + 'label' => __('Maximun'), + 'fill' => ((int) $params['period_mode'] === CUSTOM_GRAPH_AREA) ? true : false, + ]; + } + + if ((bool) $params['period_minimum'] === true) { + $graph_values['min'] = $graph_values_min; + $multiple_labels['min'] = [ + 'label' => __('Minimum'), + 'fill' => ((int) $params['period_mode'] === CUSTOM_GRAPH_AREA) ? true : false, + ]; + } + + if ((bool) $params['period_summatory'] === true) { + $graph_values['sum'] = $graph_values_sum; + $multiple_labels['sum'] = [ + 'label' => __('Summatory'), + 'fill' => ((int) $params['period_mode'] === CUSTOM_GRAPH_AREA) ? true : false, + ]; + } + } + + $options = [ + 'height' => 200, + 'waterMark' => true, + 'legend' => ['display' => true], + 'labels' => $graph_labels, + 'multiple' => $multiple_labels, + ]; + + $output = '
'; + $output .= '
'; + if ((int) $params['period_mode'] === CUSTOM_GRAPH_HBARS + || (int) $params['period_mode'] === CUSTOM_GRAPH_VBARS + ) { + if ((int) $params['period_mode'] === CUSTOM_GRAPH_HBARS) { + $options['axis'] = 'y'; + } + + $output .= vbar_graph($graph_values, $options); + } else { + $output .= line_graph($graph_values, $options); + } + + $output .= '
'; + $output .= '
'; + + return $output; + +} + + /** * Function for convert data summatory. * @@ -3909,6 +4050,7 @@ function fullscale_data( } $data['sum'.$series_suffix]['slice_data'][$real_date]['avg'] = ($sum_data / $count_data); + $data['sum'.$series_suffix]['slice_data'][$real_date]['sum'] = $sum_data; if ($max_value != (-PHP_INT_MAX)) { $data['sum'.$series_suffix]['slice_data'][$real_date]['max'] = $max_value; @@ -4174,6 +4316,7 @@ function fullscale_data( $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['avg'] = 0; if (isset($count_data) === true) { $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['avg'] = ($sum_data / $count_data); + $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['sum'] = $sum_data; } $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['max'] = $max_value; @@ -5351,3 +5494,397 @@ function graph_analytics_filter_select() return $result; } + + +function draw_form_stat_win(array $form_data, string $tab_active) +{ + $table = html_get_predefined_table('transparent', 2); + $table->width = '100%'; + $table->id = 'stat_win_form_div'; + $table->style[0] = 'text-align:left;font-weight: bold;font-size:8.5pt;line-height:30pt;'; + $table->style[1] = 'text-align:left;font-weight: bold;line-height:30pt;'; + $table->style[2] = 'text-align:left;font-weight: bold;line-height:30pt;'; + $table->style[3] = 'text-align:left;font-weight: bold;line-height:30pt;'; + $table->class = 'table_modal_alternate'; + $table->data = []; + + if ((bool) $form_data['histogram'] === true || $tab_active === 'tabs-chart-period-graph') { + $table->data[0][0] = __('Refresh time'); + $table->data[0][1] = '
'.html_print_extended_select_for_time( + 'refresh', + $form_data['refresh'], + '', + '', + 0, + 7, + true + ).'
'; + + $table->data[0][2] = ''; + $table->data[0][3] = ''; + + $table->data[1][0] = __('Begin date'); + $table->data[1][1] = html_print_input_text( + 'start_date', + $form_data['start_date'], + '', + 10, + 20, + true, + false, + false, + '', + 'small-input' + ); + + $table->data[1][2] = __('Begin time'); + $table->data[1][3] = html_print_input_text( + 'start_time', + $form_data['start_time'], + '', + 10, + 10, + true, + false, + false, + '', + 'small-input' + ); + + $table->data[2][0] = __('Time range'); + $table->data[2][1] = '
'.html_print_extended_select_for_time( + 'period', + $form_data['period'], + '', + '', + 0, + 7, + true + ).'
'; + + $table->data[3][0] = __('Time compare (Separated)'); + $table->data[3][1] = html_print_checkbox_switch( + 'time_compare_separated', + 1, + (bool) $form_data['time_compare_separated'], + true + ); + + $table->data[3][2] = ''; + $table->data[3][3] = ''; + + if ($tab_active === 'tabs-chart-period-graph') { + $table->data[4][0] = __('Maximum'); + $table->data[4][1] = html_print_checkbox_switch( + 'period_maximum', + 1, + (bool) $form_data['period_maximum'], + true + ); + + $table->data[4][2] = __('Minimum'); + $table->data[4][3] = html_print_checkbox_switch( + 'period_minimum', + 1, + (bool) $form_data['period_minimum'], + true + ); + + $table->data[5][0] = __('Average'); + $table->data[5][1] = html_print_checkbox_switch( + 'period_average', + 1, + (bool) $form_data['period_average'], + true + ); + + $table->data[5][2] = __('Summatory'); + $table->data[5][3] = html_print_checkbox_switch( + 'period_summatory', + 1, + (bool) $form_data['period_summatory'], + true + ); + + $table->data[6][0] = __('Slice'); + $table->data[6][1] = '
'.html_print_extended_select_for_time( + 'period_slice_chart', + (string) $form_data['period_slice_chart'], + '', + '', + 0, + 7, + true, + false, + true, + '', + false, + [ + SECONDS_1HOUR => __('1 hour'), + SECONDS_1DAY => __('1 day'), + SECONDS_1WEEK => __('1 week'), + SECONDS_1MONTH => __('1 month'), + ] + ).'
'; + + $table->data[6][2] = __('Mode'); + $options_period_mode = [ + CUSTOM_GRAPH_AREA => __('Area'), + CUSTOM_GRAPH_LINE => __('Line'), + // CUSTOM_GRAPH_HBARS => __('Horizontal bars'), + CUSTOM_GRAPH_VBARS => __('Vertical bars'), + ]; + + $table->data[6][3] = '
'.html_print_select( + $options_period_mode, + 'period_mode', + $form_data['period_mode'], + '', + '', + 0, + true, + false, + false + ).'
'; + } + } else { + $table->data[0][0] = __('Refresh time'); + $table->data[0][1] = '
'.html_print_extended_select_for_time( + 'refresh', + $form_data['refresh'], + '', + '', + 0, + 7, + true + ).'
'; + + $table->data[0][2] = __('Show events'); + $disabled = false; + + $table->data[0][3] = html_print_checkbox_switch( + 'draw_events', + 1, + (bool) $form_data['draw_events'], + true, + $disabled + ); + + $table->data[1][0] = __('Begin date'); + $table->data[1][1] = html_print_input_text( + 'start_date', + $form_data['start_date'], + '', + 10, + 20, + true, + false, + false, + '', + 'small-input' + ); + + $table->data[1][2] = __('Show alerts'); + $table->data[1][3] = html_print_checkbox_switch( + 'draw_alerts', + 1, + (bool) $form_data['draw_alerts'], + true + ); + + $table->data[2][0] = __('Begin time'); + $table->data[2][1] = html_print_input_text( + 'start_time', + $form_data['start_time'], + '', + 10, + 10, + true, + false, + false, + '', + 'small-input' + ); + + $table->data[2][2] = __('Show unknown graph'); + $table->data[2][3] = html_print_checkbox_switch( + 'unknown_graph', + 1, + (bool) $form_data['unknown_graph'], + true + ); + + $table->data[3][0] = __('Time range'); + $table->data[3][1] = '
'.html_print_extended_select_for_time( + 'period', + $form_data['period'], + '', + '', + 0, + 7, + true + ).'
'; + + $table->data[3][2] = ''; + $table->data[3][3] = ''; + + if (!modules_is_boolean($form_data['id'])) { + $table->data[4][0] = __('Zoom'); + $options = []; + $options[$form_data['zoom']] = 'x'.$form_data['zoom']; + $options[1] = 'x1'; + $options[2] = 'x2'; + $options[3] = 'x3'; + $options[4] = 'x4'; + $options[5] = 'x5'; + $table->data[4][1] = '
'.html_print_select( + $options, + 'zoom', + $form_data['zoom'], + '', + '', + 0, + true, + false, + false + ).'
'; + + $table->data[4][2] = __('Show percentil'); + $table->data[4][3] = html_print_checkbox_switch( + 'show_percentil', + 1, + (bool) $form_data['show_percentil'], + true + ); + } + + $table->data[5][0] = __('Time compare (Overlapped)'); + $table->data[5][1] = html_print_checkbox_switch( + 'time_compare_overlapped', + 1, + (bool) $form_data['time_compare_overlapped'], + true + ); + + $table->data[5][2] = __('Time compare (Separated)'); + $table->data[5][3] = html_print_checkbox_switch( + 'time_compare_separated', + 1, + (bool) $form_data['time_compare_separated'], + true + ); + + $table->data[6][0] = __('Show AVG/MAX/MIN data series in graph'); + $table->data[6][1] = html_print_checkbox_switch( + 'type_mode_graph', + 1, + (bool) $form_data['type_mode_graph'], + true, + false + ); + + $table->data[6][2] = __('Show full scale graph (TIP)'); + $table->data[6][2] .= ui_print_help_tip( + __('TIP mode charts do not support average - maximum - minimum series, you can only enable TIP or average, maximum or minimum series'), + true + ); + $table->data[6][3] = html_print_checkbox_switch( + 'fullscale', + 1, + (bool) $form_data['fullscale'], + true, + false + ); + + $table->data[7][0] = __('Projection graph'); + $table->data[7][0] .= ui_print_help_tip( + __('Projection graph take as begin date the current time'), + true + ); + $table->data[7][1] = html_print_checkbox_switch( + 'enable_projected_period', + 1, + (bool) $form_data['enable_projected_period'], + true + ); + + $table->data[7][2] = __('Projection period'); + $table->data[7][3] = '
'.html_print_extended_select_for_time( + 'period_projected', + $form_data['period_projected'], + '', + '', + 0, + 7, + true + ).'
'; + } + + $form_table = html_print_table($table, true); + $form_table .= html_print_div( + [ + 'class' => 'action-buttons-right-forced margin-top-10', + 'content' => html_print_submit_button( + __('Reload'), + 'submit', + false, + [ + 'icon' => 'search', + 'mode' => 'secondary mini', + 'class' => 'float-right', + ], + true + ), + ], + true + ); + + $output = '
'; + $output .= html_print_input_hidden('id', $form_data['id'], true); + $output .= html_print_input_hidden('label', $form_data['label'], true); + + if (empty($server_id) === false) { + $output .= html_print_input_hidden('server', $form_data['server_id'], true); + } + + $output .= html_print_input_hidden('histogram', $form_data['histogram'], true); + $output .= html_print_input_hidden('period_graph', $form_data['period_graph'], true); + $output .= html_print_input_hidden('type', $form_data['type'], true); + + $output .= ui_toggle( + $form_table, + ''.__('Graph configuration menu').''.ui_print_help_tip( + __('In Pandora FMS, data is stored compressed. The data visualization in database, charts or CSV exported data won\'t match, because is interpreted at runtime. Please check \'Pandora FMS Engineering\' chapter from documentation.'), + true + ), + '', + '', + true, + true, + '', + 'white-box-content', + 'box-flat pdd_10px', + 'images/arrow@svg.svg', + 'images/arrow@svg.svg', + true + ); + $output .= '
'; + + return $output; +} + + +function draw_container_chart_stat_win(?string $name='stat-win-module-graph') +{ + $output = '
'; + $output .= '
'; + $output .= html_print_image('images/spinner_charts.gif', true); + $output .= '
'; + + $output .= '
'; + $output .= '
'; + + $output .= '
'; + + return $output; +} diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 494ec9c010..9cf7b5621d 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -1220,11 +1220,24 @@ function get_build_setup_charts($type, $options, $data) break; case 'BAR': - $setData->setLabel('data')->setBackgroundColor($colors); - $setData->setLabel('data')->setBorderColor($borders); - $setData->setLabel('data')->setBorderWidth(2); - - $setData->setLabel('data')->data()->exchangeArray(array_values($data)); + if (isset($options['multiple']) === true && empty($options['multiple']) === false) { + $i = 0; + foreach ($options['multiple'] as $key_label => $info) { + $dataSet = $chart->createDataSet(); + $dataSet->setLabel(($info['label'] ?? '--')); + $dataSet->setBackgroundColor(($info['backgroundColor'] ?? $colors[$i])); + $dataSet->setBorderColor(($info['borderColor'] ?? $borders[$i])); + $dataSet->setBorderWidth(($info['borderWidth'] ?? 2)); + $dataSet->data()->exchangeArray(array_values($data[$key_label])); + $chart->addDataSet($dataSet); + $i++; + } + } else { + $setData->setLabel('data')->setBackgroundColor($colors); + $setData->setLabel('data')->setBorderColor($borders); + $setData->setLabel('data')->setBorderWidth(2); + $setData->setLabel('data')->data()->exchangeArray(array_values($data)); + } // Para las horizontales. if (isset($options['axis']) === true @@ -1250,19 +1263,32 @@ function get_build_setup_charts($type, $options, $data) break; case 'LINE': - $chart->labels()->exchangeArray($options['labels']); - - foreach ($data as $key => $dataset) { - $dataSet1 = $chart->createDataSet(); - $dataSet1->setLabel($dataset['label']); - $dataSet1->setBackgroundColor($dataset['backgroundColor']); - $dataSet1->setBorderColor($dataset['borderColor']); - $dataSet1->setPointBackgroundColor($dataset['pointBackgroundColor']); - $dataSet1->setPointBorderColor($dataset['pointBorderColor']); - $dataSet1->setPointHoverBackgroundColor($dataset['pointHoverBackgroundColor']); - $dataSet1->setPointHoverBorderColor($dataset['pointHoverBorderColor']); - $dataSet1->data()->exchangeArray($dataset['data']); - $chart->addDataSet($dataSet1); + if (isset($options['multiple']) === true && empty($options['multiple']) === false) { + $i = 0; + foreach ($options['multiple'] as $key_label => $info) { + $dataSet = $chart->createDataSet(); + $dataSet->setLabel(($info['label'] ?? '--')); + $dataSet->setBackgroundColor(($info['backgroundColor'] ?? $colors[$i])); + $dataSet->setBorderColor(($info['borderColorColor'] ?? $borders[$i])); + $dataSet->setFill(($info['fill'] ?? false)); + $dataSet->data()->exchangeArray(array_values($data[$key_label])); + $chart->addDataSet($dataSet); + $i++; + } + } else { + $chart->labels()->exchangeArray($options['labels']); + foreach ($data as $key => $dataset) { + $dataSet = $chart->createDataSet(); + $dataSet->setLabel($dataset['label']); + $dataSet->setBackgroundColor($dataset['backgroundColor']); + $dataSet->setBorderColor($dataset['borderColor']); + $dataSet->setPointBackgroundColor($dataset['pointBackgroundColor']); + $dataSet->setPointBorderColor($dataset['pointBorderColor']); + $dataSet->setPointHoverBackgroundColor($dataset['pointHoverBackgroundColor']); + $dataSet->setPointHoverBorderColor($dataset['pointHoverBorderColor']); + $dataSet->data()->exchangeArray($dataset['data']); + $chart->addDataSet($dataSet); + } } break; @@ -1271,7 +1297,10 @@ function get_build_setup_charts($type, $options, $data) break; } - if ($type !== 'RADAR' && $type !== 'LINE') { + if ($type !== 'RADAR' + && $type !== 'LINE' + && ((isset($options['multiple']) === false || empty($options['multiple']) === true)) + ) { $chart->addDataSet($setData); } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 1e89e83243..87b2c9d89e 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -9572,9 +9572,19 @@ div.stat-win-spinner img { } .stat_win_histogram { - width: 95%; margin: 0 auto; - margin-top: 18%; +} + +.bg_general { + background-color: #ffffff; +} + +#tabs-chart-modal { + border: 0px; +} + +#tabs-chart-ul-graphs li a img { + margin-left: 20px; } #stat-win-module-graph .stat_win_histogram div.nodata_container { @@ -12787,3 +12797,22 @@ tr.shown td.details-control { position: relative; top: -92px; } + +.container-periodicity-graph { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + align-content: center; + border: 1px solid #e5e9ed; + border-radius: 10px; + margin-top: 25px; + padding: 10px; +} + +.container-periodicity-graph > div { + flex: 0 0 auto; + width: 100%; + height: 300px; + background-color: transparent; +} diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index a16d4c6e65..0f8b7e707b 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -127,6 +127,7 @@ ui_print_message_dialog( From 863561781567df6bb90a1ec18fe476a1ceba42d9 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Thu, 16 Nov 2023 10:24:03 +0100 Subject: [PATCH 09/47] #12200 The Christmas effect is added after 25 clicks on the about image --- pandora_console/include/functions_menu.php | 3 ++- .../include/javascript/pandora_events.js | 12 ++++++++++++ pandora_console/index.php | 15 +++++++++++---- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 346dee04b5..ac76541162 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -1328,8 +1328,9 @@ if (is_ajax()) { -
+ logo + diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 86b84376c5..4c1364c54c 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -1483,6 +1483,18 @@ function show_dialog(dialog) { }, 50); } +function christmas_click() { + let counter = $("#count_click").val(); + counter++; + $("#count_click").val(counter); + if (counter == 25) { + $("#container-snow").removeClass("invisible"); + setTimeout(() => { + $("#container-snow").addClass("invisible"); + }, 30000); + } +} + /* ############################################################################# ## diff --git a/pandora_console/index.php b/pandora_console/index.php index ff6f27b152..63f063c02d 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1199,7 +1199,7 @@ if ($config['pure'] == 0) { $menuCollapsed = (isset($_SESSION['menu_type']) === true && $_SESSION['menu_type'] !== 'classic'); $menuTypeClass = ($menuCollapsed === true) ? 'collapsed' : 'classic'; // Snow. - $string = '
+ $string = ''; $style = 'font-size: 6pt; display: flex; justify-content: start; - align-items: start; color: #9FA5B1; font-weight: 600;'; - $style_div = $style.' margin-bottom: 5px;'; + align-items: start; color: #9FA5B1; font-weight: 600; + line-height:normal; text-align:left;'; + $style_div = $style.' margin-bottom: 15px;'; // OS description. $output .= html_print_div( @@ -441,7 +442,7 @@ class AgentHive extends Widget 'content' => (empty($data['os_version']) === true) ? ui_print_truncate_text( get_os_name((int) $data['id_os']), - 35, + 32, false, true, true, @@ -450,7 +451,7 @@ class AgentHive extends Widget ) : ui_print_truncate_text( $data['os_version'], - 35, + 32, false, true, true, @@ -475,7 +476,7 @@ class AgentHive extends Widget ), 'style' => 'text-align: left; min-height: 42px; font-size: 8pt; - max-height: 42px; + max-height: 42px; line-height: normal; margin: 2px 0px 2px 0px', ], true From 7e4016579aea0965d4c4abf41915caf28420342e Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 18 Dec 2023 12:47:54 +0100 Subject: [PATCH 44/47] minor change --- .../lib/UpdateManager/Client.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pandora_console/update_manager_client/lib/UpdateManager/Client.php b/pandora_console/update_manager_client/lib/UpdateManager/Client.php index 5bfcedfb64..7a40deea5b 100644 --- a/pandora_console/update_manager_client/lib/UpdateManager/Client.php +++ b/pandora_console/update_manager_client/lib/UpdateManager/Client.php @@ -1460,6 +1460,8 @@ class Client bool $classic=false, bool $called_recursively=false ) :void { + global $config; + if (is_dir($from) !== true || is_readable($from) !== true) { throw new \Exception('Cannot access patch files '.$from); } @@ -1480,9 +1482,20 @@ class Client } // External path to required versions file. - $filepath = $this->tmpDir.'/downloads/'.$version.'/required_um_versions.php'; + $download_filepath = $this->tmpDir.'/downloads/'.$version.'/required_um_versions.php'; - if (file_exists($filepath) === true) { + // Fallback file path in console root. + $local_filepath = $config['homedir'].'/required_um_versions.php'; + + $filepath = null; + + if (file_exists($download_filepath) === true) { + $filepath = $download_filepath; + } else if (file_exists($local_filepath) === true) { + $filepath = $local_filepath; + } + + if ($filepath !== null) { include $filepath; $curr_php_version = phpversion(); From ae43f8a948fd64ead440a6b749a407e967f7b4c8 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 18 Dec 2023 16:29:56 +0100 Subject: [PATCH 45/47] fix rerors selectors pandora_enterprise#12665 --- .../godmode/reporting/graph_builder.php | 30 ++++++++++++++++--- pandora_console/include/functions_modules.php | 6 ++-- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 2e7b1f782e..7524b64861 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -236,17 +236,39 @@ if ($add_module === true) { $id_modules ); - $id_agent_modules = db_get_all_rows_sql( - 'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')" + $sql = sprintf( + 'SELECT id_agente_modulo + FROM tagente_modulo + WHERE id_agente IN (%s) + AND nombre IN ("%s")', + implode(',', $id_agents), + implode('","', $id_modules) ); + $id_agent_modules = db_get_all_rows_sql($sql); + if (count($id_agent_modules) > 0 && $id_agent_modules != '') { - $order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC"); + $sql_order = sprintf( + 'SELECT `field_order` + FROM tgraph_source + WHERE id_graph=%d + ORDER BY `field_order` DESC', + $id_graph + ); + $order = db_get_row_sql($sql_order); $order = $order['field_order']; foreach ($id_agent_modules as $id_agent_module) { $order++; - $result = db_process_sql_insert('tgraph_source', ['id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order]); + $result = db_process_sql_insert( + 'tgraph_source', + [ + 'id_graph' => $id_graph, + 'id_agent_module' => $id_agent_module['id_agente_modulo'], + 'weight' => $weight, + 'field_order' => $order, + ] + ); } } else { $result = false; diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index b5cf42d894..2d3b5676ec 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -3857,11 +3857,11 @@ function get_modules_agents( $modules = array_reduce( $modules, - function ($carry, $item) use ($id_agents, $selection) { + function ($carry, $item) use ($id_agents, $selection, $useName) { if (count($id_agents) > 1 && (bool) $selection === true) { - $carry[$item['id_agente_modulo']] = $item['alias'].' » '.$item['nombre']; + $carry[($useName === true) ? io_safe_output($item['nombre']) : $item['id_agente_modulo']] = $item['alias'].' » '.$item['nombre']; } else { - $carry[$item['id_agente_modulo']] = $item['nombre']; + $carry[($useName === true) ? io_safe_output($item['nombre']) : $item['id_agente_modulo']] = $item['nombre']; } return $carry; From e5b513f018473c068d937cfb0efb08caa31ccffe Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 18 Dec 2023 16:44:27 +0100 Subject: [PATCH 46/47] #12200 Fixed Christmas --- .../lib/TacticalView/GeneralTacticalView.php | 54 ++++++++----------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/pandora_console/include/lib/TacticalView/GeneralTacticalView.php b/pandora_console/include/lib/TacticalView/GeneralTacticalView.php index 6f1add424d..e00bc8fcf8 100644 --- a/pandora_console/include/lib/TacticalView/GeneralTacticalView.php +++ b/pandora_console/include/lib/TacticalView/GeneralTacticalView.php @@ -174,15 +174,14 @@ class GeneralTacticalView if (is_array($user) === true && count($user) > 0) { $name = $user['fullname']; } else { - $name = ''; $name = $user['firstname']; } // 👋 if (empty($name) === true) { - $message = __('Welcome back! 🎅'); + $message = __('Welcome back! 👋'); } else { - $message = __('Welcome back %s! 🎅', $name); + $message = __('Welcome back %s! 👋', $name); } } @@ -226,16 +225,16 @@ class GeneralTacticalView $latitude = $zone_location['latitude']; $emojiOptions = [ - 'have_good_day' => __('Have a good day %s ✌', $name), - 'welcome_back' => __('Welcome back! %s 👋', $name), - 'good_morning' => __('Good morning, %s! ☕', $name), - 'good_evening' => __('Good evening, %s 🌇', $name), - 'good_night' => __('Good night, %s 🌕', $name), - 'happy_summer' => __('Happy summer, %s 🌞', $name), - 'happy_winter' => __('Happy winter, %s ⛄', $name), - 'happy_autumn' => __('Happy autumn, %s 🍂', $name), - 'happy_spring' => __('Happy spring, %s 🌻', $name), - + 'have_good_day' => __('Have a good day %s ✌', $name), + 'welcome_back' => __('Welcome back! %s 👋', $name), + 'merry_christmas' => __('Welcome back! %s 🎅', $name), + 'good_morning' => __('Good morning, %s! ☕', $name), + 'good_evening' => __('Good evening, %s 🌇', $name), + 'good_night' => __('Good night, %s 🌕', $name), + 'happy_summer' => __('Happy summer, %s 🌞', $name), + 'happy_winter' => __('Happy winter, %s ⛄', $name), + 'happy_autumn' => __('Happy autumn, %s 🍂', $name), + 'happy_spring' => __('Happy spring, %s 🌻', $name), ]; // Welcome back. @@ -243,33 +242,17 @@ class GeneralTacticalView $user_last_day = date('d', $user_last_connect); $day = date('d', strtotime('now')); if ($user_last_day === $day) { - if (empty($name) === true) { - $welcome[] = $emojiOptions['welcome_back']; - } else { - $welcome[] = $emojiOptions['welcome_back']; - } + $welcome[] = $emojiOptions['welcome_back']; } // Morning, evening, night. $date = date('H'); if ($date < 13) { - if (empty($name) === true) { - $welcome[] = $emojiOptions['good_morning']; - } else { - $welcome[] = $emojiOptions['good_morning']; - } + $welcome[] = $emojiOptions['good_morning']; } else if ($date < 18) { - if (empty($name) === true) { - $welcome[] = $emojiOptions['good_evening']; - } else { - $welcome[] = $emojiOptions['good_evening']; - } + $welcome[] = $emojiOptions['good_evening']; } else { - if (empty($name) === true) { - $welcome[] = $emojiOptions['good_night']; - } else { - $welcome[] = $emojiOptions['good_night']; - } + $welcome[] = $emojiOptions['good_night']; } // Seasons. @@ -284,6 +267,11 @@ class GeneralTacticalView $welcome[] = $emojiOptions['happy_winter']; } + if ($mes === '12' && $day === '25') { + unset($welcome); + $welcome[] = $emojiOptions['merry_christmas']; + } + $length = count($welcome); $possition = rand(0, ($length - 1)); From 43fbc6eca416f872b08bfec0ec5813dc8bc1f692 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 19 Dec 2023 01:00:37 +0100 Subject: [PATCH 47/47] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.redhat_bin.el8.spec | 2 +- pandora_agents/unix/pandora_agent.redhat_bin.el9.spec | 2 +- pandora_agents/unix/pandora_agent.redhat_bin.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index be8094b102..fbbaa70ba1 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.774-231218 +Version: 7.0NG.774-231219 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 9d6c0e8719..3bf1780faf 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.774-231218" +pandora_version="7.0NG.774-231219" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index a98710e073..4cbd08722d 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.774'; -use constant AGENT_BUILD => '231218'; +use constant AGENT_BUILD => '231219'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index b1471d3140..2e4dded04f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231218 +%define release 231219 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index a95fff30d3..bf5a84479e 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231218 +%define release 231219 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index 5b94d94fe3..23ef1fb028 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231218 +%define release 231219 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index 5c77447573..ccd955eaa3 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231218 +%define release 231219 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index d90a5079b3..c72125ad5b 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231218 +%define release 231219 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 477c0449e0..1360edcbbe 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.774" -PI_BUILD="231218" +PI_BUILD="231219" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 889112a68a..444a657d98 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{231218} +{231219} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 14af1b14ff..8a7783a7ba 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.774 Build 231218") +#define PANDORA_VERSION ("7.0NG.774 Build 231219") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d2723120d4..3ee212d8ba 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.774(Build 231218))" + VALUE "ProductVersion", "(7.0NG.774(Build 231219))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index bd02826e00..635749427a 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.774-231218 +Version: 7.0NG.774-231219 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 8392569d90..7a1099c7bc 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.774-231218" +pandora_version="7.0NG.774-231219" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index a204114cde..b4b84339cd 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC231218'; +$build_version = 'PC231219'; $pandora_version = 'v7.0NG.774'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 9a0df5bbbf..50fc5ee94e 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 8370a229c1..73c27df5ef 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -7,7 +7,7 @@ %define debug_package %{nil} %define name pandorafms_server %define version 7.0NG.774 -%define release 231218 +%define release 231219 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index d505b3d685..a12f69f8f2 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.774 -%define release 231218 +%define release 231219 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 6a4020f1db..24e91a5a8e 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.774" -PI_BUILD="231218" +PI_BUILD="231219" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index fec820a29a..117580ee48 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -38,7 +38,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.774 Build 231218"; +my $version = "7.0NG.774 Build 231219"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index b504e9fbc0..eec8cb4cb9 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.774 Build 231218"; +my $version = "7.0NG.774 Build 231219"; # save program name for logging my $progname = basename($0);