diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 71021148c6..6f8e89bfab 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,16 @@ +2013-02-27 Miguel de Dios + + * godmode/setup/setup_general.php, godmode/setup/setup_netflow.php, + godmode/setup/setup.php, godmode/setup/performance.php, + godmode/setup/setup_visuals.php, include/functions_config.php: added + check of update the options in the setup and show the message to + success or not the operation for the user. + + Fixes: #3605972 + + * include/functions_api.php, + operation/agentes/estado_generalagente.php: fixed the code style. + 2013-02-27 Miguel de Dios * include/javascript/pandora_modules.js, include/functions_api.php: diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index e28998fdf3..6177d1a67c 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -74,7 +74,8 @@ $table_other->size[0] = '70%'; $table_other->size[1] = '30%'; $table_other->data[1][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); -$table_other->data[1][1] = html_print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true); +$table_other->data[1][1] = html_print_input_text ('step_compact', + $config["step_compact"], '', 5, 5, true); $intervals = array (); $intervals[SECONDS_1HOUR] = __('1 hour'); @@ -92,10 +93,6 @@ $table_other->data[2][1] = html_print_select ($intervals, 'sla_period', $config[ $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[4][0] = __('Compact CSS and JS into header'); -//$table_other->data[4][1] = __('Yes').' '.html_print_radio_button ('compact_header', 1, '', $config["compact_header"], true).'  '; -//$table_other->data[4][1] .= __('No').' '.html_print_radio_button ('compact_header', 0, '', $config["compact_header"], true); - $table_other->data[5][0] = __('Use realtime statistics'); $table_other->data[5][1] = __('Yes').' '.html_print_radio_button ('realtimestats', 1, '', $config["realtimestats"], true).'  '; $table_other->data[5][1] .= __('No').' '.html_print_radio_button ('realtimestats', 0, '', $config["realtimestats"], true); diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 97cbbd2388..01e9b08300 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -126,6 +126,17 @@ switch ($section) { // Header ui_print_page_header (__('Configuration') . $subpage, "", false, "", true, $buttons); +if (isset($config['error_config_update_config'])) { + if ($config['error_config_update_config']['correct'] == false) { + ui_print_error_message($config['error_config_update_config']['message']); + } + else { + ui_print_success_message(__('Correct update the setup options')); + } + + unset($config['error_config_update_config']); +} + switch ($section) { case "general": require_once($config['homedir'] . "/godmode/setup/setup_general.php"); diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 64cac84709..c9e8adea59 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -297,7 +297,7 @@ $(document).ready (function () { $("#zone").attr("disabled", true); $("#timezone").attr("disabled", true); - + $("input[name='acl_enterprise']").click(function() { flag = $(this).is(':checked'); if (flag == true) { diff --git a/pandora_console/godmode/setup/setup_netflow.php b/pandora_console/godmode/setup/setup_netflow.php index 7398b7254e..62f281025a 100644 --- a/pandora_console/godmode/setup/setup_netflow.php +++ b/pandora_console/godmode/setup/setup_netflow.php @@ -39,27 +39,29 @@ $table->cellpadding = 5; $table->class = "databox_color"; $table->data = array (); - -$table->data[0][0] = ''.__('Data storage path').''. ui_print_help_tip (__("Directory where netflow data will be stored."), true); + +$table->data[0][0] = '' . __('Data storage path') . '' . + ui_print_help_tip (__("Directory where netflow data will be stored."), true); $table->data[0][1] = html_print_input_text ('netflow_path', $config['netflow_path'], false, 50, 200, true); -$table->data[1][0] = ''.__('Daemon interval').''; +$table->data[1][0] = '' . __('Daemon interval') . ''; $table->data[1][1] = html_print_input_text ('netflow_interval', $config['netflow_interval'], false, 50, 200, true); -$table->data[2][0] = ''.__('Daemon binary path').''; +$table->data[2][0] = '' . __('Daemon binary path') . ''; $table->data[2][1] = html_print_input_text ('netflow_daemon', $config['netflow_daemon'], false, 50, 200, true); -$table->data[3][0] = ''.__('Nfdump binary path').''; +$table->data[3][0] = '' . __('Nfdump binary path') . ''; $table->data[3][1] = html_print_input_text ('netflow_nfdump', $config['netflow_nfdump'], false, 50, 200, true); -$table->data[4][0] = ''.__('Nfexpire binary path').''; +$table->data[4][0] = '' . __('Nfexpire binary path') . ''; $table->data[4][1] = html_print_input_text ('netflow_nfexpire', $config['netflow_nfexpire'], false, 50, 200, true); -$table->data[5][0] = ''.__('Maximum chart resolution').'' . ui_print_help_tip (__("Maximum number of points that a netflow area chart will display. The higher the resolution the performance. Values between 50 and 100 are recommended."), true); +$table->data[5][0] = '' . __('Maximum chart resolution') . '' . ui_print_help_tip (__("Maximum number of points that a netflow area chart will display. The higher the resolution the performance. Values between 50 and 100 are recommended."), true); $table->data[5][1] = html_print_input_text ('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true); -$table->data[6][0] = ''.__('Disable custom live view filters').'' . ui_print_help_tip (__("Disable the definition of custom filters in the live view. Only existing filters can be used."), true); +$table->data[6][0] = '' . __('Disable custom live view filters') . '' . + ui_print_help_tip (__("Disable the definition of custom filters in the live view. Only existing filters can be used."), true); $table->data[6][1] = __('Yes').'   '.html_print_radio_button ('netflow_disable_custom_lvfilters', 1, '', $config["netflow_disable_custom_lvfilters"], true).'  '; $table->data[6][1] .= __('No').'   '.html_print_radio_button ('netflow_disable_custom_lvfilters', 0, '', $config["netflow_disable_custom_lvfilters"], true).'  '; -$table->data[7][0] = ''.__('Netflow max lifetime').''.ui_print_help_tip (__("Sets the maximum lifetime for netflow data in days."), true); +$table->data[7][0] = '' . __('Netflow max lifetime') . ''.ui_print_help_tip (__("Sets the maximum lifetime for netflow data in days."), true); $table->data[7][1] = html_print_input_text ('netflow_max_lifetime', $config['netflow_max_lifetime'], false, 50, 200, true); echo '
'; - + html_print_table ($table); // Update button @@ -67,14 +69,11 @@ echo '
'; html_print_input_hidden ('update_config', 1); html_print_submit_button (__('Update'), 'upd_button', false, 'class="sub upd"'); echo '
'; - + ?> diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index ef5c234f5b..18c2c7b79c 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -60,7 +60,7 @@ else if ($config['prominent_time'] == 'timestamp') { } $table->data[$row][0] = __('Timestamp or time comparation') . ui_print_help_icon ("time_stamp-comparation", true); -$table->data[$row][1] = __('Comparation in rollover').' '; +$table->data[$row][1] = __('Comparation in rollover') . ' '; $table->data[$row][1] .= html_print_radio_button ('prominent_time', "comparation", '', $comparation, true); $table->data[$row][1] .= '
'.__('Timestamp in rollover').' '; $table->data[$row][1] .= html_print_radio_button ('prominent_time', "timestamp", '', $timestamp, true); @@ -97,13 +97,13 @@ $units = array( SECONDS_1MONTH => __('months'), SECONDS_1YEAR => __('years')); -$table->data[$row][1] = __('Add new custom value to intervals').': '; +$table->data[$row][1] = __('Add new custom value to intervals') . ': '; $table->data[$row][1] .= html_print_input_text ('interval_value', '', '', 5, 5, true); $table->data[$row][1] .= html_print_select ($units, 'interval_unit', 1, "", '', '', true, false, false); $table->data[$row][1] .= html_print_button (__('Add'), 'interval_add_btn', false, "", 'class="sub next"', true); $table->data[$row][1] .= '

