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
0aeae92b35
commit
5c05258961
|
@ -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>
|
2013-02-27 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* include/functions_config.php: Include a library in
|
* 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
|
* @param $thrash3 Don't use
|
||||||
*/
|
*/
|
||||||
function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
||||||
if ($id == ""){
|
if ($id == "") {
|
||||||
returnError('error_update_plugin_module_policy', __('Error updating plugin module in policy. Id_policy cannot be left blank.'));
|
returnError('error_update_plugin_module_policy',
|
||||||
|
__('Error updating plugin module in policy. Id_policy cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][0] == ""){
|
if ($other['data'][0] == "") {
|
||||||
returnError('error_update_plugin_module_policy', __('Error updating plugin module in policy. Id_policy_module cannot be left blank.'));
|
returnError('error_update_plugin_module_policy',
|
||||||
|
__('Error updating plugin module in policy. Id_policy_module cannot be left blank.'));
|
||||||
return;
|
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'));
|
$module_policy = enterprise_hook('policies_get_modules', array($id, array('id' => $other['data'][0]), 'id_module'));
|
||||||
|
|
||||||
if ($module_policy === false) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($module_policy[0]['id_module'] != 4){
|
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.'));
|
returnError('error_updating_plugin_module_policy',
|
||||||
|
__('Error updating plugin module in policy. Module type is not network type.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields_plugin_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical',
|
$fields_plugin_module = array('id','disabled', 'id_module_group',
|
||||||
'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'snmp_community',
|
'min_warning', 'max_warning', 'str_warning', 'min_critical',
|
||||||
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description', 'id_plugin', 'plugin_user',
|
'max_critical', 'str_critical', 'min_ff_event', 'history_data',
|
||||||
'plugin_pass', 'plugin_parameter');
|
'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;
|
$cont = 0;
|
||||||
foreach ($fields_plugin_module as $field){
|
foreach ($fields_plugin_module as $field) {
|
||||||
if ($other['data'][$cont] != "" and $field != 'id'){
|
if ($other['data'][$cont] != "" and $field != 'id') {
|
||||||
$values[$field] = $other['data'][$cont];
|
$values[$field] = $other['data'][$cont];
|
||||||
}
|
}
|
||||||
|
|
||||||
$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)
|
if ($result_update < 0)
|
||||||
|
@ -3519,12 +3526,12 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
||||||
* @param $thrash3 Don't use
|
* @param $thrash3 Don't use
|
||||||
*/
|
*/
|
||||||
function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
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.'));
|
returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Id_policy cannot be left blank.'));
|
||||||
return;
|
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.'));
|
returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Id_policy_module cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3537,7 +3544,7 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
||||||
return;
|
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.'));
|
returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Module type is not SNMP type.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3576,8 +3583,8 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$cont = 0;
|
$cont = 0;
|
||||||
foreach ($fields_snmp_module as $field){
|
foreach ($fields_snmp_module as $field) {
|
||||||
if ($other['data'][$cont] != "" and $field != 'id'){
|
if ($other['data'][$cont] != "" and $field != 'id') {
|
||||||
$values[$field] = $other['data'][$cont];
|
$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')))
|
if (!config_update_value ('log_max_lifetime', (int)get_parameter('log_max_lifetime')))
|
||||||
$error_update[] = __('Log max lifetime');
|
$error_update[] = __('Log max lifetime');
|
||||||
break;
|
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