2013-08-29 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php: added supoport for disabled unknown events modules, components and policies. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8711 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a87218f09e
commit
967e978fea
|
@ -1,3 +1,8 @@
|
|||
2013-08-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_api.php: added supoport for disabled unknown
|
||||
events modules, components and policies.
|
||||
|
||||
2013-08-28 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/agentes/module_manager_editor_common.php: added code to
|
||||
|
|
|
@ -1229,17 +1229,23 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3) {
|
|||
$idAgent = agents_get_agent_id($agentName);
|
||||
|
||||
if (!$idAgent) {
|
||||
returnError('error_create_network_module', __('Error in creation network module. Agent name doesn\'t exists.'));
|
||||
returnError('error_create_network_module',
|
||||
__('Error in creation network module. Agent name doesn\'t exists.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][2] < 6 or $other['data'][2] > 18) {
|
||||
returnError('error_create_network_module', __('Error in creation network module. Id_module_type is not correct for network modules.'));
|
||||
returnError('error_create_network_module',
|
||||
__('Error in creation network module. Id_module_type is not correct for network modules.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$name = $other['data'][0];
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][22]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$values = array(
|
||||
'id_agente' => $idAgent,
|
||||
'disabled' => $other['data'][1],
|
||||
|
@ -1263,7 +1269,8 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3) {
|
|||
'max' => $other['data'][19],
|
||||
'custom_id' => $other['data'][20],
|
||||
'descripcion' => $other['data'][21],
|
||||
'id_modulo' => 2
|
||||
'id_modulo' => 2,
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
|
||||
$idModule = modules_create_agent_module($idAgent, $name, $values, true);
|
||||
|
@ -1316,15 +1323,35 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3){
|
|||
$id_module_exists = db_get_value_filter ('id_agente_modulo', 'tagente_modulo', array('nombre' => $module_name, 'id_agente' => $other['data'][0]));
|
||||
|
||||
if ($id_module_exists){
|
||||
returnError('error_update_network_module', __('Error updating network module. Id_module exists in the new agent.'));
|
||||
returnError('error_update_network_module',
|
||||
__('Error updating network module. Id_module exists in the new agent.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$network_module_fields = array('id_agente', 'disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning',
|
||||
'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'ip_target', 'tcp_port', 'snmp_community',
|
||||
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'descripcion');
|
||||
$network_module_fields = array('id_agente',
|
||||
'disabled',
|
||||
'id_module_group',
|
||||
'min_warning',
|
||||
'max_warning',
|
||||
'str_warning',
|
||||
'min_critical',
|
||||
'max_critical',
|
||||
'str_critical',
|
||||
'min_ff_event',
|
||||
'history_data',
|
||||
'ip_target',
|
||||
'tcp_port',
|
||||
'snmp_community',
|
||||
'snmp_oid',
|
||||
'module_interval',
|
||||
'post_process',
|
||||
'min',
|
||||
'max',
|
||||
'custom_id',
|
||||
'descripcion',
|
||||
'disabled_types_event');
|
||||
|
||||
$values = array();
|
||||
$cont = 0;
|
||||
|
@ -1375,6 +1402,10 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3) {
|
|||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][26]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$name = $other['data'][0];
|
||||
|
||||
$values = array(
|
||||
|
@ -1404,7 +1435,8 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3) {
|
|||
'id_plugin' => $other['data'][22],
|
||||
'plugin_user' => $other['data'][23],
|
||||
'plugin_pass' => $other['data'][24],
|
||||
'plugin_parameter' => $other['data'][25]
|
||||
'plugin_parameter' => $other['data'][25],
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
|
||||
$idModule = modules_create_agent_module($idAgent, $name, $values, true);
|
||||
|
@ -1462,10 +1494,32 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3){
|
|||
}
|
||||
}
|
||||
|
||||
$plugin_module_fields = array('id_agente', 'disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning',
|
||||
'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'ip_target',
|
||||
'tcp_port', 'snmp_community', 'snmp_oid', 'module_interval', 'post_process', 'min', 'max',
|
||||
'custom_id', 'descripcion', 'id_plugin', 'plugin_user', 'plugin_pass', 'plugin_parameter');
|
||||
$plugin_module_fields = array('id_agente',
|
||||
'disabled',
|
||||
'id_module_group',
|
||||
'min_warning',
|
||||
'max_warning',
|
||||
'str_warning',
|
||||
'min_critical',
|
||||
'max_critical',
|
||||
'str_critical',
|
||||
'min_ff_event',
|
||||
'history_data',
|
||||
'ip_target',
|
||||
'tcp_port',
|
||||
'snmp_community',
|
||||
'snmp_oid',
|
||||
'module_interval',
|
||||
'post_process',
|
||||
'min',
|
||||
'max',
|
||||
'custom_id',
|
||||
'descripcion',
|
||||
'id_plugin',
|
||||
'plugin_user',
|
||||
'plugin_pass',
|
||||
'plugin_parameter',
|
||||
'disabled_types_event');
|
||||
|
||||
$values = array();
|
||||
$cont = 0;
|
||||
|
@ -1518,6 +1572,10 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3) {
|
|||
|
||||
$name = $other['data'][0];
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][16]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$values = array(
|
||||
'id_agente' => $idAgent,
|
||||
'disabled' => $other['data'][1],
|
||||
|
@ -1535,7 +1593,8 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3) {
|
|||
'max_critical' => $other['data'][13],
|
||||
'str_critical' => $other['data'][14],
|
||||
'history_data' => $other['data'][15],
|
||||
'id_modulo' => 1
|
||||
'id_modulo' => 1,
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
|
||||
$idModule = modules_create_agent_module($idAgent, $name, $values, true);
|
||||
|
@ -1594,9 +1653,22 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3){
|
|||
}
|
||||
}
|
||||
|
||||
$data_module_fields = array('id_agente', 'disabled', 'descripcion', 'id_module_group', 'min', 'max',
|
||||
'post_process', 'module_interval', 'min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical',
|
||||
'history_data');
|
||||
$data_module_fields = array('id_agente',
|
||||
'disabled',
|
||||
'descripcion',
|
||||
'id_module_group',
|
||||
'min',
|
||||
'max',
|
||||
'post_process',
|
||||
'module_interval',
|
||||
'min_warning',
|
||||
'max_warning',
|
||||
'str_warning',
|
||||
'min_critical',
|
||||
'max_critical',
|
||||
'str_critical',
|
||||
'history_data',
|
||||
'disabled_types_event');
|
||||
|
||||
$values = array();
|
||||
$cont = 0;
|
||||
|
@ -1662,6 +1734,11 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) {
|
|||
|
||||
$name = $other['data'][0];
|
||||
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][27]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
# SNMP version 3
|
||||
if ($other['data'][14] == "3") {
|
||||
|
||||
|
@ -1710,7 +1787,8 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) {
|
|||
'custom_string_3' => $other['data'][25],
|
||||
'plugin_parameter' => $other['data'][26],
|
||||
'plugin_user' => $other['data'][27],
|
||||
'plugin_pass' => $other['data'][28]
|
||||
'plugin_pass' => $other['data'][28],
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -1738,7 +1816,8 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) {
|
|||
'max' => $other['data'][20],
|
||||
'custom_id' => $other['data'][21],
|
||||
'descripcion' => $other['data'][22],
|
||||
'id_modulo' => 2
|
||||
'id_modulo' => 2,
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1818,15 +1897,60 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
|
|||
return;
|
||||
}
|
||||
|
||||
$snmp_module_fields = array('id_agente', 'disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning',
|
||||
'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'ip_target', 'tcp_port', 'tcp_send',
|
||||
'snmp_community', 'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'descripcion', 'custom_string_1',
|
||||
'custom_string_2', 'custom_string_3', 'plugin_parameter', 'plugin_user', 'plugin_pass');
|
||||
$snmp_module_fields = array('id_agente',
|
||||
'disabled',
|
||||
'id_module_group',
|
||||
'min_warning',
|
||||
'max_warning',
|
||||
'str_warning',
|
||||
'min_critical',
|
||||
'max_critical',
|
||||
'str_critical',
|
||||
'min_ff_event',
|
||||
'history_data',
|
||||
'ip_target',
|
||||
'tcp_port',
|
||||
'tcp_send',
|
||||
'snmp_community',
|
||||
'snmp_oid',
|
||||
'module_interval',
|
||||
'post_process',
|
||||
'min',
|
||||
'max',
|
||||
'custom_id',
|
||||
'descripcion',
|
||||
'custom_string_1',
|
||||
'custom_string_2',
|
||||
'custom_string_3',
|
||||
'plugin_parameter',
|
||||
'plugin_user',
|
||||
'plugin_pass',
|
||||
'disabled_types_event');
|
||||
}
|
||||
else {
|
||||
$snmp_module_fields = array('id_agente', 'disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning',
|
||||
'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'ip_target', 'tcp_port', 'tcp_send',
|
||||
'snmp_community', 'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'descripcion');
|
||||
$snmp_module_fields = array('id_agente',
|
||||
'disabled',
|
||||
'id_module_group',
|
||||
'min_warning',
|
||||
'max_warning',
|
||||
'str_warning',
|
||||
'min_critical',
|
||||
'max_critical',
|
||||
'str_critical',
|
||||
'min_ff_event',
|
||||
'history_data',
|
||||
'ip_target',
|
||||
'tcp_port',
|
||||
'tcp_send',
|
||||
'snmp_community',
|
||||
'snmp_oid',
|
||||
'module_interval',
|
||||
'post_process',
|
||||
'min',
|
||||
'max',
|
||||
'custom_id',
|
||||
'descripcion',
|
||||
'disabled_types_event');
|
||||
}
|
||||
|
||||
$values = array();
|
||||
|
@ -1882,6 +2006,10 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2) {
|
|||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][18]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$values = array (
|
||||
'description' => $other['data'][1],
|
||||
'module_interval' => $other['data'][2],
|
||||
|
@ -1901,7 +2029,7 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2) {
|
|||
'min_ff_event' => $other['data'][15],
|
||||
'post_process' => $other['data'][16],
|
||||
'max_retries' => $other['data'][17],
|
||||
);
|
||||
'disabled_types_event' => $disabled_types_event);
|
||||
|
||||
$name_check = db_get_value ('name', 'tnetwork_component', 'name', $id);
|
||||
|
||||
|
@ -1953,6 +2081,10 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2) {
|
|||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][12]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$values = array (
|
||||
'description' => $other['data'][1],
|
||||
'module_interval' => $other['data'][2],
|
||||
|
@ -1975,7 +2107,8 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2) {
|
|||
'str_critical' => $other['data'][18],
|
||||
'min_ff_event' => $other['data'][19],
|
||||
'post_process' => $other['data'][20],
|
||||
'max_retries' => $other['data'][11]);
|
||||
'max_retries' => $other['data'][11],
|
||||
'disabled_types_event' => $disabled_types_event);
|
||||
|
||||
$name_check = db_get_value ('name', 'tnetwork_component', 'name', $id);
|
||||
|
||||
|
@ -2028,6 +2161,10 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) {
|
|||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][27]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
# SNMP version 3
|
||||
if ($other['data'][16] == "3") {
|
||||
|
||||
|
@ -2074,6 +2211,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) {
|
|||
'plugin_parameter' => $other['data'][24], // snmp3_auth_method
|
||||
'custom_string_3' => $other['data'][25], // snmp3_security_level
|
||||
'max_retries' => $other['data'][26],
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -2101,6 +2239,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) {
|
|||
'tcp_port' => $other['data'][21],
|
||||
'id_modulo' => 2,
|
||||
'max_retries' => $other['data'][22],
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2138,33 +2277,43 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) {
|
|||
function api_set_new_local_component($id, $thrash1, $other, $thrash2) {
|
||||
|
||||
if ($id == "") {
|
||||
returnError('error_set_new_local_component', __('Error creating local component. Local component name cannot be left blank.'));
|
||||
returnError('error_set_new_local_component',
|
||||
__('Error creating local component. Local component name cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][1] == "") {
|
||||
returnError('error_set_new_local_component', __('Error creating local component. Local component group cannot be left blank.'));
|
||||
returnError('error_set_new_local_component',
|
||||
__('Error creating local component. Local component group cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][4]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$values = array (
|
||||
'description' => $other['data'][0],
|
||||
'id_network_component_group' => $other['data'][1]
|
||||
);
|
||||
'id_network_component_group' => $other['data'][1],
|
||||
'disabled_types_event' => $disabled_types_event);
|
||||
|
||||
$name_check = enterprise_hook('local_components_get_local_components', array(array('name' => $id), 'name'));
|
||||
$name_check = enterprise_hook('local_components_get_local_components',
|
||||
array(array('name' => $id), 'name'));
|
||||
|
||||
if ($name_check === ENTERPRISE_NOT_HOOK) {
|
||||
returnError('error_set_new_local_component', __('Error creating local component.'));
|
||||
returnError('error_set_new_local_component',
|
||||
__('Error creating local component.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($name_check !== false) {
|
||||
returnError('error_set_new_local_component', __('Error creating local component. This local component already exists.'));
|
||||
returnError('error_set_new_local_component',
|
||||
__('Error creating local component. This local component already exists.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$id = enterprise_hook('local_components_create_local_component', array($id, $other['data'][3], $other['data'][1], $values));
|
||||
$id = enterprise_hook('local_components_create_local_component',
|
||||
array($id, $other['data'][3], $other['data'][1], $values));
|
||||
|
||||
if (!$id)
|
||||
returnError('error_set_new_local_component', 'Error creating local component.');
|
||||
|
@ -2997,6 +3146,10 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][16]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$values = array();
|
||||
$values['id_tipo_modulo'] = $other['data'][1];
|
||||
$values['description'] = $other['data'][2];
|
||||
|
@ -3013,15 +3166,18 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
$values['str_critical'] = $other['data'][13];
|
||||
$values['history_data'] = $other['data'][14];
|
||||
$values['configuration_data'] = $other['data'][15];
|
||||
$values['disabled_types_event'] = $disabled_types_event;
|
||||
|
||||
if ($name_module_policy !== false) {
|
||||
if ($name_module_policy[0]['name'] == $other['data'][0]) {
|
||||
returnError('error_add_data_module_policy', __('Error adding data module to policy. The module is already in the policy.'));
|
||||
returnError('error_add_data_module_policy',
|
||||
__('Error adding data module to policy. The module is already in the policy.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$success = enterprise_hook('policies_create_module', array($other['data'][0], $id, 1, $values, false));
|
||||
$success = enterprise_hook('policies_create_module',
|
||||
array($other['data'][0], $id, 1, $values, false));
|
||||
|
||||
if ($success)
|
||||
//returnData('string', array('type' => 'string', 'data' => __('Data module added to policy. Is necessary to apply the policy in order to changes take effect.')));
|
||||
|
@ -3115,28 +3271,37 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
*/
|
||||
function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) {
|
||||
if ($id == "") {
|
||||
returnError('error_network_data_module_policy', __('Error adding network module to policy. Id_policy cannot be left blank.'));
|
||||
returnError('error_network_data_module_policy',
|
||||
__('Error adding network module to policy. Id_policy cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][0] == "") {
|
||||
returnError('error_network_data_module_policy', __('Error adding network module to policy. Module_name cannot be left blank.'));
|
||||
returnError('error_network_data_module_policy',
|
||||
__('Error adding network module to policy. Module_name cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][1] < 6 or $other['data'][1] > 18) {
|
||||
returnError('error_network_data_module_policy', __('Error adding network module to policy. Id_module_type is not correct for network modules.'));
|
||||
returnError('error_network_data_module_policy',
|
||||
__('Error adding network module to policy. Id_module_type is not correct for network modules.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the module is already in the policy
|
||||
$name_module_policy = enterprise_hook('policies_get_modules', array($id, array('name'=>$other['data'][0]), 'name'));
|
||||
$name_module_policy = enterprise_hook('policies_get_modules',
|
||||
array($id, array('name'=>$other['data'][0]), 'name'));
|
||||
|
||||
if ($name_module_policy === ENTERPRISE_NOT_HOOK) {
|
||||
returnError('error_network_data_module_policy', __('Error adding network module to policy.'));
|
||||
returnError('error_network_data_module_policy',
|
||||
__('Error adding network module to policy.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][21]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$values = array();
|
||||
$values['id_tipo_modulo'] = $other['data'][1];
|
||||
$values['description'] = $other['data'][2];
|
||||
|
@ -3158,6 +3323,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
$values['snmp_community'] = $other['data'][18];
|
||||
$values['snmp_oid'] = $other['data'][19];
|
||||
$values['custom_id'] = $other['data'][20];
|
||||
$values['disabled_types_event'] = $disabled_types_event;
|
||||
|
||||
if ($name_module_policy !== false) {
|
||||
if ($name_module_policy[0]['name'] == $other['data'][0]){
|
||||
|
@ -3194,12 +3360,14 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
*/
|
||||
function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3) {
|
||||
if ($id == "") {
|
||||
returnError('error_update_network_module_policy', __('Error updating network module in policy. Id_policy cannot be left blank.'));
|
||||
returnError('error_update_network_module_policy',
|
||||
__('Error updating network module in policy. Id_policy cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][0] == "") {
|
||||
returnError('error_update_network_module_policy', __('Error updating network module in policy. Id_policy_module cannot be left blank.'));
|
||||
returnError('error_update_network_module_policy',
|
||||
__('Error updating network module in policy. Id_policy_module cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3207,12 +3375,14 @@ function api_set_update_network_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_update_network_module_policy', __('Error updating network module in policy. Module doesn\'t exists.'));
|
||||
returnError('error_update_network_module_policy',
|
||||
__('Error updating network module in policy. Module doesn\'t exists.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($module_policy[0]['id_module'] != 2) {
|
||||
returnError('error_update_network_module_policy', __('Error updating network module in policy. Module type is not network type.'));
|
||||
returnError('error_update_network_module_policy',
|
||||
__('Error updating network module in policy. Module type is not network type.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3281,6 +3451,10 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][25]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
$values = array();
|
||||
$values['disabled'] = $other['data'][1];
|
||||
$values['id_tipo_modulo'] = $other['data'][2];
|
||||
|
@ -3306,6 +3480,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
$values['plugin_user'] = $other['data'][22];
|
||||
$values['plugin_pass'] = $other['data'][23];
|
||||
$values['plugin_parameter'] = $other['data'][24];
|
||||
$values['disabled_types_event'] = $disabled_types_event;
|
||||
|
||||
if ($name_module_policy !== false) {
|
||||
if ($name_module_policy[0]['name'] == $other['data'][0]) {
|
||||
|
@ -3566,6 +3741,10 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
return;
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][28]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
# SNMP version 3
|
||||
if ($other['data'][13] == "3") {
|
||||
|
||||
|
@ -3611,7 +3790,8 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
'custom_string_3' => $other['data'][24],
|
||||
'plugin_parameter' => $other['data'][25],
|
||||
'plugin_user' => $other['data'][26],
|
||||
'plugin_pass' => $other['data'][27]
|
||||
'plugin_pass' => $other['data'][27],
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -3636,7 +3816,8 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||
'min' => $other['data'][18],
|
||||
'max' => $other['data'][19],
|
||||
'custom_id' => $other['data'][20],
|
||||
'description' => $other['data'][21]
|
||||
'description' => $other['data'][21],
|
||||
'disabled_types_event' => $disabled_types_event
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4139,19 +4320,31 @@ function api_set_new_user($id, $thrash2, $other, $thrash3) {
|
|||
*/
|
||||
function api_set_update_user($id, $thrash2, $other, $thrash3) {
|
||||
|
||||
$fields_user = array('fullname', 'firstname', 'lastname', 'middlename', 'password', 'email',
|
||||
'phone', 'language', 'comments', 'is_admin', 'block_size', 'flash_chart');
|
||||
$fields_user = array('fullname',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'middlename',
|
||||
'password',
|
||||
'email',
|
||||
'phone',
|
||||
'language',
|
||||
'comments',
|
||||
'is_admin',
|
||||
'block_size',
|
||||
'flash_chart');
|
||||
|
||||
|
||||
if ($id == "") {
|
||||
returnError('error_update_user', __('Error updating user. Id_user cannot be left blank.'));
|
||||
returnError('error_update_user',
|
||||
__('Error updating user. Id_user cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$result_user = users_get_user_by_id($id);
|
||||
|
||||
if (!$result_user) {
|
||||
returnError('error_update_user', __('Error updating user. Id_user doesn\'t exists.'));
|
||||
returnError('error_update_user',
|
||||
__('Error updating user. Id_user doesn\'t exists.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4625,9 +4818,15 @@ function api_set_new_module($id, $id2, $other, $trash1) {
|
|||
$values['history_data'] = $other['data'][14];
|
||||
}
|
||||
|
||||
$disabled_types_event = array();
|
||||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int)!$other['data'][15]);
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
$values['disabled_types_event'] = $disabled_types_event;
|
||||
|
||||
$values['id_modulo'] = 2;
|
||||
|
||||
$return = modules_create_agent_module($values['id_agente'], $values['nombre'], $values);
|
||||
$return = modules_create_agent_module($values['id_agente'],
|
||||
$values['nombre'], $values);
|
||||
|
||||
$data['type'] = 'string';
|
||||
if ($return === false) {
|
||||
|
@ -4824,7 +5023,8 @@ function api_set_new_event($trash1, $trash2, $other, $trash3) {
|
|||
FROM talert_template_modules AS t1
|
||||
INNER JOIN talert_templates AS t2
|
||||
ON t1.id_alert_template = t2.id
|
||||
WHERE t1.id_agent_module = 1 AND t2.name LIKE '" . $other['data'][7] . "'");
|
||||
WHERE t1.id_agent_module = 1
|
||||
AND t2.name LIKE '" . $other['data'][7] . "'");
|
||||
|
||||
if ($idAlert === false) {
|
||||
returnError('error_parameter', 'Error in the parameters.');
|
||||
|
|
Loading…
Reference in New Issue