'; -$table->data[$row][1] .= __('Delete interval').': '; +$table->data[$row][1] .= __('Delete interval') . ': '; $table->data[$row][1] .= html_print_select (get_periods(false, false), 'intervals', "", "", '', '', true); $table->data[$row][1] .= html_print_button (__('Delete'), 'interval_del_btn', empty($config["interval_values"]), "", 'class="sub cancel"', true); diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 6759a92ec9..7738c6cba3 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -5614,14 +5614,14 @@ function api_set_create_event($id, $trash1, $other, $returnType) { } if ($other['data'][4] != '') $values['id_usuario'] = $other['data'][4]; - + if ($other['data'][5] != '') $values['estado'] = $other['data'][5]; $values['timestamp'] = date("Y-m-d H:i:s", get_system_time()); - + $values['evento'] = $id; $values['utimestamp'] = get_system_time (); - + if ($other['data'][6] != '') $values['id_agentmodule'] = $other['data'][6]; else { @@ -5638,7 +5638,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) { if ($other['data'][9] != '') $values['criticity'] = $other['data'][9]; - + if ($other['data'][11] != '') $values['tags'] = $other['data'][11]; if ($other['data'][12] != '') @@ -5649,7 +5649,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) { $values['id_extra'] = $other['data'][13]; if ($other['data'][14] != '') { $values['critical_instructions'] = $other['data'][14]; - } + } if ($other['data'][15] != '') { $values['warning_instructions'] = $other['data'][15]; } @@ -5707,10 +5707,10 @@ function api_get_tactical_view($trash1, $trash2, $trash3, $returnType) { $result = $key.': '.$data.'
'; else $result .= $key.': '.$data.'
'; - + $i++; } - + $data = array('type' => 'string', 'data' => $result); returnData($returnType, $data); @@ -5732,7 +5732,7 @@ function api_get_netflow_get_data ($discard_1, $discard_2, $params) { // Get netflow data $data = netflow_get_data ($start_date, $end_date, $interval_length, $filter, $aggregate, $max, $unit); - + returnData('json', $data); return; } @@ -5750,7 +5750,7 @@ function api_get_netflow_get_stats ($discard_1, $discard_2, $params) { // Get netflow data $data = netflow_get_stats ($start_date, $end_date, $filter, $aggregate, $max, $unit); - + returnData('json', $data); return; } @@ -5775,24 +5775,25 @@ function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) { $data['type'] = 'string'; $check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id); - - if ($check_id) { //event exists + if ($check_id) { //event exists + $status = db_get_value('estado', 'tevento', 'id_evento', $id); if ($status == 1) { //event already validated $data['data'] = "Event already validated"; - } else { + } + else { $ack_utimestamp = time(); - + events_comment($id, '', "Change status to validated"); - + $values = array( 'ack_utimestamp' => $ack_utimestamp, 'estado' => 1 ); - + $result = db_process_sql_update('tevento', $values, array('id_evento' => $id)); - + if ($result === false) { $data['data'] = "Error validating event"; } @@ -5801,12 +5802,13 @@ function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) { } } - } else { + } + else { $data['data'] = "Event not exists"; } - + returnData($returnType, $data); - return; + return; } /** @@ -5819,14 +5821,14 @@ function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) { */ // http://localhost/pandora_console/include/api.php?op=get&op2=pandora_servers&return_type=csv&apipass=1234&user=admin&pass=pandora function api_get_pandora_servers($trash1, $trash2, $other, $returnType) { - + if (!isset($other['data'][0])) $separator = ';'; // by default else $separator = $other['data'][0]; - + $servers = servers_get_info (); - + foreach ($servers as $server) { $dd = array ( 'name' => $server["name"], @@ -5841,11 +5843,11 @@ function api_get_pandora_servers($trash1, $trash2, $other, $returnType) { 'queued_modules' => $server["queued_modules"], 'keepalive' => $server['keepalive'] ); - + // servers_get_info() returns "servername" for recon server's name. // i don't know why and the following line is a temprary workaround... $dd["name"] = preg_replace( '/<[^>]*>/', "", $dd["name"]); - + switch ($dd['type']) { case "snmp": case "event": @@ -5861,15 +5863,13 @@ function api_get_pandora_servers($trash1, $trash2, $other, $returnType) { default: break; } - + $returnVar[] = $dd; } - + $data = array('type' => 'array', 'data' => $returnVar); - + returnData($returnType, $data, $separator); return; - } - ?> diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 13b669f504..e9eb59091f 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -59,9 +59,14 @@ function config_update_value ($token, $value) { $config[$token] = $value; - return (bool) db_process_sql_update ('tconfig', + $result = db_process_sql_update ('tconfig', array ('value' => $value), array ('token' => $token)); + + if ($result === 0) + return true; + else + return (bool) $result; } /** @@ -71,11 +76,21 @@ function config_update_config () { global $config; /* If user is not even log it, don't try this */ - if (! isset ($config['id_user'])) + if (! isset ($config['id_user'])) { + $config['error_config_update_config'] = array(); + $config['error_config_update_config']['correct'] = false; + $config['error_config_update_config']['message'] = __('Failed updated: User did not login.'); + return false; + } - if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) + if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { + $config['error_config_update_config'] = array(); + $config['error_config_update_config']['correct'] = false; + $config['error_config_update_config']['message'] = __('Failed updated: User is not admin.'); + return false; + } $update_config = (bool) get_parameter ('update_config'); @@ -83,39 +98,63 @@ function config_update_config () { db_pandora_audit("Setup", "Setup has changed"); } else { + //Do none + return false; } + $error_update = array(); + $sec2 = get_parameter_get('sec2'); - switch($sec2) { + switch ($sec2) { case 'godmode/setup/setup': $section_setup = get_parameter ('section'); //////// MAIN SETUP // Setup now is divided in different tabs switch ($section_setup) { case 'general': - config_update_value ('language', (string) get_parameter ('language')); - config_update_value ('remote_config', (string) get_parameter ('remote_config')); - config_update_value ('loginhash_pwd', (string) get_parameter ('loginhash_pwd')); - config_update_value ('timesource', (string) get_parameter ('timesource')); - config_update_value ('autoupdate', (bool) get_parameter ('autoupdate')); - config_update_value ('https', (bool) get_parameter ('https')); - config_update_value ('attachment_store', (string) get_parameter ('attachment_store')); - config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API')); - config_update_value ('api_password', get_parameter('api_password')); - config_update_value ('activate_gis', (bool) get_parameter ('activate_gis')); - config_update_value ('integria_enabled', get_parameter ('integria_enabled')); - config_update_value ('integria_inventory', get_parameter ('integria_inventory')); - config_update_value ('integria_api_password', get_parameter ('integria_api_password')); - config_update_value ('integria_url', get_parameter ('integria_url')); - config_update_value ('activate_netflow', (bool) get_parameter ('activate_netflow')); + if (!config_update_value ('language', (string) get_parameter ('language'))) + $error_update[] = __('Language code for Pandora'); + if (!config_update_value ('remote_config', (string) get_parameter ('remote_config'))) + $error_update[] = __('Remote config directory'); + if (!config_update_value ('loginhash_pwd', (string) get_parameter ('loginhash_pwd'))) + $error_update[] = __('Auto login (hash) password'); + + if (!config_update_value ('timesource', (string) get_parameter ('timesource'))) + $error_update[] = __('Time source'); + if (!config_update_value ('autoupdate', (bool) get_parameter ('autoupdate'))) + $error_update[] = __('Automatic check for updates'); + if (!config_update_value ('https', (bool) get_parameter ('https'))) + $error_update[] = __('Enforce https'); + if (!config_update_value ('attachment_store', (string) get_parameter ('attachment_store'))) + $error_update[] = __('Attachment store'); + if (!config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API'))) + $error_update[] = __('IP list with API access'); + if (!config_update_value ('api_password', get_parameter('api_password'))) + $error_update[] = __('Integria API password'); + if (!config_update_value ('activate_gis', (bool) get_parameter ('activate_gis'))) + $error_update[] = __('Enable GIS features in Pandora Console'); + if (!config_update_value ('integria_enabled', get_parameter ('integria_enabled'))) + $error_update[] = __('Enable Integria incidents in Pandora Console'); + if (!config_update_value ('integria_inventory', get_parameter ('integria_inventory'))) + $error_update[] = __('Integria inventory'); + if (!config_update_value ('integria_api_password', get_parameter ('integria_api_password'))) + $error_update[] = __('Integria API password'); + if (!config_update_value ('integria_url', get_parameter ('integria_url'))) + $error_update[] = __('Integria URL'); + if (!config_update_value ('activate_netflow', (bool) get_parameter ('activate_netflow'))) + $error_update[] = __('Enable Netflow'); $timezone = (string) get_parameter ('timezone'); if ($timezone != "") { - config_update_value ('timezone', $timezone); + if (!config_update_value ('timezone', $timezone)) + $error_update[] = __('Timezone setup'); } - config_update_value ('sound_alert', get_parameter('sound_alert')); - config_update_value ('sound_critical', get_parameter('sound_critical')); - config_update_value ('sound_warning', get_parameter('sound_warning')); + if (!config_update_value ('sound_alert', get_parameter('sound_alert'))) + $error_update[] = __('Sound for Alert fired'); + if (!config_update_value ('sound_critical', get_parameter('sound_critical'))) + $error_update[] = __('Sound for Monitor critical'); + if (!config_update_value ('sound_warning', get_parameter('sound_warning'))) + $error_update[] = __('Sound for Monitor warning'); # Update of Pandora FMS license $update_manager_installed = db_get_value('value', 'tconfig', 'token', 'update_manager_installed'); @@ -125,144 +164,247 @@ function config_update_config () { $values = array("value" => $license_info_key); $where = array("key" => 'customer_key'); $update_manage_settings_result = db_process_sql_update('tupdate_settings', $values, $where); + if (!$update_manage_settings_result) + $error_update[] = __('License information'); } } - config_update_value ('public_url', get_parameter('public_url')); - config_update_value ('referer_security', get_parameter('referer_security')); - config_update_value ('event_storm_protection', get_parameter('event_storm_protection')); - config_update_value ('command_snapshot', get_parameter('command_snapshot')); + if (!config_update_value ('public_url', get_parameter('public_url'))) + $error_update[] = __('Public URL'); + if (!config_update_value ('referer_security', get_parameter('referer_security'))) + $error_update[] = __('Referer security'); + if (!config_update_value ('event_storm_protection', get_parameter('event_storm_protection'))) + $error_update[] = __('Event storm protection'); + if (!config_update_value ('command_snapshot', get_parameter('command_snapshot'))) + $error_update[] = __('Command Snapshot'); break; case 'enterprise': if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { - config_update_value ('trap2agent', (string) get_parameter ('trap2agent')); - config_update_value ('acl_enterprise', get_parameter ('acl_enterprise')); - config_update_value ('metaconsole', get_parameter ('metaconsole')); - config_update_value ('collection_max_size', get_parameter('collection_max_size')); - config_update_value ('event_replication', (int)get_parameter('event_replication')); + if (!config_update_value ('trap2agent', (string) get_parameter ('trap2agent'))) + $error_update[] = __('Forward SNMP traps to agent (if exist)'); + if (!config_update_value ('acl_enterprise', get_parameter ('acl_enterprise'))) + $error_update[] = __('Use Enterprise ACL System'); + if (!config_update_value ('metaconsole', get_parameter ('metaconsole'))) + $error_update[] = __('Activate Metaconsole'); + if (!config_update_value ('collection_max_size', get_parameter('collection_max_size'))) + $error_update[] = __('Size of collection'); + if (!config_update_value ('event_replication', (int)get_parameter('event_replication'))) + $error_update[] = __('Events replication'); if ((int)get_parameter('event_replication') == 1) { - config_update_value ('replication_interval', (int)get_parameter('replication_interval')); - config_update_value ('replication_dbhost', (string)get_parameter('replication_dbhost')); - config_update_value ('replication_dbname', (string)get_parameter('replication_dbname')); - config_update_value ('replication_dbuser', (string)get_parameter('replication_dbuser')); - config_update_value ('replication_dbpass', (string)get_parameter('replication_dbpass')); - config_update_value ('replication_dbport', (string)get_parameter('replication_dbport')); - config_update_value ('replication_mode', (string)get_parameter('replication_mode')); + if (!config_update_value ('replication_interval', (int)get_parameter('replication_interval'))) + $error_update[] = __('Replication interval'); + if (!config_update_value ('replication_dbhost', (string)get_parameter('replication_dbhost'))) + $error_update[] = __('Replication DB host'); + if (!config_update_value ('replication_dbname', (string)get_parameter('replication_dbname'))) + $error_update[] = __('Replication DB database'); + if (!config_update_value ('replication_dbuser', (string)get_parameter('replication_dbuser'))) + $error_update[] = __('Replication DB user'); + if (!config_update_value ('replication_dbpass', (string)get_parameter('replication_dbpass'))) + $error_update[] = __('Replication DB password'); + if (!config_update_value ('replication_dbport', (string)get_parameter('replication_dbport'))) + $error_update[] = __('Replication DB port'); + if (!config_update_value ('replication_mode', (string)get_parameter('replication_mode'))) + $error_update[] = __('Replication mode'); } - config_update_value ('log_collector', (bool)get_parameter('log_collector')); + if (!config_update_value ('log_collector', (bool)get_parameter('log_collector'))) + $error_update[] = __('Activate Log Collector'); $inventory_changes_blacklist = get_parameter('inventory_changes_blacklist', array()); - config_update_value ('inventory_changes_blacklist', implode(',',$inventory_changes_blacklist)); + if (!config_update_value ('inventory_changes_blacklist', implode(',',$inventory_changes_blacklist))) + $error_update[] = __('Inventory changes blacklist'); } break; case 'pass': if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { - config_update_value ('enable_pass_policy', get_parameter('enable_pass_policy')); - config_update_value ('pass_size', get_parameter('pass_size')); - config_update_value ('pass_expire', get_parameter('pass_expire')); - config_update_value ('first_login', get_parameter('first_login')); - config_update_value ('mins_fail_pass', get_parameter('mins_fail_pass')); - config_update_value ('number_attempts', get_parameter('number_attempts')); - config_update_value ('pass_needs_numbers', get_parameter('pass_needs_numbers')); - config_update_value ('pass_needs_symbols', get_parameter('pass_needs_symbols')); - config_update_value ('enable_pass_policy_admin', get_parameter('enable_pass_policy_admin')); - config_update_value ('enable_pass_history', get_parameter('enable_pass_history')); - config_update_value ('compare_pass', get_parameter('compare_pass')); + if (!config_update_value ('enable_pass_policy', get_parameter('enable_pass_policy'))) + $error_update[] = __('Enable password policy'); + + if (!config_update_value ('pass_size', get_parameter('pass_size'))) + $error_update[] = __('Min. size password'); + if (!config_update_value ('pass_expire', get_parameter('pass_expire'))) + $error_update[] = __('Password expiration'); + if (!config_update_value ('first_login', get_parameter('first_login'))) + $error_update[] = __('Force change password on first login'); + if (!config_update_value ('mins_fail_pass', get_parameter('mins_fail_pass'))) + $error_update[] = __('User blocked if login fails'); + if (!config_update_value ('number_attempts', get_parameter('number_attempts'))) + $error_update[] = __('Number of failed login attempts'); + if (!config_update_value ('pass_needs_numbers', get_parameter('pass_needs_numbers'))) + $error_update[] = __('Password must have numbers'); + if (!config_update_value ('pass_needs_symbols', get_parameter('pass_needs_symbols'))) + $error_update[] = __('Password must have symbols'); + if (!config_update_value ('enable_pass_policy_admin', get_parameter('enable_pass_policy_admin'))) + $error_update[] = __('Apply password policy to admin users'); + if (!config_update_value ('enable_pass_history', get_parameter('enable_pass_history'))) + $error_update[] = __('Enable password history'); + if (!config_update_value ('compare_pass', get_parameter('compare_pass'))) + $error_update[] = __('Compare previous password'); } break; case 'auth': //////// AUTHENTICATION SETUP - config_update_value ('auth', get_parameter ('auth')); - config_update_value ('autocreate_remote_users', get_parameter ('autocreate_remote_users')); - config_update_value ('default_remote_profile', get_parameter ('default_remote_profile')); - config_update_value ('default_remote_group', get_parameter ('default_remote_group')); - config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist')); + if (!config_update_value ('auth', get_parameter ('auth'))) + $error_update[] = __('Authentication method'); + if (!config_update_value ('autocreate_remote_users', get_parameter ('autocreate_remote_users'))) + $error_update[] = __('Autocreate remote users'); + if (!config_update_value ('default_remote_profile', get_parameter ('default_remote_profile'))) + $error_update[] = __('Autocreate profile'); + if (!config_update_value ('default_remote_group', get_parameter ('default_remote_group'))) + $error_update[] = __('Autocreate profile group'); + if (!config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist'))) + $error_update[] = __('Autocreate blacklist'); - config_update_value ('ad_server', get_parameter ('ad_server')); - config_update_value ('ad_port', get_parameter ('ad_port')); - config_update_value ('ad_start_tls', get_parameter ('ad_start_tls')); - config_update_value ('ad_domain', get_parameter ('ad_domain')); + if (!config_update_value ('ad_server', get_parameter ('ad_server'))) + $error_update[] = __('Active directory server'); + if (!config_update_value ('ad_port', get_parameter ('ad_port'))) + $error_update[] = __('Active directory port'); + if (!config_update_value ('ad_start_tls', get_parameter ('ad_start_tls'))) + $error_update[] = __('Start TLS'); + if (!config_update_value ('ad_domain', get_parameter ('ad_domain'))) + $error_update[] = __('Domain'); - config_update_value ('ldap_server', get_parameter ('ldap_server')); - config_update_value ('ldap_port', get_parameter ('ldap_port')); - config_update_value ('ldap_version', get_parameter ('ldap_version')); - config_update_value ('ldap_start_tls', get_parameter ('ldap_start_tls')); - config_update_value ('ldap_base_dn', get_parameter ('ldap_base_dn')); - config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr')); + if (!config_update_value ('ldap_server', get_parameter ('ldap_server'))) + $error_update[] = __('LDAP server'); + if (!config_update_value ('ldap_port', get_parameter ('ldap_port'))) + $error_update[] = __('LDAP port'); + if (!config_update_value ('ldap_version', get_parameter ('ldap_version'))) + $error_update[] = __('LDAP version'); + if (!config_update_value ('ldap_start_tls', get_parameter ('ldap_start_tls'))) + $error_update[] = __('Start TLS'); + if (!config_update_value ('ldap_base_dn', get_parameter ('ldap_base_dn'))) + $error_update[] = __('Base DN'); + if (!config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr'))) + $error_update[] = __('Login attribute'); - config_update_value ('rpandora_server', get_parameter ('rpandora_server')); - config_update_value ('rpandora_port', get_parameter ('rpandora_port')); - config_update_value ('rpandora_dbname', get_parameter ('rpandora_dbname')); - config_update_value ('rpandora_user', get_parameter ('rpandora_user')); - config_update_value ('rpandora_pass', get_parameter ('rpandora_pass')); + if (!config_update_value ('rpandora_server', get_parameter ('rpandora_server'))) + $error_update[] = __('Pandora FMS host'); + if (!config_update_value ('rpandora_port', get_parameter ('rpandora_port'))) + $error_update[] = __('MySQL port'); + if (!config_update_value ('rpandora_dbname', get_parameter ('rpandora_dbname'))) + $error_update[] = __('Database name'); + if (!config_update_value ('rpandora_user', get_parameter ('rpandora_user'))) + $error_update[] = __('User'); + if (!config_update_value ('rpandora_pass', get_parameter ('rpandora_pass'))) + $error_update[] = __('Password'); - config_update_value ('rbabel_server', get_parameter ('rbabel_server')); - config_update_value ('rbabel_port', get_parameter ('rbabel_port')); - config_update_value ('rbabel_dbname', get_parameter ('rbabel_dbname')); - config_update_value ('rbabel_user', get_parameter ('rbabel_user')); - config_update_value ('rbabel_pass', get_parameter ('rbabel_pass')); - - config_update_value ('rintegria_server', get_parameter ('rintegria_server')); - config_update_value ('rintegria_port', get_parameter ('rintegria_port')); - config_update_value ('rintegria_dbname', get_parameter ('rintegria_dbname')); - config_update_value ('rintegria_user', get_parameter ('rintegria_user')); - config_update_value ('rintegria_pass', get_parameter ('rintegria_pass')); + if (!config_update_value ('rbabel_server', get_parameter ('rbabel_server'))) + $error_update[] = __('Babel Enterprise host'); + if (!config_update_value ('rbabel_port', get_parameter ('rbabel_port'))) + $error_update[] = __('MySQL port'); + if (!config_update_value ('rbabel_dbname', get_parameter ('rbabel_dbname'))) + $error_update[] = __('Database name'); + if (!config_update_value ('rbabel_user', get_parameter ('rbabel_user'))) + $error_update[] = __('User'); + if (!config_update_value ('rbabel_pass', get_parameter ('rbabel_pass'))) + $error_update[] = __('Password'); + if (!config_update_value ('rintegria_server', get_parameter ('rintegria_server'))) + $error_update[] = __('Integria host'); + if (!config_update_value ('rintegria_port', get_parameter ('rintegria_port'))) + $error_update[] = __('MySQL port'); + if (!config_update_value ('rintegria_dbname', get_parameter ('rintegria_dbname'))) + $error_update[] = __('Database name'); + if (!config_update_value ('rintegria_user', get_parameter ('rintegria_user'))) + $error_update[] = __('User'); + if (!config_update_value ('rintegria_pass', get_parameter ('rintegria_pass'))) + $error_update[] = __('Password'); ///////////// break; case 'perf': //////// PERFORMANCE SETUP - config_update_value ('event_purge', get_parameter ('event_purge')); + if (!config_update_value ('event_purge', get_parameter ('event_purge'))) + $error_update[] = $check_metaconsole_events_history = get_parameter ('metaconsole_events_history', -1); - if ($check_metaconsole_events_history != -1) - config_update_value ('metaconsole_events_history', get_parameter ('metaconsole_events_history')); - config_update_value ('trap_purge', get_parameter ('trap_purge')); - config_update_value ('string_purge', get_parameter ('string_purge')); - config_update_value ('audit_purge', get_parameter ('audit_purge')); - config_update_value ('gis_purge', get_parameter ('gis_purge')); - config_update_value ('days_purge', (int) get_parameter ('days_purge')); - config_update_value ('days_delete_unknown', (int) get_parameter ('days_delete_unknown')); - config_update_value ('days_compact', (int) get_parameter ('days_compact')); - config_update_value ('step_compact', (int) get_parameter ('step_compact')); - config_update_value ('sla_period', (int) get_parameter ('sla_period')); - config_update_value ('event_view_hr', (int) get_parameter ('event_view_hr')); - config_update_value ('realtimestats', get_parameter ('realtimestats')); - config_update_value ('stats_interval', get_parameter ('stats_interval')); - config_update_value ('agentaccess', (int) get_parameter ('agentaccess')); - config_update_value ('compact_header', (bool) get_parameter ('compact_header')); - config_update_value ('num_files_attachment', (int) get_parameter ('num_files_attachment')); + if ($check_metaconsole_events_history != -1) + if (!config_update_value ('metaconsole_events_history', get_parameter ('metaconsole_events_history'))) + $error_update[] = __('Max. days before delete events'); + if (!config_update_value ('trap_purge', get_parameter ('trap_purge'))) + $error_update[] = __('Max. days before delete traps'); + if (!config_update_value ('string_purge', get_parameter ('string_purge'))) + $error_update[] = __('Max. days before delete string data'); + if (!config_update_value ('audit_purge', get_parameter ('audit_purge'))) + $error_update[] = __('Max. days before delete audit events'); + if (!config_update_value ('gis_purge', get_parameter ('gis_purge'))) + $error_update[] = __('Max. days before delete GIS data'); + if (!config_update_value ('days_purge', (int) get_parameter ('days_purge'))) + $error_update[] = __('Max. days before purge'); + if (!config_update_value ('days_delete_unknown', (int) get_parameter ('days_delete_unknown'))) + $error_update[] = __('Max. days before delete unknown modules'); + if (!config_update_value ('days_compact', (int) get_parameter ('days_compact'))) + $error_update[] = __('Max. days before compact data'); + if (!config_update_value ('step_compact', (int) get_parameter ('step_compact'))) + $error_update[] = __('Compact interpolation in hours (1 Fine-20 bad)'); + if (!config_update_value ('sla_period', (int) get_parameter ('sla_period'))) + $error_update[] = __('SLA period (seconds)'); + if (!config_update_value ('event_view_hr', (int) get_parameter ('event_view_hr'))) + $error_update[] = __('Default hours for event view'); + if (!config_update_value ('realtimestats', get_parameter ('realtimestats'))) + $error_update[] = __('Use realtime statistics'); + if (!config_update_value ('stats_interval', get_parameter ('stats_interval'))) + $error_update[] = __('Batch statistics period (secs)'); + if (!config_update_value ('agentaccess', (int) get_parameter ('agentaccess'))) + $error_update[] = __('Use agent access graph'); + if (!config_update_value ('compact_header', (bool) get_parameter ('compact_header'))) + $error_update[] = 'Deprecated compact_header'; + if (!config_update_value ('num_files_attachment', (int) get_parameter ('num_files_attachment'))) + $error_update[] = __('Max. recommended number of files in attachment directory'); ///////////// break; case 'vis': //////// VISUAL STYLES SETUP - config_update_value ('date_format', (string) get_parameter ('date_format')); - config_update_value ('prominent_time', (string) get_parameter ('prominent_time')); - config_update_value ('graph_color1', (string) get_parameter ('graph_color1')); - config_update_value ('graph_color2', (string) get_parameter ('graph_color2')); - config_update_value ('graph_color3', (string) get_parameter ('graph_color3')); - config_update_value ('graph_res', (int) get_parameter ('graph_res')); + if (!config_update_value ('date_format', (string) get_parameter ('date_format'))) + $error_update[] = __('Date format string'); + if (!config_update_value ('prominent_time', (string) get_parameter ('prominent_time'))) + $error_update[] = __('Timestamp or time comparation'); + if (!config_update_value ('graph_color1', (string) get_parameter ('graph_color1'))) + $error_update[] = __('Graph color (min)'); + if (!config_update_value ('graph_color2', (string) get_parameter ('graph_color2'))) + $error_update[] = __('Graph color (avg)'); + if (!config_update_value ('graph_color3', (string) get_parameter ('graph_color3'))) + $error_update[] = __('Graph color (max)'); + if (!config_update_value ('graph_res', (int) get_parameter ('graph_res'))) + $error_update[] = __('Graphic resolution (1-low, 5-high)'); $style = (string) get_parameter ('style'); if ($style != $config['style']) $style = substr ($style, 0, strlen ($style) - 4); - config_update_value ('style', $style); - config_update_value ('block_size', (int) get_parameter ('block_size')); - config_update_value ('round_corner', (bool) get_parameter ('round_corner')); - config_update_value ('status_images_set', (string) get_parameter ('status_images_set')); - config_update_value ('fontpath', (string) get_parameter ('fontpath')); - config_update_value ('font_size', get_parameter('font_size')); - config_update_value ('flash_charts', (bool) get_parameter ('flash_charts')); - config_update_value ('custom_logo', (string) get_parameter ('custom_logo')); - config_update_value ('enable_refr', get_parameter('enable_refr')); - config_update_value ('refr', get_parameter('refr')); - config_update_value ('vc_refr', get_parameter('vc_refr')); - config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small')); - config_update_value ('agent_size_text_medium', get_parameter('agent_size_text_medium')); - config_update_value ('module_size_text_small', get_parameter('module_size_text_small')); - config_update_value ('module_size_text_medium', get_parameter('module_size_text_medium')); - config_update_value ('description_size_text', get_parameter('description_size_text')); - config_update_value ('item_title_size_text', get_parameter('item_title_size_text')); - config_update_value ('gis_label', get_parameter ('gis_label')); - config_update_value ('gis_default_icon', get_parameter ('gis_default_icon')); + if (!config_update_value ('style', $style)) + $error_update[] = __('Style template'); + if (!config_update_value ('block_size', (int) get_parameter ('block_size'))) + $error_update[] = __('Block size for pagination'); + if (!config_update_value ('round_corner', (bool) get_parameter ('round_corner'))) + $error_update[] = __('Use round corners'); + if (!config_update_value ('status_images_set', (string) get_parameter ('status_images_set'))) + $error_update[] = __('Status icon set'); + if (!config_update_value ('fontpath', (string) get_parameter ('fontpath'))) + $error_update[] = __('Font path'); + if (!config_update_value ('font_size', get_parameter('font_size'))) + $error_update[] = __('Font size'); + if (!config_update_value ('flash_charts', (bool) get_parameter ('flash_charts'))) + $error_update[] = __('Interactive charts'); + if (!config_update_value ('custom_logo', (string) get_parameter ('custom_logo'))) + $error_update[] = __('Custom logo'); + if (!config_update_value ('enable_refr', get_parameter('enable_refr'))) + $error_update[] = __('Enable refresh for all pages'); + if (!config_update_value ('refr', get_parameter('refr'))) + $error_update[] = __('Global default interval for refresh'); + if (!config_update_value ('vc_refr', get_parameter('vc_refr'))) + $error_update[] = __('Default interval for refresh on Visual Console'); + if (!config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small'))) + $error_update[] = __('Agent size text'); + if (!config_update_value ('agent_size_text_medium', get_parameter('agent_size_text_medium'))) + $error_update[] = __('Agent size text'); + if (!config_update_value ('module_size_text_small', get_parameter('module_size_text_small'))) + $error_update[] = __('Module size text'); + if (!config_update_value ('module_size_text_medium', get_parameter('module_size_text_medium'))) + $error_update[] = __('Description size text'); + if (!config_update_value ('description_size_text', get_parameter('description_size_text'))) + $error_update[] = __('Description size text'); + if (!config_update_value ('item_title_size_text', get_parameter('item_title_size_text'))) + $error_update[] = __('Item title size text'); + if (!config_update_value ('gis_label', get_parameter ('gis_label'))) + $error_update[] = __('GIS Labels'); + if (!config_update_value ('gis_default_icon', get_parameter ('gis_default_icon'))) + $error_update[] = __('Default icon in GIS'); $interval_values = get_parameter ('interval_values'); @@ -297,27 +439,49 @@ function config_update_config () { $interval_values = implode(',',$interval_values_array); } - config_update_value ('interval_values', $interval_values); + if (!config_update_value ('interval_values', $interval_values)) + $error_update[] = __('Delete interval'); break; case 'net': - config_update_value ('netflow_path', get_parameter ('netflow_path')); - config_update_value ('netflow_interval', (int)get_parameter ('netflow_interval')); - config_update_value ('netflow_daemon', get_parameter ('netflow_daemon')); - config_update_value ('netflow_nfdump', get_parameter ('netflow_nfdump')); - config_update_value ('netflow_nfexpire', get_parameter ('netflow_nfexpire')); - config_update_value ('netflow_max_resolution', (int)get_parameter ('netflow_max_resolution')); - config_update_value ('netflow_disable_custom_lvfilters', get_parameter ('netflow_disable_custom_lvfilters')); - config_update_value ('netflow_max_lifetime', (int) get_parameter ('netflow_max_lifetime')); + if (!config_update_value ('netflow_path', get_parameter ('netflow_path'))) + $error_update[] = __('Data storage path'); + if (!config_update_value ('netflow_interval', (int)get_parameter ('netflow_interval'))) + $error_update[] = __('Daemon interval'); + if (!config_update_value ('netflow_daemon', get_parameter ('netflow_daemon'))) + $error_update[] = __('Daemon binary path'); + if (!config_update_value ('netflow_nfdump', get_parameter ('netflow_nfdump'))) + $error_update[] = __('Nfdump binary path'); + if (!config_update_value ('netflow_nfexpire', get_parameter ('netflow_nfexpire'))) + $error_update[] = __('Nfexpire binary path'); + if (!config_update_value ('netflow_max_resolution', (int)get_parameter ('netflow_max_resolution'))) + $error_update[] = __('Maximum chart resolution'); + if (!config_update_value ('netflow_disable_custom_lvfilters', get_parameter ('netflow_disable_custom_lvfilters'))) + $error_update[] = __('Disable custom live view filters'); + if (!config_update_value ('netflow_max_lifetime', (int) get_parameter ('netflow_max_lifetime'))) + $error_update[] = __('Netflow max lifetime'); break; case 'log': - config_update_value ('log_dir', get_parameter('log_dir')); - config_update_value ('log_max_lifetime', (int)get_parameter('log_max_lifetime')); + if (!config_update_value ('log_dir', get_parameter('log_dir'))) + $error_update[] = __('Netflow max lifetime'); + if (!config_update_value ('log_max_lifetime', (int)get_parameter('log_max_lifetime'))) + $error_update[] = __('Log max lifetime'); break; } + + + } - + if (count($error_update) > 0) { + $config['error_config_update_config'] = array(); + $config['error_config_update_config']['correct'] = false; + $values = implode(', ', $error_update); + $config['error_config_update_config']['message'] = sprint(__('Failed updated: the next values cannot update: %s'), $values); + } + else { + $config['error_config_update_config'] = array(); + $config['error_config_update_config']['correct'] = true; } enterprise_include_once('include/functions_policies.php'); diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index c9672dade0..86a6aff814 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -231,7 +231,7 @@ if ($config['activate_gis'] || $agent['url_address'] != '') { } // ACCESS RATE GRAPH -if($config["agentaccess"]) { +if ($config["agentaccess"]) { $data = array(); $data[0] = '' . __('Agent access rate (24h)') . ''; $data[1] = graphic_agentaccess($id_agente, 300, 110, 86400, true); @@ -268,29 +268,4 @@ foreach ($fields as $field) { html_print_table($table); unset($table); - -/* - * ACCESS RATE GRAPH IN HIDDEN BAR -if($config["agentaccess"]) { - $params = array(); - $params['position'] = 'bottom'; - $params['icon_closed'] = 'images/setup.png'; - $params['body_text'] = ''; - $params['body_text'] .= ''.__('Agent access rate (24h)').'
'; - $params['body_text'] .= '
' . graphic_agentaccess($id_agente, 300, 110, 8640000, true) . '
'; - - $params['icon_closed'] = '/images/chart_curve'; - $params['icon_open'] = '/images/chart_curve'; - $params['height'] = '300px'; - $params['top'] = 'auto_below'; - $params['autotop'] = 'agent_details'; - $params['right'] = 'auto_right'; - $params['autoright'] = 'agent_details'; - $params['icon_width'] = 16; - $params['icon_height'] = 16; - $params['vertical_mode'] = 'in'; - - html_print_side_layer($params); -} -*/ -?> +?> \ No newline at end of file