diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 0ee00a8f17..43f8a477da 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190214 +Version: 7.0NG.731-190219 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 9ebfc5d3dc..47e51c22e1 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.731-190214" +pandora_version="7.0NG.731-190219" 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 664a9964e3..6d3983758e 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190214'; +use constant AGENT_BUILD => '190219'; # 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 5c097c9a07..076a9ef928 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190214 +%define release 190219 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 820f5d3ec1..394ac97c05 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190214 +%define release 190219 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 8adeac4f7a..c16a74273a 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190214" +PI_BUILD="190219" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 3b606d8ec0..fb99d6c15f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190214} +{190219} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 30fff5f13b..2abbc0a7b3 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.731(Build 190214)") +#define PANDORA_VERSION ("7.0NG.731(Build 190219)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a34c9905ea..bc770967dd 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190214))" + VALUE "ProductVersion", "(7.0NG.731(Build 190219))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 285b64c80f..a7a372a3dd 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190214 +Version: 7.0NG.731-190219 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 02c1b2ed71..fd52973ced 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.731-190214" +pandora_version="7.0NG.731-190219" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index 4a9130a3db..1a505538ed 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -328,4 +328,3 @@ function mainModuleGroups() extensions_add_operation_menu_option(__('Module groups'), 'estado', 'module_groups/brick.png', 'v1r1', 'view'); extensions_add_main_function('mainModuleGroups'); - diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 4a0b32de81..519b4b32a5 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -137,8 +137,8 @@ function get_logs_size($file) function get_status_logs($path) { $status_server_log = ''; - $size_server_log = get_logs_size($path); - if ($size_server_log <= 10240) { + $size_server_log = number_format(get_logs_size($path)); + if ($size_server_log <= 1048576) { $status_server_log = "Normal Status   You have less than 10 MB of logs"; } else { $status_server_log = "Warning Status   You have more than 10 MB of logs"; @@ -412,11 +412,7 @@ render_info_data( render_info_data('SELECT COUNT(*) FROM tagente_modulo', 'Total modules'); render_info_data('SELECT COUNT(*) FROM tgrupo', 'Total groups'); render_info_data('SELECT COUNT(*) FROM tagente_datos', 'Total module data records'); - // render_info_data ("SELECT COUNT(*) FROM tagente_datos_string","Total module string data records"); - // render_info_data ("SELECT COUNT(*) FROM tagente_datos_log4x","Total module log4x data records"); render_info_data('SELECT COUNT(*) FROM tagent_access', 'Total agent access record'); - // render_info ("tagente_estado"); - // render_info ("talert_template_modules"); render_info_data('SELECT COUNT(*) FROM tevento', 'Total events'); if ($config['enterprise_installed']) { @@ -700,7 +696,7 @@ render_info_data( render_row(status_values($read_rnd_buffer_size_min_rec_value, $read_rnd_buffer_size), 'Read rnd-buffer size ', 'Read rnd-buffer size '); render_row(status_values($query_cache_min_res_unit_min_rec_value, $query_cache_min_res_unit), 'Query cache min-res-unit ', 'Query cache min-res-unit '); render_row(status_values($innodb_file_per_table_min_rec_value, $innodb_file_per_table), 'InnoDB file per table ', 'InnoDB file per table '); - echo "".__('Tables fragmentation in the PandoraFMS database').''; + echo "".__('Tables fragmentation in the Pandora FMS database').''; @@ -708,14 +704,14 @@ render_info_data( render_row(number_format($tables_fragmentation, 2).'%', 'Tables fragmentation (current value)'); render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Status fragmentation tables'); - echo "".__(' PandoraFMS logs dates').''; + echo "".__(' Pandora FMS logs dates').''; - render_row(number_format((get_logs_size($path_server_logs) / 1024), 2).'M', 'Size server logs (current value)'); + render_row(number_format((get_logs_size($path_server_logs) / 1048576), 3).'M', 'Size server logs (current value)'); render_row(get_status_logs($path_server_logs), 'Status server logs'); - render_row(number_format((get_logs_size($path_console_logs) / 1024), 2).'M', 'Size console logs (current value)'); + render_row(number_format((get_logs_size($path_console_logs) / 1048576), 3).'M', 'Size console logs (current value)'); render_row(get_status_logs($path_console_logs), 'Status console logs'); - echo "".__(' PandoraFMS Licence Information').''; + echo "".__(' Pandora FMS Licence Information').''; render_row(html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true), 'Customer key'); render_row($license['expiry_date'], 'Expires'); diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 004c947af4..f511304d8a 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -236,7 +236,7 @@ if ($new_agent) { } $table->data[2][0] = __('IP Address'); -$table->data[2][1] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true); +$table->data[2][1] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true).html_print_checkbox('unique_ip', 1, $config['unique_ip'], true).__('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true); if ($id_agente) { $table->data[2][1] .= '    '; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index dfa28988a8..071f6a8ae0 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -81,6 +81,7 @@ $alias_as_name = 0; $direccion_agente = get_parameter('direccion', ''); $direccion_agente = trim(io_safe_output($direccion_agente)); $direccion_agente = io_safe_input($direccion_agente); +$unique_ip = 0; $intervalo = SECONDS_5MINUTES; $ff_interval = 0; $quiet_module = 0; @@ -161,6 +162,7 @@ if ($create_agent) { $alias = (string) get_parameter_post('alias', ''); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); $direccion_agente = (string) get_parameter_post('direccion', ''); + $unique_ip = (int) get_parameter_post('unique_ip', 0); // safe_output only validate ip $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -216,7 +218,12 @@ if ($create_agent) { $nombre_agente = $alias; } - if (!$exists_alias) { + if ($unique_ip && $direccion_agente != '') { + $sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"'; + $exists_ip = db_get_row_sql($sql); + } + + if (!$exists_alias && !$exists_ip) { $id_agente = db_process_sql_insert( 'tagente', [ @@ -326,6 +333,8 @@ if ($create_agent) { $agent_creation_error = __('Could not be created'); if ($exists_alias) { $agent_creation_error = __('Could not be created, because name already exists'); + } else if ($exists_ip) { + $agent_creation_error = __('Could not be created, because IP already exists'); } } } @@ -758,6 +767,7 @@ if ($update_agent) { $alias = str_replace('`', '‘', (string) get_parameter_post('alias', '')); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); $direccion_agente = (string) get_parameter_post('direccion', ''); + $unique_ip = (int) get_parameter_post('unique_ip', 0); // safe_output only validate ip $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -860,8 +870,15 @@ if ($update_agent) { // If there is an agent with the same name, but a different ID } + if ($unique_ip && $direccion_agente != '') { + $sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"'; + $exists_ip = db_get_row_sql($sql); + } + if ($grupo <= 0) { ui_print_error_message(__('The group id %d is incorrect.', $grupo)); + } else if ($exists_ip) { + ui_print_error_message(__('Duplicate main IP address')); } else { // If different IP is specified than previous, add the IP if ($direccion_agente != '' diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 38584d6b6a..aef5ac71a2 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2720,7 +2720,7 @@ function edit_custom_graph() { } }); - window.location.href = server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data; + window.location.href = server_url + "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index abab21b8fe..fa3e720a00 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1116,8 +1116,13 @@ switch ($action) { $name_it = (string) get_parameter('name'); $values['name'] = reporting_label_macro($items_label, $name_it); - // Added support for projection graphs, prediction date and SLA reports - // 'top_n_value','top_n' and 'text' fields will be reused for these types of report + /* + Added support for projection graphs, + prediction date and SLA reports + 'top_n_value','top_n' and 'text' + fields will be reused for these types of report + */ + switch ($values['type']) { case 'projection_graph': $values['period'] = get_parameter('period1'); @@ -1127,7 +1132,8 @@ switch ($action) { break; case 'event_report_log': - $agents_to_report = get_parameter('id_agents2'); + + $agents_to_report = get_parameter('id_agents3'); $source = get_parameter('source', ''); $search = get_parameter('search', ''); $log_number = get_parameter('log_number', ''); @@ -1525,7 +1531,7 @@ switch ($action) { break; case 'event_report_log': - $agents_to_report = get_parameter('id_agents2'); + $agents_to_report = get_parameter('id_agents3'); $source = get_parameter('source', ''); $search = get_parameter('search', ''); $log_number = get_parameter('log_number', ''); diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index f8d53e722f..9e663e63cc 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -1,37 +1,242 @@ width = '100%'; +$table_status->class = 'databox filters'; +$table_status->style[0] = 'font-weight: bold'; +$table_status->size[0] = '10%'; + +$table_status->data = []; + +$sql = "SELECT UNIX_TIMESTAMP(NOW()) - `value` AS updated_at + FROM tconfig + WHERE token = 'db_maintance'"; + +$time_pandora_db_active = db_get_sql($sql); + + +if ($time_pandora_db_active < SECONDS_12HOURS) { + $table_status->data[0][0] = html_print_image( + 'images/dot_green.png', + true + ); +} else { + $table_status->data[0][0] = html_print_image( + 'images/dot_red.png', + true + ); +} + +$table_status->data[0][0] .= ' '.__('Pandora_db running in active database.'); +$table_status->data[0][0] .= ' '.__('Executed:').' '; +$table_status->data[0][0] .= human_time_description_raw( + $time_pandora_db_active, + true +); + +$table_status->data[0][0] .= ' '.__('ago').'.'; + +if ($config['history_db_enabled'] == 1) { + if (! isset($config['history_db_connection']) + || $config['history_db_connection'] === false + ) { + $config['history_db_connection'] = db_connect( + $config['history_db_host'], + $config['history_db_name'], + $config['history_db_user'], + io_output_password($config['history_db_pass']), + $config['history_db_port'], + false + ); + } + + $history_connect = @mysql_db_process_sql( + 'SELECT 1 FROM tconfig', + 'affected_rows', + $config['history_db_connection'], + false + ); + + $time_pandora_db_history = false; + if ($history_connect !== false) { + if ($config['history_db_connection'] !== false) { + $time_pandora_db_history = mysql_db_process_sql( + $sql, + 'insert_id', + $config['history_db_connection'], + false + ); + } + } + + if ($time_pandora_db_history !== false + && $time_pandora_db_history[0]['updated_at'] < SECONDS_12HOURS + ) { + $table_status->data[1][0] = html_print_image( + 'images/dot_green.png', + true + ); + } else { + $table_status->data[1][0] = html_print_image( + 'images/dot_red.png', + true + ); + } + + $table_status->data[1][0] .= ' '.__('Pandora_db running in historical database.'); + $table_status->data[1][0] .= ' '.__('Executed:').' '; + if ($time_pandora_db_history !== false) { + $table_status->data[1][0] .= human_time_description_raw( + $time_pandora_db_history[0]['updated_at'], + true + ).' '.__('ago').'.'; + } else { + $table_status->data[1][0] .= __('not executed'); + } +} - Update operation is done in config_process.php - This is done in that way so the user can see the changes inmediatly. - If you added a new token, please check config_update_config() in functions_config.php - to add it there. -*/ $table = new StdClass(); $table->width = '100%'; @@ -44,42 +249,279 @@ $table->size[1] = '30%'; enterprise_hook('enterprise_warnings_history_days'); -$table->data[1][0] = __('Max. days before delete events').ui_print_help_tip(__('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), true); -$table->data[1][1] = html_print_input_text('event_purge', $config['event_purge'], '', 5, 5, true); +$table->data[1][0] = __('Max. days before delete events'); +$table->data[1][0] .= ui_print_help_tip( + __('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), + true +); + +$table->data[1][1] = html_print_input_text( + 'event_purge', + $config['event_purge'], + '', + 5, + 5, + true +); $table->data[2][0] = __('Max. days before delete traps'); -$table->data[2][1] = html_print_input_text('trap_purge', $config['trap_purge'], '', 5, 5, true); +$table->data[2][1] = html_print_input_text( + 'trap_purge', + $config['trap_purge'], + '', + 5, + 5, + true +); $table->data[3][0] = __('Max. days before delete audit events'); -$table->data[3][1] = html_print_input_text('audit_purge', $config['audit_purge'], '', 5, 5, true); +$table->data[3][1] = html_print_input_text( + 'audit_purge', + $config['audit_purge'], + '', + 5, + 5, + true +); $table->data[4][0] = __('Max. days before delete string data'); -$table->data[4][1] = html_print_input_text('string_purge', $config['string_purge'], '', 5, 5, true); +$table->data[4][1] = html_print_input_text( + 'string_purge', + $config['string_purge'], + '', + 5, + 5, + true +); $table->data[5][0] = __('Max. days before delete GIS data'); -$table->data[5][1] = html_print_input_text('gis_purge', $config['gis_purge'], '', 5, 5, true); +$table->data[5][1] = html_print_input_text( + 'gis_purge', + $config['gis_purge'], + '', + 5, + 5, + true +); -$table->data[6][0] = __('Max. days before purge').ui_print_help_tip(__('Configure a purge period more frequent than a compact data period has no sense'), true); -$table->data[6][1] = html_print_input_text('days_purge', $config['days_purge'], '', 5, 5, true); +$table->data[6][0] = __('Max. days before purge'); +$table->data[6][0] .= ui_print_help_tip( + __('Configure a purge period more frequent than a compact data period has no sense'), + true +); +$table->data[6][1] = html_print_input_text( + 'days_purge', + $config['days_purge'], + '', + 5, + 5, + true +); $table->data[7][0] = __('Max. days before compact data'); -$table->data[7][1] = html_print_input_text('days_compact', $config['days_compact'], '', 5, 5, true); +$table->data[7][1] = html_print_input_text( + 'days_compact', + $config['days_compact'], + '', + 5, + 5, + true +); $table->data[8][0] = __('Max. days before delete unknown modules'); -$table->data[8][1] = html_print_input_text('days_delete_unknown', $config['days_delete_unknown'], '', 5, 5, true); +$table->data[8][1] = html_print_input_text( + 'days_delete_unknown', + $config['days_delete_unknown'], + '', + 5, + 5, + true +); $table->data[9][0] = __('Max. days before delete autodisabled agents'); -$table->data[9][1] = html_print_input_text('days_autodisable_deletion', $config['days_autodisable_deletion'], '', 5, 5, true); +$table->data[9][1] = html_print_input_text( + 'days_autodisable_deletion', + $config['days_autodisable_deletion'], + '', + 5, + 5, + true +); -$table->data[10][0] = __('Retention period of past special days').ui_print_help_tip(__('This number is days to keep past special days. 0 means never remove.'), true); -$table->data[10][1] = html_print_input_text('num_past_special_days', $config['num_past_special_days'], '', 5, 5, true); +$table->data[10][0] = __('Retention period of past special days'); +$table->data[10][0] .= ui_print_help_tip( + __('This number is days to keep past special days. 0 means never remove.'), + true +); +$table->data[10][1] = html_print_input_text( + 'num_past_special_days', + $config['num_past_special_days'], + '', + 5, + 5, + true +); -$table->data[11][0] = __('Max. macro data fields').ui_print_help_tip(__('Number of macro fields in alerts and templates between 1 and 15'), true); -$table->data[11][1] = html_print_input_text('max_macro_fields', $config['max_macro_fields'], '', 5, 5, true, false, false, 'onChange="change_macro_fields()"'); +$table->data[11][0] = __('Max. macro data fields'); +$table->data[11][0] .= ui_print_help_tip( + __('Number of macro fields in alerts and templates between 1 and 15'), + true +); +$table->data[11][1] = html_print_input_text( + 'max_macro_fields', + $config['max_macro_fields'], + '', + 5, + 5, + true, + false, + false, + 'onChange="change_macro_fields()"' +); if (enterprise_installed()) { $table->data[12][0] = __('Max. days before delete inventory data'); - $table->data[12][1] = html_print_input_text('inventory_purge', $config['inventory_purge'], '', 5, 5, true); + $table->data[12][1] = html_print_input_text( + 'inventory_purge', + $config['inventory_purge'], + '', + 5, + 5, + true + ); +} + +if ($config['history_db_enabled'] == 1) { + if (! isset($config['history_db_connection']) + || $config['history_db_connection'] === false + ) { + $config['history_db_connection'] = db_connect( + $config['history_db_host'], + $config['history_db_name'], + $config['history_db_user'], + io_output_password($config['history_db_pass']), + $config['history_db_port'], + false + ); + } + + $history_connect = @mysql_db_process_sql( + 'SELECT 1 FROM tconfig', + 'affected_rows', + $config['history_db_connection'], + false + ); + + $config_history = false; + if ($history_connect !== false) { + if ($config['history_db_connection'] != false) { + $config_history_array = mysql_db_process_sql( + 'SELECT * FROM tconfig', + 'affected_rows', + $config['history_db_connection'], + false + ); + + if (isset($config_history_array) && is_array($config_history_array)) { + foreach ($config_history_array as $key => $value) { + $config_history[$value['token']] = $value['value']; + } + } + } + } else { + echo ui_print_error_message( + __('The tconfig table does not exist in the historical database') + ); + } + + if ($config_history === false) { + $config_history = []; + $config_history['days_purge'] = 180; + $config_history['days_compact'] = 120; + $config_history['step_compact'] = 1; + $config_history['event_purge'] = 180; + $config_history['string_purge'] = 180; + } + + $table_historical = new StdClass(); + $table_historical->width = '100%'; + $table_historical->class = 'databox filters'; + $table_historical->data = []; + $table_historical->style[0] = 'font-weight: bold'; + + $table_historical->size[0] = '70%'; + $table_historical->size[1] = '30%'; + + enterprise_hook('enterprise_warnings_history_days'); + + $table_historical->data[0][0] = __('Max. days before purge'); + $table_historical->data[0][0] .= ui_print_help_tip( + __('Configure a purge period more frequent than a compact data period has no sense'), + true + ); + $table_historical->data[0][1] = html_print_input_text( + 'historical_days_purge', + $config_history['days_purge'], + '', + 5, + 5, + true + ); + + $table_historical->data[1][0] = __('Max. days before compact data'); + $table_historical->data[1][1] = html_print_input_text( + 'historical_days_compact', + $config_history['days_compact'], + '', + 5, + 5, + true + ); + + $table_historical->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); + $table_historical->data[2][0] .= ui_print_help_tip( + __('Data will be compacted in intervals of the specified length.'), + true + ); + $table_historical->data[2][1] = html_print_input_text( + 'historical_step_compact', + $config_history['step_compact'], + '', + 5, + 5, + true + ); + + $table_historical->data[3][0] = __('Max. days before delete events'); + $table_historical->data[3][0] .= ui_print_help_tip( + __('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), + true + ); + + $table_historical->data[3][1] = html_print_input_text( + 'historical_event_purge', + $config_history['event_purge'], + '', + 5, + 5, + true + ); + + $table_historical->data[4][0] = __('Max. days before delete string data'); + $table_historical->data[4][1] = html_print_input_text( + 'historical_string_purge', + $config_history['string_purge'], + '', + 5, + 5, + true + ); + + $table_historical->data[4][1] .= html_print_input_hidden( + 'historical_history_db_enabled', + 0, + true + ); } $table_other = new stdClass(); @@ -91,7 +533,11 @@ $table_other->style[0] = 'font-weight: bold'; $table_other->size[0] = '70%'; $table_other->size[1] = '30%'; -$table_other->data[1][0] = __('Item limit for realtime reports').ui_print_help_tip(__('Set a value too high cause a slowdown on console and a performance penalty in the system.'), true); +$table_other->data[1][0] = __('Item limit for realtime reports'); +$table_other->data[1][0] .= ui_print_help_tip( + __('Set a value too high cause a slowdown on console and a performance penalty in the system.'), + true +); $table_other->data[1][1] = html_print_input_text( 'report_limit', $config['report_limit'], @@ -101,7 +547,11 @@ $table_other->data[1][1] = html_print_input_text( true ); -$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)').ui_print_help_tip(__('Data will be compacted in intervals of the specified length.'), true); +$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); +$table_other->data[2][0] .= ui_print_help_tip( + __('Data will be compacted in intervals of the specified length.'), + true +); $table_other->data[2][1] = html_print_input_text( 'step_compact', $config['step_compact'], @@ -122,46 +572,131 @@ $intervals[SECONDS_2WEEK] = __('2 weeks'); $intervals[SECONDS_1MONTH] = __('Last month'); $table_other->data[3][0] = __('Default hours for event view'); -$table_other->data[3][1] = html_print_input_text('event_view_hr', $config['event_view_hr'], '', 5, 5, true); +$table_other->data[3][1] = html_print_input_text( + 'event_view_hr', + $config['event_view_hr'], + '', + 5, + 5, + true +); $table_other->data[5][0] = __('Use realtime statistics'); -$table_other->data[5][1] = html_print_checkbox_toogle_switch('realtimestats', 1, $config['realtimestats'], true); +$table_other->data[5][1] = html_print_checkbox_toogle_switch( + 'realtimestats', + 1, + $config['realtimestats'], + true +); -$table_other->data[6][0] = __('Batch statistics period (secs)').ui_print_help_tip(__('If realtime statistics are disabled, statistics interval resfresh will be set here.'), true); -$table_other->data[6][1] = html_print_input_text('stats_interval', $config['stats_interval'], '', 5, 5, true); +$table_other->data[6][0] = __('Batch statistics period (secs)'); +$table_other->data[6][0] .= ui_print_help_tip( + __('If realtime statistics are disabled, statistics interval resfresh will be set here.'), + true +); +$table_other->data[6][1] = html_print_input_text( + 'stats_interval', + $config['stats_interval'], + '', + 5, + 5, + true +); $table_other->data[7][0] = __('Use agent access graph').ui_print_help_icon('agent_access', true); $table_other->data[7][1] = html_print_checkbox_toogle_switch('agentaccess', 1, $config['agentaccess'], true); -$table_other->data[8][0] = __('Max. recommended number of files in attachment directory').ui_print_help_tip(__('This number is the maximum number of files in attachment directory. If this number is reached then a warning message will appear in the header notification space.'), true); -$table_other->data[8][1] = html_print_input_text('num_files_attachment', $config['num_files_attachment'], '', 5, 5, true); +$table_other->data[8][0] = __('Max. recommended number of files in attachment directory'); +$table_other->data[8][0] .= ui_print_help_tip( + __('This number is the maximum number of files in attachment directory. If this number is reached then a warning message will appear in the header notification space.'), + true +); +$table_other->data[8][1] = html_print_input_text( + 'num_files_attachment', + $config['num_files_attachment'], + '', + 5, + 5, + true +); $table_other->data[9][0] = __('Delete not init modules'); $table_other->data[9][1] = html_print_checkbox_toogle_switch('delete_notinit', 1, $config['delete_notinit'], true); -$table_other->data[10][0] = __('Big Operation Step to purge old data').ui_print_help_tip(__('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'), true); -$table_other->data[10][1] = html_print_input_text('big_operation_step_datos_purge', $config['big_operation_step_datos_purge'], '', 5, 5, true); +$table_other->data[10][0] = __('Big Operation Step to purge old data'); +$table_other->data[10][0] .= ui_print_help_tip( + __('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'), + true +); +$table_other->data[10][1] = html_print_input_text( + 'big_operation_step_datos_purge', + $config['big_operation_step_datos_purge'], + '', + 5, + 5, + true +); -$table_other->data[11][0] = __('Small Operation Step to purge old data').ui_print_help_tip(__('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'), true); -$table_other->data[11][1] = html_print_input_text('small_operation_step_datos_purge', $config['small_operation_step_datos_purge'], '', 5, 5, true); +$table_other->data[11][0] = __('Small Operation Step to purge old data'); +$table_other->data[11][0] .= ui_print_help_tip( + __('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'), + true +); +$table_other->data[11][1] = html_print_input_text( + 'small_operation_step_datos_purge', + $config['small_operation_step_datos_purge'], + '', + 5, + 5, + true +); -$table_other->data[12][0] = __('Graph container - Max. Items').ui_print_help_tip(__('The number of graphs that are viewed in a container. Default is 10 .Increasing this number could lead to performance problems'), true); -$table_other->data[12][1] = html_print_input_text('max_graph_container', $config['max_graph_container'], '', 5, 5, true); +$table_other->data[12][0] = __('Graph container - Max. Items'); +$table_other->data[12][0] .= ui_print_help_tip( + __('The number of graphs that are viewed in a container. Default is 10 .Increasing this number could lead to performance problems'), + true +); +$table_other->data[12][1] = html_print_input_text( + 'max_graph_container', + $config['max_graph_container'], + '', + 5, + 5, + true +); echo '
'; + echo '
'; -echo ''.__('Database maintenance options').''; -html_print_input_hidden('update_config', 1); -html_print_table($table); + echo ''.__('Database maintenance status').''; + html_print_table($table_status); echo '
'; echo '
'; -echo ''.__('Others').''; -html_print_input_hidden('update_config', 1); -html_print_table($table_other); + echo ''.__('Database maintenance options').''; + html_print_table($table); echo '
'; + +if ($config['history_db_enabled'] == 1) { + echo '
'; + echo ''.__('Historical database maintenance options').''; + html_print_table($table_historical); + echo '
'; +} + +echo '
'; + echo ''.__('Others').''; + html_print_table($table_other); +echo '
'; + echo '
'; -html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); +html_print_input_hidden('update_config', 1); +html_print_submit_button( + __('Update'), + 'update_button', + false, + 'class="sub upd"' +); echo '
'; echo '
'; ?> @@ -170,7 +705,6 @@ echo ''; function change_macro_fields() { var value = $("#text-max_macro_fields").val(); - console.log(value); if (value <= 0) { $("#text-max_macro_fields").val(1); } diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index f5f229ddd5..7f88982a14 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -1,17 +1,32 @@ false, 'text' => ''.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'', @@ -114,6 +129,7 @@ if (enterprise_installed()) { switch ($section) { case 'general': + default: $buttons['general']['active'] = true; $subpage = ' » '.__('General'); break; @@ -145,7 +161,7 @@ switch ($section) { break; } -// Header +// Header. ui_print_page_header(__('Configuration').$subpage, '', false, $help_header, true, $buttons); if (isset($config['error_config_update_config'])) { diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 8196d98873..82899cde6b 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -269,7 +269,13 @@ $table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory $table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true); $table->data[38][0] = __('Set alias as name by default in agent creation'); -$table->data[38][1] = html_print_checkbox_toogle_switch('alias_as_name', 1, $config['alias_as_name'], true); +$table->data[38][1] = __('Yes').'   '.html_print_radio_button('alias_as_name', 1, '', $config['alias_as_name'], true).'  '; +$table->data[38][1] .= __('No').'   '.html_print_radio_button('alias_as_name', 0, '', $config['alias_as_name'], true); + +$table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true); +$table->data[39][1] = __('Yes').'   '.html_print_radio_button('unique_ip', 1, '', $config['unique_ip'], true).'  '; +$table->data[39][1] .= __('No').'   '.html_print_radio_button('unique_ip', 0, '', $config['unique_ip'], true); + echo '
'; echo '
'; @@ -332,6 +338,11 @@ $(document).ready (function () { $("#zone").attr("hidden", false); $("#timezone").attr("hidden", false); }); + + if ($("input[name=use_cert]").is(':checked')) { + $('#setup_general-13').show(); + } + $("input[name=use_cert]").change(function () { if( $(this).is(":checked") ) $('#setup_general-13').show(); diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php index a5737ea71e..55ed7dd216 100755 --- a/pandora_console/include/ajax/reporting.ajax.php +++ b/pandora_console/include/ajax/reporting.ajax.php @@ -198,12 +198,7 @@ if ($get_metaconsole_hash_data) { $console_password = $auth_serialized['console_password']; } - $pwd = $auth_token; - // Create HASH login info - $user = str_rot13($config['id_user']); - $hashdata = $user.$pwd; - $hashdata = md5($hashdata); - $url_hash = "&loginhash=auto&loginhash_data=$hashdata&loginhash_user=$user"; + $url_hash = metaconsole_get_servers_url_hash($server); echo $url_hash; return; diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php index 96124afa4c..e7133fd79e 100644 --- a/pandora_console/include/chart_generator.php +++ b/pandora_console/include/chart_generator.php @@ -88,16 +88,13 @@ if (file_exists('languages/'.$user_language.'.mo')) { $params['menu'] = false; if ((!isset($params['width']) || ($params['width'] <= 0))) { - $params['width'] = 1048; + $params['width'] = 650; } $params_combined = json_decode($_REQUEST['data_combined'], true); $module_list = json_decode($_REQUEST['data_module_list'], true); $type_graph_pdf = $_REQUEST['type_graph_pdf']; - $aux_font_size = $config['font_size']; - $config['font_size'] = ($config['font_size'] + 3); - echo '
'; switch ($type_graph_pdf) { case 'combined': @@ -216,7 +213,6 @@ if (file_exists('languages/'.$user_language.'.mo')) { echo '
'; - $config['font_size'] = $aux_font_size; ?> '; + '; } @@ -2322,10 +2856,31 @@ function reporting_html_text(&$table, $item) } -function reporting_html_availability(&$table, $item) +/** + * Report availability + * + * @param string $table Reference table in pdf a false. + * @param array $item Parameters for item pdf. + * @param boolean $pdf Send pdf. + * + * @return html + */ +function reporting_html_availability($table, $item, $pdf=0) { - $style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']); - $style = json_decode(io_safe_output($style), true); + $retun_pdf = ''; + + $style = db_get_value( + 'style', + 'treport_content', + 'id_rc', + $item['id_rc'] + ); + + $style = json_decode( + io_safe_output($style), + true + ); + $same_agent_in_resume = ''; global $config; @@ -2338,7 +2893,7 @@ function reporting_html_availability(&$table, $item) $table1->head = []; $table1->head[0] = __('Agent'); // HACK it is saved in show_graph field. - // Show interfaces instead the modules + // Show interfaces instead the modules. if ($item['kind_availability'] == 'address') { $table1->head[1] = __('IP Address'); } else { @@ -2381,7 +2936,7 @@ function reporting_html_availability(&$table, $item) $table2->head = []; $table2->head[0] = __('Agent'); // HACK it is saved in show_graph field. - // Show interfaces instead the modules + // Show interfaces instead the modules. if ($item['kind_availability'] == 'address') { $table2->head[1] = __('IP Address'); } else { @@ -2392,7 +2947,7 @@ function reporting_html_availability(&$table, $item) $table2->head[3] = __('Checks failed'); $table2->head[4] = __('Checks OK'); $table2->head[5] = __('Checks Uknown'); - // $table2->head[6] = __('% Ok'); + $table2->headstyle = []; $table2->headstyle[0] = 'text-align: left'; $table2->headstyle[1] = 'text-align: left'; @@ -2400,53 +2955,73 @@ function reporting_html_availability(&$table, $item) $table2->headstyle[3] = 'text-align: right'; $table2->headstyle[4] = 'text-align: right'; $table2->headstyle[5] = 'text-align: right'; - // $table2->headstyle[6] = 'text-align: right'; + $table2->style[0] = 'text-align: left'; $table2->style[1] = 'text-align: left'; $table2->style[2] = 'text-align: right'; $table2->style[3] = 'text-align: right'; $table2->style[4] = 'text-align: right'; $table2->style[5] = 'text-align: right'; - // $table2->style[6] = 'text-align: right'; + foreach ($item['data'] as $row) { - $the_first_men_time = get_agent_first_time(io_safe_output($row['agent'])); + $the_first_men_time = get_agent_first_time( + io_safe_output($row['agent']) + ); $table_row = []; $table_row[] = $row['agent']; $table_row[] = $row['availability_item']; if ($row['time_total'] != 0) { - $table_row[] = human_time_description_raw($row['time_total'], true); + $table_row[] = human_time_description_raw( + $row['time_total'], + true + ); } else { $table_row[] = '--'; } if ($row['time_error'] != 0) { - $table_row[] = human_time_description_raw($row['time_error'], true); + $table_row[] = human_time_description_raw( + $row['time_error'], + true + ); } else { $table_row[] = '--'; } if ($row['time_ok'] != 0) { - $table_row[] = human_time_description_raw($row['time_ok'], true); + $table_row[] = human_time_description_raw( + $row['time_ok'], + true + ); } else { $table_row[] = '--'; } if ($row['time_unknown'] != 0) { - $table_row[] = human_time_description_raw($row['time_unknown'], true); + $table_row[] = human_time_description_raw( + $row['time_unknown'], + true + ); } else { $table_row[] = '--'; } if ($row['time_not_init'] != 0) { - $table_row[] = human_time_description_raw($row['time_not_init'], true); + $table_row[] = human_time_description_raw( + $row['time_not_init'], + true + ); } else { $table_row[] = '--'; } if ($row['time_downtime'] != 0) { - $table_row[] = human_time_description_raw($row['time_downtime'], true); + $table_row[] = human_time_description_raw( + $row['time_downtime'], + true + ); } else { $table_row[] = '--'; } @@ -2469,16 +3044,30 @@ function reporting_html_availability(&$table, $item) $table->data['error']['cell'] = __('There are no Agent/Modules defined'); } - $table->colspan[1][0] = 2; - $table->colspan[2][0] = 2; - $data = []; - $data[0] = html_print_table($table1, true); - array_push($table->data, $data); + if ($pdf === 0) { + $table->colspan[1][0] = 2; + $table->colspan[2][0] = 2; + $data = []; + $data[0] = html_print_table($table1, true); + array_push($table->data, $data); + } else { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table1, true); + } if ($item['resume']['resume']) { - $data2 = []; - $data2[0] = html_print_table($table2, true); - array_push($table->data, $data2); + if ($pdf === 0) { + $data2 = []; + $data2[0] = html_print_table($table2, true); + array_push($table->data, $data2); + } else { + $table2->title = $item['title']; + $table2->titleclass = 'title_table_pdf'; + $table2->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table2, true); + } } if ($item['resume']['resume'] && !empty($item['data'])) { @@ -2508,27 +3097,60 @@ function reporting_html_availability(&$table, $item) $table1->data[] = [ 'max_text' => $item['resume']['max_text'], - 'max' => sla_truncate($item['resume']['max'], $config['graph_precision']).'%', + 'max' => sla_truncate( + $item['resume']['max'], + $config['graph_precision'] + ).'%', 'min_text' => $item['resume']['min_text'], - 'min' => sla_truncate($item['resume']['min'], $config['graph_precision']).'%', + 'min' => sla_truncate( + $item['resume']['min'], + $config['graph_precision'] + ).'%', 'avg' => ''.sla_truncate($item['resume']['avg'], $config['graph_precision']).'%', ]; - $table->colspan[3][0] = 3; - $data = []; - $data[0] = html_print_table($table1, true); - array_push($table->data, $data); + if ($pdf === 0) { + $table->colspan[3][0] = 3; + $data = []; + $data[0] = html_print_table( + $table1, + true + ); + array_push($table->data, $data); + } else { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table1, + true + ); + } } } + + if ($pdf !== 0) { + return $return_pdf; + } } -function reporting_html_availability_graph(&$table, $item, $pdf=0) +/** + * The availability report shows in detail the reached + * status of a module in a given time interval. + * + * @param string $table Reference table in pdf a false. + * @param array $item Parameters for item pdf. + * @param boolean $pdf Send pdf. + * + * @return html + */ +function reporting_html_availability_graph($table, $item, $pdf=0) { global $config; $metaconsole_on = is_metaconsole(); - if ($metaconsole_on) { + if ($metaconsole_on !== false) { $hack_metaconsole = '../../'; } else { $hack_metaconsole = ''; @@ -2570,7 +3192,10 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) break; } - $sla_value = sla_truncate($chart['sla_value'], $config['graph_precision']).'%'; + $sla_value = sla_truncate( + $chart['sla_value'], + $config['graph_precision'] + ).'%'; $checks_resume = '('.$chart['checks_ok'].'/'.$chart['checks_total'].')'; } @@ -2578,11 +3203,14 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) $table1->data[0][1] = $chart['chart']; $table1->data[0][2] = "".$sla_value.''; $table1->data[0][3] = $checks_resume; - $tables_chart .= html_print_table($table1, true); + $tables_chart .= html_print_table( + $table1, + true + ); } if ($item['type'] == 'availability_graph') { - // table_legend_graphs; + // Table_legend_graphs. $table2 = new stdClass(); $table2->width = '99%'; $table2->data = []; @@ -2618,22 +3246,62 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) $table2->data[0][11] = ''.__('Ignore time').''; } - $table->colspan['charts']['cell'] = 2; - $table->data['charts']['cell'] = $tables_chart; - $table->colspan['legend']['cell'] = 2; - $table->data['legend']['cell'] = html_print_table($table2, true); - - if ($pdf) { - return $tables_chart.'
'.html_print_table($table2, true); + if ($pdf !== 0) { + $tables_chart .= html_print_table( + $table2, + true + ); + return $tables_chart; + } else { + $table->colspan['charts']['cell'] = 2; + $table->data['charts']['cell'] = $tables_chart; + $table->colspan['legend']['cell'] = 2; + $table->data['legend']['cell'] = html_print_table( + $table2, + true + ); } } -function reporting_html_general(&$table, $item) +/** + * Function for first time data agent. + * + * @param string $agent_name Agent name. + * + * @return array + */ +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 to print to HTML General report. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_general($table, $item, $pdf=0) +{ + $return_pdf = ''; if (!empty($item['data'])) { $data_in_same_row = $item['show_in_same_row']; switch ($item['subtype']) { + default: case REPORT_GENERAL_NOT_GROUP_BY_AGENT: if (!$data_in_same_row) { $table1 = new stdClass(); @@ -2652,14 +3320,14 @@ function reporting_html_general(&$table, $item) $table1->style[2] = 'text-align: left'; $table1->style[3] = 'text-align: left'; - // Begin - Order by agent + // Begin - Order by agent. foreach ($item['data'] as $key => $row) { $aux[$key] = $row['agent']; } array_multisort($aux, SORT_ASC, $item['data']); - // End - Order by agent + // End - Order by agent. foreach ($item['data'] as $row) { if ($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) { $row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN); @@ -2723,7 +3391,6 @@ function reporting_html_general(&$table, $item) } } break; - case REPORT_GENERAL_GROUP_BY_AGENT: $list_modules = []; foreach ($item['data'] as $modules) { @@ -2754,12 +3421,23 @@ function reporting_html_general(&$table, $item) break; } - $table->colspan['data']['cell'] = 3; - $table->cellstyle['data']['cell'] = 'text-align: center;'; - $table->data['data']['cell'] = html_print_table($table1, true); + if ($pdf !== 0) { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table1, true); + } else { + $table->colspan['data']['cell'] = 3; + $table->cellstyle['data']['cell'] = 'text-align: center;'; + $table->data['data']['cell'] = html_print_table($table1, true); + } } else { - $table->colspan['error']['cell'] = 3; - $table->data['error']['cell'] = __('There are no Agent/Modules defined'); + if ($pdf !== 0) { + $return_pdf .= __('There are no Agent/Modules defined'); + } else { + $table->colspan['error']['cell'] = 3; + $table->data['error']['cell'] = __('There are no Agent/Modules defined'); + } } if ($item['resume'] && !empty($item['data'])) { @@ -2789,34 +3467,44 @@ function reporting_html_general(&$table, $item) $table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module']; $table_summary->data[0][4] = $item['max']['formated_value']; - $table->colspan['summary_title']['cell'] = 3; - $table->data['summary_title']['cell'] = ''.__('Summary').''; - $table->colspan['summary_table']['cell'] = 3; - $table->data['summary_table']['cell'] = html_print_table($table_summary, true); + if ($pdf !== 0) { + $return_pdf .= html_print_table($table_summary, true); + } else { + $table->colspan['summary_title']['cell'] = 3; + $table->data['summary_title']['cell'] = ''.__('Summary').''; + $table->colspan['summary_table']['cell'] = 3; + $table->data['summary_table']['cell'] = html_print_table( + $table_summary, + true + ); + } + } + + if ($pdf !== 0) { + return $return_pdf; } } -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_sql(&$table, $item) +/** + * Function to print to HTML query sql. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_sql($table, $item, $pdf=0) { + $return_pdf = ''; if (!$item['correct']) { - $table->colspan['error']['cell'] = 3; - $table->data['error']['cell'] = $item['error']; + if ($pdf === 0) { + $table->colspan['error']['cell'] = 3; + $table->data['error']['cell'] = $item['error']; + } else { + $return_pdf .= $item['error']; + } } else { $first = true; @@ -2825,10 +3513,10 @@ function reporting_html_sql(&$table, $item) $table2->width = '100%'; foreach ($item['data'] as $row) { - if ($first) { + if ($first === true) { $first = false; - // Print the header + // Print the header. foreach ($row as $key => $value) { $table2->head[] = $key; } @@ -2837,18 +3525,44 @@ function reporting_html_sql(&$table, $item) $table2->data[] = $row; } - $table->colspan['data']['cell'] = 3; - $table->cellstyle['data']['cell'] = 'text-align: center;'; - $table->data['data']['cell'] = html_print_table($table2, true); + if ($pdf === 0) { + $table->colspan['data']['cell'] = 3; + $table->cellstyle['data']['cell'] = 'text-align: center;'; + $table->data['data']['cell'] = html_print_table( + $table2, + true + ); + } else { + $table2->title = $item['title']; + $table2->titleclass = 'title_table_pdf'; + $table2->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table2, + true + ); + } + } + + if ($pdf !== 0) { + return $return_pdf; } } +/** + * Function for stats. + * + * @param array $data Array item. + * @param integer $graph_width Items data. + * @param integer $graph_height If it comes from pdf. + * + * @return html + */ function reporting_get_stats_summary($data, $graph_width, $graph_height) { global $config; - // Alerts table + // Alerts table. $table_sum = html_get_predefined_table(); $tdata = []; @@ -2868,25 +3582,33 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) $table_sum->cellstyle[count($table_sum->data)][2] = 'text-align: center;'; if ($data['monitor_checks'] > 0) { - // Fixed width non interactive charts + // Fixed width non interactive charts. $status_chart_width = $graph_width; - $tdata[0] = '
'.'
'.graph_agent_status(false, $graph_width, $graph_height, true, true).'
'.'
'; + $tdata[0] = '
'.graph_agent_status(false, $graph_width, $graph_height, true, true).'
'; } else { - $tdata[2] = html_print_image('images/image_problem_area_small.png', true, ['width' => $graph_width]); + $tdata[2] = html_print_image( + 'images/image_problem_area_small.png', + true, + ['width' => $graph_width] + ); } if ($data['monitor_alerts'] > 0) { $tdata[2] = '
'.graph_alert_status($data['monitor_alerts'], $data['monitor_alerts_fired'], $graph_width, $graph_height, true, true).'
'; } else { - $tdata[2] = html_print_image('images/image_problem_area_small.png', true, ['width' => $graph_width]); + $tdata[2] = html_print_image( + 'images/image_problem_area_small.png', + true, + ['width' => $graph_width] + ); } $table_sum->rowclass[] = ''; $table_sum->data[] = $tdata; $output = '
- '.__('Summary').''.html_print_table($table_sum, true).'
'; + '.__('Summary').''.html_print_table($table_sum, true).'
'; return $output; } @@ -2898,10 +3620,11 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) * It construct a table object with all the events happened in a group * during a period of time. * - * @param int Group id to get the report. - * @param int Period of time to get the report. - * @param int Beginning date of the report - * @param int Flag to return or echo the report table (echo by default). + * @param integer $id_group Group id to get the report. + * @param integer $period Period of time to get the report. + * @param integer $date Beginning date of the report. + * @param boolean $return Flag to return or echo the + * report table (echo by default). * * @return object A table object */ @@ -2934,7 +3657,7 @@ function reporting_event_reporting($id_group, $period, $date=0, $return=false) } $data[1] = $event['evento']; - $data[2] = $event['id_usuario'] != '0' ? $event['id_usuario'] : ''; + $data[2] = ($event['id_usuario'] != '0') ? $event['id_usuario'] : ''; $data[3] = $event['timestamp']; array_push($table->data, $data); } @@ -2950,8 +3673,9 @@ function reporting_event_reporting($id_group, $period, $date=0, $return=false) /** * Get a table report from a alerts fired array. * - * @param array Alerts fired array. - * @see function get_alerts_fired () + * @param array $alerts_fired Alerts fired array. + * + * @see function get_alerts_fired () * * @return object A table object with a report of the fired alerts. */ @@ -2966,7 +3690,7 @@ function reporting_get_fired_alerts_table($alerts_fired) $alert_module = alerts_get_alert_agent_module($id_alert); $template = alerts_get_alert_template($id_alert); - // Add alerts fired to $agents_fired_alerts indexed by id_agent + // Add alerts fired to $agents_fired_alerts indexed by id_agent. $id_agent = db_get_value( 'id_agente', 'tagente_modulo', @@ -3012,8 +3736,9 @@ function reporting_get_fired_alerts_table($alerts_fired) /** * Get a report table with all the monitors down. * - * @param array An array with all the monitors down - * @see function modules_get_monitors_down() + * @param array $monitors_down An array with all the monitors down. + * + * @see Function modules_get_monitors_down(). * * @return object A table object with a monitors down report. */ @@ -3027,7 +3752,7 @@ function reporting_get_monitors_down_table($monitors_down) $agents = []; if ($monitors_down) { foreach ($monitors_down as $monitor) { - // Add monitors fired to $agents_fired_alerts indexed by id_agent + // Add monitors fired to $agents_fired_alerts indexed by id_agent. $id_agent = $monitor['id_agente']; if (!isset($agents[$id_agent])) { $agents[$id_agent] = []; @@ -3067,8 +3792,8 @@ function reporting_get_monitors_down_table($monitors_down) * * It shows the number of agents and no more things right now. * - * @param int Group to get the report - * @param bool Flag to return or echo the report (by default). + * @param integer $id_group Group to get the report. + * @param boolean $return Flag to return or echo the report (by default). * * @return HTML string with group report */ @@ -3088,9 +3813,10 @@ function reporting_print_group_reporting($id_group, $return=false) /** * Get a report table of the fired alerts group by agents. * - * @param int Agent id to generate the report. - * @param int Period of time of the report. - * @param int Beginning date of the report in UNIX time (current date by default). + * @param integer $id_agent Agent id to generate the report. + * @param integer $period Period of time of the report. + * @param integer $date Beginning date of the report in + * UNIX time (current date by default). * * @return object A table object with the alert reporting.. */ @@ -3123,6 +3849,7 @@ function reporting_get_agent_alerts_table($id_agent, $period=0, $date=0) switch ($template['type']) { case 'regex': + default: if ($template['matches_value']) { $data[2] = '≃ "'.$template['value'].'"'; } else { @@ -3133,23 +3860,19 @@ function reporting_get_agent_alerts_table($id_agent, $period=0, $date=0) case 'equal': case 'not_equal': $data[2] = $template['value']; - break; case 'max-min': $data[2] = __('Min.').': '.$template['min_value'].' '; $data[2] .= __('Max.').': '.$template['max_value'].' '; - break; case 'max': $data[2] = $template['max_value']; - break; case 'min': $data[2] = $template['min_value']; - break; } @@ -3167,9 +3890,10 @@ function reporting_get_agent_alerts_table($id_agent, $period=0, $date=0) /** * Get a report of monitors in an agent. * - * @param int Agent id to get the report - * @param int Period of time of the report. - * @param int Beginning date of the report in UNIX time (current date by default). + * @param integer $id_agent Agent id to get the report. + * @param integer $period Period of time of the report. + * @param integer $date Beginning date of the report in UNIX time + * (current date by default). * * @return object A table object with the report. */ @@ -3187,7 +3911,11 @@ function reporting_get_agent_monitors_table($id_agent, $period=0, $date=0) } foreach ($monitors as $monitor) { - $downs = modules_get_monitor_downs_in_period($monitor['id_agente_modulo'], $period, $date); + $downs = modules_get_monitor_downs_in_period( + $monitor['id_agente_modulo'], + $period, + $date + ); if (! $downs) { continue; } @@ -3199,7 +3927,11 @@ function reporting_get_agent_monitors_table($id_agent, $period=0, $date=0) $data[0] = $monitor['nombre']; } - $data[1] = modules_get_last_down_timestamp_in_period($monitor['id_agente_modulo'], $period, $date); + $data[1] = modules_get_last_down_timestamp_in_period( + $monitor['id_agente_modulo'], + $period, + $date + ); array_push($table->data, $data); } @@ -3210,9 +3942,10 @@ function reporting_get_agent_monitors_table($id_agent, $period=0, $date=0) /** * Get a report of all the modules in an agent. * - * @param int Agent id to get the report. - * @param int Period of time of the report - * @param int Beginning date of the report in UNIX time (current date by default). + * @param integer $id_agent Agent id to get the report. + * @param integer $period Period of time of the report. + * @param integer $date Beginning date of the report in UNIX time + * (current date by default). * * @return object */ @@ -3244,19 +3977,24 @@ function reporting_get_agent_modules_table($id_agent, $period=0, $date=0) /** * Get a detailed report of an agent * - * @param int Agent to get the report. - * @param int Period of time of the desired report. - * @param int Beginning date of the report in UNIX time (current date by default). - * @param bool Flag to return or echo the report (by default). + * @param integer $id_agent Agent to get the report. + * @param integer $period Period of time of the desired report. + * @param integer $date Beginning date of the report in UNIX time + * (current date by default). + * @param boolean $return Flag to return or echo the report (by default). * * @return string */ -function reporting_get_agent_detailed($id_agent, $period=0, $date=0, $return=false) -{ +function reporting_get_agent_detailed( + $id_agent, + $period=0, + $date=0, + $return=false +) { $output = ''; $n_a_string = __('N/A(*)'); - // Show modules in agent + // Show modules in agent. $output .= '
'; $output .= '

'.__('Agent').' - '.agents_get_alias($id_agent).'

'; $output .= '

'.__('Modules').'

'; @@ -3264,17 +4002,17 @@ function reporting_get_agent_detailed($id_agent, $period=0, $date=0, $return=fal $table_modules->width = '99%'; $output .= html_print_table($table_modules, true); - // Show alerts in agent + // Show alerts in agent. $table_alerts = reporting_get_agent_alerts_table($id_agent, $period, $date); $table_alerts->width = '99%'; - if (sizeof($table_alerts->data)) { + if (count($table_alerts->data)) { $output .= '

'.__('Alerts').'

'; $output .= html_print_table($table_alerts, true); } - // Show monitor status in agent (if any) + // Show monitor status in agent (if any). $table_monitors = reporting_get_agent_monitors_table($id_agent, $period, $date); - if (sizeof($table_monitors->data) == 0) { + if (count($table_monitors->data) == 0) { $output .= '
'; if (! $return) { echo $output; @@ -3467,12 +4205,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; @@ -3495,7 +4233,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; } @@ -3514,12 +4252,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; @@ -3563,7 +4301,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;'; @@ -3573,7 +4311,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; @@ -3605,9 +4343,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; @@ -3615,9 +4353,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; @@ -3625,9 +4363,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; @@ -3805,7 +4543,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); @@ -3903,9 +4641,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 @@ -3989,7 +4727,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/graphs/functions_gd.php b/pandora_console/include/graphs/functions_gd.php index 17d8fedd95..262ed22bb3 100755 --- a/pandora_console/include/graphs/functions_gd.php +++ b/pandora_console/include/graphs/functions_gd.php @@ -144,7 +144,7 @@ function gd_histogram($width, $height, $mode, $data, $max_value, $font, $title, foreach ($data as $label => $value) { imagefilledrectangle($image, $leftmargin, $margin_up, (($value / $size_per) + $leftmargin), ($margin_up + $rectangle_height - 1), $colors[$c]); if ($mode != 2) { - ImageTTFText($image, $fontsize, 0, 0, ($margin_up + 8), $black, $font, $label); + imagettftext($image, $fontsize, 0, 0, ($margin_up + 8), $black, $font, $label); } $margin_up += ($rectangle_height + 1); @@ -164,9 +164,9 @@ function gd_histogram($width, $height, $mode, $data, $max_value, $font, $title, imageline($image, $risk_low, 0, $risk_low, $height, $grey); imageline($image, $risk_med, 0, $risk_med, $height, $grey); imageline($image, $risk_high, 0, $risk_high, $height, $grey); - ImageTTFText($image, $fontsize, 0, ($risk_low - 20), $height, $grey, $font, 'Low'); - ImageTTFText($image, $fontsize, 0, ($risk_med - 20), $height, $grey, $font, 'Med.'); - ImageTTFText($image, $fontsize, 0, ($risk_high - 25), $height, $grey, $font, 'High'); + imagettftext($image, $fontsize, 0, ($risk_low - 20), $height, $grey, $font, 'Low'); + imagettftext($image, $fontsize, 0, ($risk_med - 20), $height, $grey, $font, 'Med.'); + imagettftext($image, $fontsize, 0, ($risk_high - 25), $height, $grey, $font, 'High'); } imagepng($image); @@ -279,7 +279,7 @@ function gd_progress_bubble($width, $height, $progress, $title, $font, $out_of_l // Write the value $size = imagettfbbox($fontsize, 0, $font, $value_text); - ImageTTFText( + imagettftext( $image, $fontsize, 0, @@ -409,12 +409,12 @@ function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fo if ($rating > 50) { if ($rating > 100) { - ImageTTFText($image, ($fontsize + 2), 0, ($width / 4), (($height / 2) + ($height / 5)), $back, $font, $out_of_lim_str); + imagettftext($image, ($fontsize + 2), 0, ($width / 4), (($height / 2) + ($height / 5)), $back, $font, $out_of_lim_str); } else { - ImageTTFText($image, $fontsize, 0, (($width / 2) - ($width / 10)), (($height / 2) + ($height / 5)), $back, $font, $value_text); + imagettftext($image, $fontsize, 0, (($width / 2) - ($width / 10)), (($height / 2) + ($height / 5)), $back, $font, $value_text); } } else { - ImageTTFText($image, $fontsize, 0, (($width / 2) - ($width / 10)), (($height / 2) + ($height / 5)), $text, $font, $value_text); + imagettftext($image, $fontsize, 0, (($width / 2) - ($width / 10)), (($height / 2) + ($height / 5)), $text, $font, $value_text); } break; diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 70a9c4920e..7cc134c76a 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-2019 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); @@ -2053,82 +2059,58 @@ div#logo_text3 { /* TABLAS */ /* Cells divs to set individual styles with the table objects */ -div.cellBold { - width: 100%; - height: 100%; +td.cellBold { font-weight: bold; } -div.cellRight { - width: 100%; - height: 100%; +td.cellRight { text-align: right; } -div.cellCenter { - width: 100%; - height: 100%; +td.cellCenter { text-align: center; } -div.cellWhite { - width: 100%; - height: 100%; +td.cellWhite { background: #fff; color: #111; } -div.cellNormal { - width: 100%; - height: 100%; +td.cellNormal { background: #6eb432; color: #fff; } -div.cellCritical { - width: 100%; - height: 100%; +td.cellCritical { background: #f85858; color: #fff; } -div.cellWarning { - width: 100%; - height: 100%; +td.cellWarning { background: #ffea59; color: #111; } -div.cellUnknown { - width: 100%; - height: 100%; +td.cellUnknown { background: #aaaaaa; color: #ffffff; } -div.cellNotInit { - width: 100%; - height: 100%; +td.cellNotInit { background: #3ba0ff; color: #ffffff; } -div.cellAlert { - width: 100%; - height: 100%; +td.cellAlert { background: #ff8800; color: #111; } -div.cellBorder1 { - width: 100%; - height: 100%; +td.cellBorder1 { border: 1px solid #666; } -div.cellBig { - width: 100%; - height: 100%; +td.cellBig { font-size: 18px; } @@ -4561,4 +4543,4 @@ input:checked + .slider:before { .no-close .ui-dialog-titlebar-close { display: none; } -/* jQuery dialog */ +/* --- END - JQUERY-UI --- */ diff --git a/pandora_console/include/styles/pandoraPDF.css b/pandora_console/include/styles/pandoraPDF.css new file mode 100644 index 0000000000..37d527c30b --- /dev/null +++ b/pandora_console/include/styles/pandoraPDF.css @@ -0,0 +1,78 @@ +/** + * 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. + * ============================================================================ + */ +table.header_table { + width: 100%; +} + +table.header_table thead tr th, +table.header_table tbody 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; +} + +thead.header_tr tr th.th_description { + background-color: #f5f5f5; + color: #1c1c1c; + text-align: justify; +} + +table.table_beauty { + border-collapse: collapse; + width: 100%; +} + +table.table_beauty tbody tr td { + padding: 5px; + border: 0.1pt solid #acacac; +} + +table.databox { + margin-bottom: 20px; +} + +th.title_table_pdf { + background-color: #acacac; + padding: 15px; +} + +table.table_agent_module tr td { + padding: 5px; +} 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'); } - diff --git a/pandora_console/install.php b/pandora_console/install.php index 193f31a6ec..be416f5b40 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -1,16 +1,32 @@ @@ -113,7 +129,7 @@
Checking software dependencies'; echo ''; $res = 0; - $res += check_variable(phpversion(), '5.2', 'PHP version >= 5.2', 1); + $res += check_variable(phpversion(), '7.0', 'PHP version >= 7.0', 1); $res += check_extension('gd', 'PHP GD extension'); $res += check_extension('ldap', 'PHP LDAP extension'); $res += check_extension('snmp', 'PHP SNMP extension'); @@ -548,7 +564,6 @@ function install_step2() font-size: 8.5pt;margin-top: 2px; font-weight: bolder;'>DB Engines"; echo ''; - check_extension('mysql', 'PHP MySQL extension'); check_extension('mysqli', 'PHP MySQL(mysqli) extension'); echo '
'; echo '
'; diff --git a/pandora_console/mobile/operation/alerts.php b/pandora_console/mobile/operation/alerts.php index b95ba9492d..8991f0d8b3 100644 --- a/pandora_console/mobile/operation/alerts.php +++ b/pandora_console/mobile/operation/alerts.php @@ -313,7 +313,7 @@ class Alerts $row = []; if (isset($this->columns['agent']) && $this->columns['agent']) { - $row[__('Agent')] = sprintf($disabled_style, io_safe_output($alert['agent_name'])); + $row[__('Agent')] = sprintf($disabled_style, io_safe_output($alert['agent_alias'])); } $row[__('Module')] = sprintf( diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 2d967815bd..4653843f6a 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.731 -%define release 190214 +%define release 190219 # User and Group under which Apache is running %define httpd_name httpd @@ -26,7 +26,7 @@ BuildRoot: %{_tmppath}/%{name} BuildArch: noarch AutoReq: 0 Requires: %{httpd_name} >= 2.0.0 -Requires: mod_php >= 5.2.0 +Requires: mod_php >= 7.0 Requires: php-gd, php-ldap, php-snmp, php-session, php-gettext Requires: php-mysqlnd, php-mbstring, php-zip, php-zlib, php-curl Requires: xorg-x11-fonts-75dpi, xorg-x11-fonts-misc, php-pecl-zip diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index bc06faf96d..a5f4fb2163 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.731 -%define release 190214 +%define release 190219 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 @@ -29,7 +29,7 @@ BuildArch: noarch AutoReq: 0 Requires: apache2 Requires: apache2-mod_php7 -Requires: php >= 4.3.0 +Requires: php >= 7.0 Requires: php-gd, php-snmp, php-json, php-gettext Requires: php-mysqlnd, php-ldap, php-mbstring, php Requires: graphviz, xorg-x11-fonts-core, graphviz-gd diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index d607a98e44..e307f4aa2b 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.731-190214 +Version: 7.0NG.731-190219 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 37d7388974..c4305947c6 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.731-190214" +pandora_version="7.0NG.731-190219" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index db418c8607..a3469c8f4c 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.731"; -my $pandora_build = "190214"; +my $pandora_build = "190219"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 3bfd1e1a7d..4682c38820 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -3454,6 +3454,7 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { # Specific SNMP Trap alert macros for regexp selectors in trap info my %macros; + $macros{'_trap_id_'} = $trap_id; $macros{'_snmp_oid_'} = $trap_oid; $macros{'_snmp_value_'} = $trap_value; diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 2a00199ac6..06ba620049 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -32,7 +32,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.731"; -my $pandora_build = "190214"; +my $pandora_build = "190219"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 0c678b8e79..0e83289792 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190214 +%define release 190219 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index c2eabe1dbe..3696930e4d 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190214 +%define release 190219 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 3ed28d9c0c..6ef203a875 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190214" +PI_BUILD="190219" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 312570299d..ab35080dc9 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190214"; +my $version = "7.0NG.731 PS190219"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index c7f32c51d7..aaafd6978c 100644 --- 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.731 PS190214"; +my $version = "7.0NG.731 PS190219"; # save program name for logging my $progname = basename($0);