2013-02-28 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php: added code to set the config options for the history actions. Fixes: #3606285 * include/functions_api.php: improved the source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7738 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
1d27ca8df2
commit
696700f0ef
|
@ -1,3 +1,12 @@
|
|||
2013-02-28 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_config.php: added code to set the config options
|
||||
for the history actions.
|
||||
|
||||
Fixes: #3606285
|
||||
|
||||
* include/functions_api.php: improved the source code style.
|
||||
|
||||
2013-02-27 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_config.php: Include a library in
|
||||
|
|
|
@ -3191,13 +3191,15 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
||||
if ($id == ""){
|
||||
returnError('error_update_plugin_module_policy', __('Error updating plugin module in policy. Id_policy cannot be left blank.'));
|
||||
if ($id == "") {
|
||||
returnError('error_update_plugin_module_policy',
|
||||
__('Error updating plugin module in policy. Id_policy cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][0] == ""){
|
||||
returnError('error_update_plugin_module_policy', __('Error updating plugin module in policy. Id_policy_module cannot be left blank.'));
|
||||
if ($other['data'][0] == "") {
|
||||
returnError('error_update_plugin_module_policy',
|
||||
__('Error updating plugin module in policy. Id_policy_module cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3205,30 +3207,35 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
$module_policy = enterprise_hook('policies_get_modules', array($id, array('id' => $other['data'][0]), 'id_module'));
|
||||
|
||||
if ($module_policy === false) {
|
||||
returnError('error_updating_plugin_module_policy', __('Error updating plugin module in policy. Module doesn\'t exists.'));
|
||||
returnError('error_updating_plugin_module_policy',
|
||||
__('Error updating plugin module in policy. Module doesn\'t exists.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($module_policy[0]['id_module'] != 4){
|
||||
returnError('error_updating_plugin_module_policy', __('Error updating plugin module in policy. Module type is not network type.'));
|
||||
if ($module_policy[0]['id_module'] != 4) {
|
||||
returnError('error_updating_plugin_module_policy',
|
||||
__('Error updating plugin module in policy. Module type is not network type.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$fields_plugin_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical',
|
||||
'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'snmp_community',
|
||||
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description', 'id_plugin', 'plugin_user',
|
||||
'plugin_pass', 'plugin_parameter');
|
||||
$fields_plugin_module = array('id','disabled', 'id_module_group',
|
||||
'min_warning', 'max_warning', 'str_warning', 'min_critical',
|
||||
'max_critical', 'str_critical', 'min_ff_event', 'history_data',
|
||||
'tcp_port', 'snmp_community', 'snmp_oid', 'module_interval',
|
||||
'post_process', 'min', 'max', 'custom_id', 'description',
|
||||
'id_plugin', 'plugin_user', 'plugin_pass', 'plugin_parameter');
|
||||
|
||||
$cont = 0;
|
||||
foreach ($fields_plugin_module as $field){
|
||||
if ($other['data'][$cont] != "" and $field != 'id'){
|
||||
foreach ($fields_plugin_module as $field) {
|
||||
if ($other['data'][$cont] != "" and $field != 'id') {
|
||||
$values[$field] = $other['data'][$cont];
|
||||
}
|
||||
|
||||
$cont++;
|
||||
}
|
||||
|
||||
$result_update = enterprise_hook('policies_update_module', array($other['data'][0], $values, false));
|
||||
$result_update = enterprise_hook('policies_update_module',
|
||||
array($other['data'][0], $values, false));
|
||||
|
||||
|
||||
if ($result_update < 0)
|
||||
|
@ -3519,12 +3526,12 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
||||
if ($id == ""){
|
||||
if ($id == "") {
|
||||
returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Id_policy cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][0] == ""){
|
||||
if ($other['data'][0] == "") {
|
||||
returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Id_policy_module cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
@ -3537,7 +3544,7 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($module_policy[0]['id_module'] != 2){
|
||||
if ($module_policy[0]['id_module'] != 2) {
|
||||
returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Module type is not SNMP type.'));
|
||||
return;
|
||||
}
|
||||
|
@ -3576,8 +3583,8 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
}
|
||||
|
||||
$cont = 0;
|
||||
foreach ($fields_snmp_module as $field){
|
||||
if ($other['data'][$cont] != "" and $field != 'id'){
|
||||
foreach ($fields_snmp_module as $field) {
|
||||
if ($other['data'][$cont] != "" and $field != 'id') {
|
||||
$values[$field] = $other['data'][$cont];
|
||||
}
|
||||
|
||||
|
|
|
@ -470,6 +470,26 @@ function config_update_config () {
|
|||
if (!config_update_value ('log_max_lifetime', (int)get_parameter('log_max_lifetime')))
|
||||
$error_update[] = __('Log max lifetime');
|
||||
break;
|
||||
case 'hist_db':
|
||||
if (!config_update_value ('history_db_enabled', get_parameter ('history_db_enabled')))
|
||||
$error_update[] = __('Enable history database');
|
||||
if (!config_update_value ('history_db_host', get_parameter ('history_db_host')))
|
||||
$error_update[] = __('Host');
|
||||
if (!config_update_value ('history_db_port', get_parameter ('history_db_port')))
|
||||
$error_update[] = __('Port');
|
||||
if (!config_update_value ('history_db_name', get_parameter ('history_db_name')))
|
||||
$error_update[] = __('Database name');
|
||||
if (!config_update_value ('history_db_user', get_parameter ('history_db_user')))
|
||||
$error_update[] = __('Database user');
|
||||
if (!config_update_value ('history_db_pass', get_parameter ('history_db_pass')))
|
||||
$error_update[] = __('Database password');
|
||||
if (!config_update_value ('history_db_days', get_parameter ('history_db_days')))
|
||||
$error_update[] = __('Days');
|
||||
if (!config_update_value ('history_db_step', get_parameter ('history_db_step')))
|
||||
$error_update[] = __('Step');
|
||||
if (!config_update_value ('history_db_delay', get_parameter ('history_db_delay')))
|
||||
$error_update[] = __('Delay');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue