2010-10-29 Miguel de Dios <miguel.dedios@artica.es>

* extensions/dbmanager.php, godmode/agentes/module_manager_editor.php,
	godmode/massive/massive_add_alerts.php,
	godmode/massive/massive_copy_modules.php,
	godmode/massive/massive_delete_agents.php,
	godmode/massive/massive_enable_disable_alerts.php,
	godmode/massive/massive_operations.php,
	godmode/massive/massive_delete_profiles.php,
	godmode/massive/massive_edit_agents.php,
	godmode/massive/massive_delete_action_alerts.php,
	godmode/massive/massive_delete_modules.php,
	godmode/massive/massive_add_profiles.php,
	godmode/massive/massive_delete_alerts.php,
	godmode/massive/massive_edit_modules.php,
	godmode/massive/massive_standby_alerts.php,
	godmode/massive/massive_add_action_alerts.php:  now in the source code pick
	more info in the audit for actions.
	
	Pending tasks: #3089687



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3480 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-10-29 12:35:34 +00:00
parent ca2b11c3ec
commit 4c5e817aff
17 changed files with 271 additions and 72 deletions

View File

@ -1,3 +1,24 @@
2010-10-29 Miguel de Dios <miguel.dedios@artica.es>
* extensions/dbmanager.php, godmode/agentes/module_manager_editor.php,
godmode/massive/massive_add_alerts.php,
godmode/massive/massive_copy_modules.php,
godmode/massive/massive_delete_agents.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.php: now in the source code pick
more info in the audit for actions.
Pending tasks: #3089687
2010-10-29 Miguel de Dios <miguel.dedios@artica.es> 2010-10-29 Miguel de Dios <miguel.dedios@artica.es>
* godmode/massive/massive_delete_profiles.php: fixed result message of * godmode/massive/massive_delete_profiles.php: fixed result message of

View File

@ -91,11 +91,17 @@ function dbmgr_extension_main () {
if ($result === false) { if ($result === false) {
echo '<strong>An error has occured when querying the database.</strong><br />'; echo '<strong>An error has occured when querying the database.</strong><br />';
echo $error; echo $error;
pandora_audit("Extension DB inface", "Error in SQL", false, false, $sql);
return; return;
} }
if (! is_array ($result)) { if (! is_array ($result)) {
echo "<strong>Output: <strong>".$result; echo "<strong>Output: <strong>".$result;
pandora_audit("Extension DB inface", "SQL", false, false, $sql);
return; return;
} }

View File

@ -221,11 +221,15 @@ $unlink_policy = get_parameter('unlink_policy', 0);
if($relink_policy) { if($relink_policy) {
$result = relink_module_policy($id_agent_module); $result = relink_module_policy($id_agent_module);
print_result_message($result, 'Module relinked to the policy successful'); print_result_message($result, 'Module relinked to the policy successful');
pandora_audit("Agent management", "Re-link module " . $id_agent_module);
} }
if($unlink_policy) { if($unlink_policy) {
$result = unlink_module_policy($id_agent_module); $result = unlink_module_policy($id_agent_module);
print_result_message($result, 'Module unlinked from the policy successful'); print_result_message($result, 'Module unlinked from the policy successful');
pandora_audit("Agent management", "Unlink module " . $id_agent_module);
} }
switch ($moduletype) { switch ($moduletype) {

View File

@ -40,14 +40,15 @@ if (is_ajax ()) {
$alert_templates = get_agent_alerts_simple ($id_agents); $alert_templates = get_agent_alerts_simple ($id_agents);
echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name')); echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name'));
return; return;
} else { }
$filter = ''; else {
foreach ($id_agents as $id_agent) { $filter = '';
if ($filter != '') { foreach ($id_agents as $id_agent) {
$filter .= ' OR '; if ($filter != '') {
} $filter .= ' OR ';
$filter .= 'id_agent=' . $id_agent; }
}; $filter .= 'id_agent=' . $id_agent;
};
$alert_compounds = get_alert_compounds ($filter, array('id', 'name')); $alert_compounds = get_alert_compounds ($filter, array('id', 'name'));
echo json_encode (index_array ($alert_compounds, 'id', 'name')); echo json_encode (index_array ($alert_compounds, 'id', 'name'));
return; return;
@ -71,7 +72,7 @@ if ($add) {
$fires_min = get_parameter ('fires_min'); $fires_min = get_parameter ('fires_min');
$fires_max = get_parameter ('fires_max'); $fires_max = get_parameter ('fires_max');
if($action > 0){ if ($action > 0) {
$agent_alerts = get_agent_alerts($id_agents); $agent_alerts = get_agent_alerts($id_agents);
$cont = 0; $cont = 0;
$agent_alerts_id = array(); $agent_alerts_id = array();
@ -100,20 +101,25 @@ if ($add) {
if (empty($agent_alerts_id) && empty($agent_alerts_id_compound)) { if (empty($agent_alerts_id) && empty($agent_alerts_id_compound)) {
print_result_message (false, '', __('Could not be added').". ".__('No alerts selected')); print_result_message (false, '', __('Could not be added').". ".__('No alerts selected'));
} else { }
else {
$results = true; $results = true;
foreach($agent_alerts_id as $agent_alert_id){ foreach ($agent_alerts_id as $agent_alert_id) {
$result = add_alert_agent_module_action($agent_alert_id, $action, $options); $result = add_alert_agent_module_action($agent_alert_id, $action, $options);
if($result === false) if($result === false)
$results = false; $results = false;
} }
foreach($agent_alerts_id_compound as $agent_alert_id_compound) { foreach ($agent_alerts_id_compound as $agent_alert_id_compound) {
$result = add_alert_compound_action ($agent_alert_id_compound, $action, $options); $result = add_alert_compound_action ($agent_alert_id_compound, $action, $options);
if($result === false) if($result === false)
$results = false; $results = false;
} }
pandora_audit("Masive management", "Add alert action " . $id_agent, false, false, 'Agents: ' .
json_encode($id_agents) . ' Alerts : ' . json_encode($agent_alerts) .
' Fires Min: ' . $fires_min . ' Fires Max: ' . $fires_max . ' Action: ' . $action);
print_result_message ($results, __('Successfully added'), __('Could not be added')); print_result_message ($results, __('Successfully added'), __('Could not be added'));
} }
} }
@ -150,7 +156,8 @@ $table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"),
if (empty($id_agents)) { if (empty($id_agents)) {
$alert_templates = ''; $alert_templates = '';
} else { }
else {
$alert_templates = get_agent_alerts_simple ($id_agents); $alert_templates = get_agent_alerts_simple ($id_agents);
} }
$table->data[2][0] = __('Alert templates'); $table->data[2][0] = __('Alert templates');
@ -161,7 +168,8 @@ $table->data[2][1] = print_select (index_array ($alert_templates, 'id_alert_temp
if (empty($id_agents)) { if (empty($id_agents)) {
$alert_compounds = ''; $alert_compounds = '';
} else { }
else {
$filter = ''; $filter = '';
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
if ($filter != '') { if ($filter != '') {

View File

@ -74,6 +74,13 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
$conttotal ++; $conttotal ++;
} }
if ($countSuccess > 0) {
pandora_audit("Masive management", "Add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
}
else {
pandora_audit("Masive management", "Fail try to add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
}
print_result_message ($contsuccess > 0, print_result_message ($contsuccess > 0,
__('Successfully added')."(".$contsuccess."/".$conttotal.")", __('Successfully added')."(".$contsuccess."/".$conttotal.")",
__('Could not be added')); __('Could not be added'));

View File

@ -29,25 +29,26 @@ require_once ('include/functions_alerts.php');
$create_profiles = (int) get_parameter ('create_profiles'); $create_profiles = (int) get_parameter ('create_profiles');
if($create_profiles) { if ($create_profiles) {
$profiles_id = get_parameter ('profiles_id', -1); $profiles_id = get_parameter ('profiles_id', -1);
$groups_id = get_parameter ('groups_id', -1); $groups_id = get_parameter ('groups_id', -1);
$users_id = get_parameter ('users_id', -1); $users_id = get_parameter ('users_id', -1);
$n_added = 0; $n_added = 0;
if($profiles_id == -1 || $groups_id == -1 || $users_id == -1){ if ($profiles_id == -1 || $groups_id == -1 || $users_id == -1) {
$result = false; $result = false;
}else{ }
foreach($profiles_id as $profile){ else {
foreach($groups_id as $group){ foreach ($profiles_id as $profile) {
foreach($users_id as $user){ foreach ($groups_id as $group) {
foreach ($users_id as $user) {
$profile_data = get_db_row_filter ("tusuario_perfil", array("id_usuario" => $user, "id_perfil" => $profile, "id_grupo" => $group)); $profile_data = get_db_row_filter ("tusuario_perfil", array("id_usuario" => $user, "id_perfil" => $profile, "id_grupo" => $group));
// If the profile doesnt exist, we create it // If the profile doesnt exist, we create it
if ($profile_data === false) { if ($profile_data === false) {
pandora_audit("User management", pandora_audit("User management",
"Added profile for user ".safe_input($user)); "Added profile for user ".safe_input($user));
$return = create_user_profile ($user, $profile, $group); $return = create_user_profile ($user, $profile, $group);
if($return !== false){ if ($return !== false) {
$n_added ++; $n_added ++;
} }
} }
@ -56,6 +57,15 @@ if($create_profiles) {
} }
} }
if ($n_added > 0) {
pandora_audit("Masive management", "Add profiles", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . json_encode($groups_id) . 'Users: ' . json_encode($users_id));
}
else {
pandora_audit("Masive management", "Fail to try add profiles", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . json_encode($groups_id) . 'Users: ' . json_encode($users_id));
}
print_result_message ($n_added > 0, print_result_message ($n_added > 0,
__('Profiles added successfully').'('.$n_added.')', __('Profiles added successfully').'('.$n_added.')',
__('Profiles cannot be added')); __('Profiles cannot be added'));

View File

@ -36,7 +36,16 @@ $destiny_id_agents = (array) get_parameter ('destiny_id_agent', array ());
$do_operation = (bool) get_parameter ('do_operation'); $do_operation = (bool) get_parameter ('do_operation');
if ($do_operation) { if ($do_operation) {
process_manage_config ($source_id_agent, $destiny_id_agents); $result = process_manage_config ($source_id_agent, $destiny_id_agents);
if ($result) {
pandora_audit("Masive management", "Copy modules", false, false,
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
}
else {
pandora_audit("Masive management", "Fail to try copy modules", false, false,
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
}
} }
$groups = get_user_groups (); $groups = get_user_groups ();

View File

@ -117,6 +117,17 @@ if ($delete) {
} }
} }
} }
if ($results) {
pandora_audit("Masive management", "Delete alert action", false, false,
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
' Alert compound: ' . $id_alert_compounds . ' Action: ' . $action);
}
else {
pandora_audit("Masive management", "Fail try to delete alert action", false, false,
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
' Alert compound: ' . $id_alert_compounds . ' Action: ' . $action);
}
print_result_message ($results, __('Successfully deleted'), __('Could not be deleted')/*.": ". $agent_alerts['simple'][0]['id']*/); print_result_message ($results, __('Successfully deleted'), __('Could not be deleted')/*.": ". $agent_alerts['simple'][0]['id']*/);
} }

View File

@ -51,9 +51,14 @@ function process_manage_delete ($id_agents) {
echo '<h3 class="error">'.__('There was an error deleting the agent, the operation has been cancelled').'</h3>'; echo '<h3 class="error">'.__('There was an error deleting the agent, the operation has been cancelled').'</h3>';
echo '<h4>'.__('Could not delete agent').' '.get_agent_name ($id_agent).'</h4>'; echo '<h4>'.__('Could not delete agent').' '.get_agent_name ($id_agent).'</h4>';
process_sql_rollback (); process_sql_rollback ();
} else {
return false;
}
else {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>'; echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
process_sql_commit (); process_sql_commit ();
return true;
} }
} }
@ -63,7 +68,16 @@ $id_agents = get_parameter ('id_agents');
$delete = (bool) get_parameter_post ('delete'); $delete = (bool) get_parameter_post ('delete');
if ($delete) { if ($delete) {
process_manage_delete ($id_agents); $result = process_manage_delete ($id_agents);
if ($result) {
pandora_audit("Masive management", "Delete agent ", false, false,
'Agent: ' . json_encode($id_agents));
}
else {
pandora_audit("Masive management", "Fail try to delete agent", false, false,
'Agent: ' . json_encode($id_agents));
}
} }
$groups = get_user_groups (); $groups = get_user_groups ();

View File

@ -79,8 +79,10 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
print_result_message ($contsuccess > 0, print_result_message ($contsuccess > 0,
__('Successfully deleted')."(".$contsuccess."/".$conttotal.")", __('Successfully deleted')."(".$contsuccess."/".$conttotal.")",
__('Could not be deleted')); __('Could not be deleted'));
return (bool)($contsuccess > 0);
} }
$id_group = (int) get_parameter ('id_group'); $id_group = (int) get_parameter ('id_group');
@ -91,7 +93,16 @@ $id_alert_template = (int) get_parameter ('id_alert_template');
$delete = (bool) get_parameter_post ('delete'); $delete = (bool) get_parameter_post ('delete');
if ($delete) { if ($delete) {
process_manage_delete ($id_alert_template, $id_agents, $module_names); $result = process_manage_delete ($id_alert_template, $id_agents, $module_names);
if ($result) {
pandora_audit("Masive management", "Delete alert ", false, false,
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
}
else {
pandora_audit("Masive management", "Fail try to delete alert", false, false,
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
}
} }
$groups = get_user_groups (); $groups = get_user_groups ();

View File

@ -64,9 +64,14 @@ function process_manage_delete ($module_name, $id_agents) {
echo '<h3 class="error">'.__('There was an error deleting the modules, the operation has been cancelled').'</h3>'; echo '<h3 class="error">'.__('There was an error deleting the modules, the operation has been cancelled').'</h3>';
echo '<h4>'.__('Could not delete modules').'</h4>'; echo '<h4>'.__('Could not delete modules').'</h4>';
process_sql_rollback (); process_sql_rollback ();
} else {
return false;
}
else {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>'; echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
process_sql_commit (); process_sql_commit ();
return true;
} }
} }
@ -77,7 +82,16 @@ $module_name = (string) get_parameter ('module_name');
$delete = (bool) get_parameter_post ('delete'); $delete = (bool) get_parameter_post ('delete');
if ($delete) { if ($delete) {
process_manage_delete ($module_name, $id_agents); $result = process_manage_delete ($module_name, $id_agents);
if ($result) {
pandora_audit("Masive management", "Delete module ", false, false,
'Agent: ' . json_encode($id_agents) . ' Module: ' . $module_names);
}
else {
pandora_audit("Masive management", "Fail try to delete module", false, false,
'Agent: ' . json_encode($id_agents) . ' Module: ' . $module_names);
}
} }
$groups = get_user_groups (); $groups = get_user_groups ();

View File

@ -67,6 +67,15 @@ if ($delete_profiles) {
} }
} }
if ($result) {
pandora_audit("Masive management", "Delete profile ", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
}
else {
pandora_audit("Masive management", "Fail try to delete profile", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
}
print_result_message ($result, print_result_message ($result,
__('Profiles deleted successfully'), __('Profiles deleted successfully'),
__('Profiles cannot be deleted')); __('Profiles cannot be deleted'));

View File

@ -52,90 +52,102 @@ $update_agents = get_parameter ('update_agents', 0);
if ($update_agents) { if ($update_agents) {
$values = array(); $values = array();
if(get_parameter ('group', '') != -1) if (get_parameter ('group', '') != -1)
$values['id_grupo'] = get_parameter ('group'); $values['id_grupo'] = get_parameter ('group');
if(get_parameter ('interval', '') != '') if (get_parameter ('interval', '') != '')
$values['intervalo'] = get_parameter ('interval'); $values['intervalo'] = get_parameter ('interval');
if(get_parameter ('id_os', '') != -1) if (get_parameter ('id_os', '') != -1)
$values['id_os'] = get_parameter ('id_os'); $values['id_os'] = get_parameter ('id_os');
if(get_parameter ('id_parent', '') != '') if (get_parameter ('id_parent', '') != '')
$values['id_parent'] = get_parameter ('id_parent'); $values['id_parent'] = get_parameter ('id_parent');
if(get_parameter ('server_name', '') != -1) if (get_parameter ('server_name', '') != -1)
$values['server_name'] = get_parameter ('server_name'); $values['server_name'] = get_parameter ('server_name');
if(get_parameter ('description', '') != '') if (get_parameter ('description', '') != '')
$values['comentarios'] = get_parameter ('description'); $values['comentarios'] = get_parameter ('description');
if(get_parameter ('mode', '') != -1) if (get_parameter ('mode', '') != -1)
$values['modo'] = get_parameter ('mode'); $values['modo'] = get_parameter ('mode');
if(get_parameter ('disabled', '') != -1) if (get_parameter ('disabled', '') != -1)
$values['disabled'] = get_parameter ('disabled'); $values['disabled'] = get_parameter ('disabled');
if(get_parameter ('icon_path', '') != '') if (get_parameter ('icon_path', '') != '')
$values['icon_path'] = get_parameter('icon_path'); $values['icon_path'] = get_parameter('icon_path');
if(get_parameter ('update_gis_data', -1) != -1) if (get_parameter ('update_gis_data', -1) != -1)
$values['update_gis_data'] = get_parameter('update_gis_data'); $values['update_gis_data'] = get_parameter('update_gis_data');
if(get_parameter ('custom_id', '') != '') if (get_parameter ('custom_id', '') != '')
$values['custom_id'] = get_parameter('custom_id'); $values['custom_id'] = get_parameter('custom_id');
if(get_parameter ('cascade_protection', -1) != -1) if (get_parameter ('cascade_protection', -1) != -1)
$values['cascade_protection'] = get_parameter('cascade_protection'); $values['cascade_protection'] = get_parameter('cascade_protection');
if(get_parameter ('delete_conf', 0) != 0) if (get_parameter ('delete_conf', 0) != 0)
$values['delete_conf'] = get_parameter('delete_conf'); $values['delete_conf'] = get_parameter('delete_conf');
$fields = get_db_all_fields_in_table('tagent_custom_fields'); $fields = get_db_all_fields_in_table('tagent_custom_fields');
if($fields === false) $fields = array(); if ($fields === false) $fields = array();
$id_agents = get_parameter('id_agents', false); $id_agents = get_parameter('id_agents', false);
if(!$id_agents) { if (!$id_agents) {
print_error_message(__('No agents selected')); print_error_message(__('No agents selected'));
$id_agents = array(); $id_agents = array();
} else{ }
if(empty($values) && empty($fields)){ else {
if (empty($values) && empty($fields)) {
print_error_message(__('No values changed')); print_error_message(__('No values changed'));
$id_agents = array(); $id_agents = array();
} }
} }
// CONF FILE DELETION // CONF FILE DELETION
if(isset($values['delete_conf'])) { if (isset($values['delete_conf'])) {
unset($values['delete_conf']); unset($values['delete_conf']);
$n_deleted = 0; $n_deleted = 0;
foreach($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$agent_md5 = md5(get_agent_name($id_agent)); $agent_md5 = md5(get_agent_name($id_agent));
@unlink ($config["remote_config"]."/md5/".$agent_md5.".md5"); @unlink ($config["remote_config"]."/md5/".$agent_md5.".md5");
$result = @unlink ($config["remote_config"]."/conf/".$agent_md5.".conf"); $result = @unlink ($config["remote_config"]."/conf/".$agent_md5.".conf");
$n_deleted += (int)$result; $n_deleted += (int)$result;
} }
print_result_message ($n_deleted > 0,
if ($n_deleted > 0) {
pandora_audit("Masive management", "Delete conf file " . $id_agent);
}
else {
pandora_audit("Masive management", "Try to delete conf file " . $id_agent);
}
print_result_message ($n_deleted > 0,
__('Configuration files deleted successfully').'('.$n_deleted.')', __('Configuration files deleted successfully').'('.$n_deleted.')',
__('Configuration files cannot be deleted')); __('Configuration files cannot be deleted'));
} }
if(empty($values) && empty($fields)){ if (empty($values) && empty($fields)) {
$id_agents = array(); $id_agents = array();
} }
$n_edited = 0; $n_edited = 0;
$result = false; $result = false;
foreach($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
if(!empty($values)) { if (!empty($values)) {
$result = process_sql_update ('tagente', $result = process_sql_update ('tagente',
$values, $values,
array ('id_agente' => $id_agent)); array ('id_agente' => $id_agent));
} }
// Update Custom Fields // Update Custom Fields
foreach($fields as $field) { foreach ($fields as $field) {
if(get_parameter_post ('customvalue_'.$field['id_field'], '') != '') { if (get_parameter_post ('customvalue_'.$field['id_field'], '') != '') {
$key = $field['id_field']; $key = $field['id_field'];
$value = get_parameter_post ('customvalue_'.$field['id_field'], ''); $value = get_parameter_post ('customvalue_'.$field['id_field'], '');
$old_value = get_db_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agent, 'id_field' => $key)); $old_value = get_db_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agent, 'id_field' => $key));
if($old_value === false) { if ($old_value === false) {
// Create custom field if not exist // Create custom field if not exist
$result = process_sql_insert ('tagent_custom_data', $result = process_sql_insert ('tagent_custom_data',
array('id_field' => $key,'id_agent' => $id_agent, 'description' => $value)); array('id_field' => $key,'id_agent' => $id_agent, 'description' => $value));
}else { }
else {
$result = process_sql_update ('tagent_custom_data', $result = process_sql_update ('tagent_custom_data',
array('description' => $value), array('description' => $value),
array('id_field' => $key,'id_agent' => $id_agent)); array('id_field' => $key,'id_agent' => $id_agent));
@ -145,6 +157,16 @@ if ($update_agents) {
$n_edited += (int)$result; $n_edited += (int)$result;
} }
if ($n_edited > 0) {
pandora_audit("Masive management", "Update agent " . $id_agent, false, false, json_encode($fields));
}
else {
pandora_audit("Masive management", "Try to update agent " . $id_agent, false, false, json_encode($fields));
}
print_result_message ($n_edited > 0, print_result_message ($n_edited > 0,
__('Agents updated successfully').'('.$n_edited.')', __('Agents updated successfully').'('.$n_edited.')',
__('Agents cannot be updated')); __('Agents cannot be updated'));
@ -152,7 +174,7 @@ if ($update_agents) {
} }
$id_group = 0; $id_group = 0;
$groups = get_user_groups (); $groups = get_user_groups();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->width = '95%'; $table->width = '95%';
@ -328,7 +350,7 @@ $table->data = array ();
$fields = get_db_all_fields_in_table('tagent_custom_fields'); $fields = get_db_all_fields_in_table('tagent_custom_fields');
if($fields === false) $fields = array(); if ($fields === false) $fields = array();
foreach ($fields as $field) { foreach ($fields as $field) {
@ -336,7 +358,7 @@ foreach ($fields as $field) {
$custom_value = get_db_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente)); $custom_value = get_db_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
if($custom_value === false) { if ($custom_value === false) {
$custom_value = ''; $custom_value = '';
} }
@ -345,7 +367,7 @@ foreach ($fields as $field) {
array_push ($table->data, $data); array_push ($table->data, $data);
} }
if(!empty($fields)) { if (!empty($fields)) {
toggle(print_table ($table, true), __('Custom fields')); toggle(print_table ($table, true), __('Custom fields'));
} }
@ -424,7 +446,7 @@ $(document).ready (function () {
"id_agents[]" : idAgents "id_agents[]" : idAgents
}, },
function (data, status) { function (data, status) {
if(data == 0){ if (data == 0) {
$("#delete_configurations").attr("style", "display: none"); $("#delete_configurations").attr("style", "display: none");
$("#not_available_configurations").attr("style", ""); $("#not_available_configurations").attr("style", "");
} }
@ -445,6 +467,7 @@ $(document).ready (function () {
}); });
$("select#id_os").pandoraSelectOS (); $("select#id_os").pandoraSelectOS ();
$("#text-id_parent").autocomplete ("ajax.php", $("#text-id_parent").autocomplete ("ajax.php",
{ {
scroll: true, scroll: true,
@ -467,9 +490,11 @@ $(document).ready (function () {
delay: 200 delay: 200
} }
); );
$("#id_group").pandoraSelectGroupAgent ({ $("#id_group").pandoraSelectGroupAgent ({
agentSelect: "select#id_agents" agentSelect: "select#id_agents"
}); });
$("#id_group").pandoraSelectGroupAgentDisabled ({ $("#id_group").pandoraSelectGroupAgentDisabled ({
agentSelect: "select#id_agents" agentSelect: "select#id_agents"
}); });

View File

@ -168,6 +168,14 @@ if ($update) {
print_result_message ($success > 0, print_result_message ($success > 0,
__('Successfully updated')."(".$success."/".$count.")", __('Successfully updated')."(".$success."/".$count.")",
__('Could not be updated')); __('Could not be updated'));
$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
if ($success > 0) {
pandora_audit("Masive management", "Edit module", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to edit module", false, false, $info);
}
} }
$table->id = 'delete_table'; $table->id = 'delete_table';

View File

@ -71,7 +71,16 @@ switch($action) {
foreach($id_disabled_alerts as $id_alert) { foreach($id_disabled_alerts as $id_alert) {
$result = set_alerts_agent_module_disable ($id_alert, false); $result = set_alerts_agent_module_disable ($id_alert, false);
} }
print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'));
print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'));
$info = 'Alert: ' . json_encode($id_disabled_alerts);
if ($result) {
pandora_audit("Masive management", "Enable alert", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to enable alert", false, false, $info);
}
break; break;
case 'disable_alerts': case 'disable_alerts':
$id_alert_templates = (int) get_parameter ('id_alert_template_enabled', 0); $id_alert_templates = (int) get_parameter ('id_alert_template_enabled', 0);
@ -80,7 +89,16 @@ switch($action) {
foreach($id_enabled_alerts as $id_alert) { foreach($id_enabled_alerts as $id_alert) {
$result = set_alerts_agent_module_disable ($id_alert, true); $result = set_alerts_agent_module_disable ($id_alert, true);
} }
print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'));
print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'));
$info = 'Alert: ' . json_encode($id_disabled_alerts);
if ($result) {
pandora_audit("Masive management", "Disaable alert", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to Disable alert", false, false, $info);
}
break; break;
default: default:
$id_alert_templates = (int) get_parameter ('id_alert_template', 0); $id_alert_templates = (int) get_parameter ('id_alert_template', 0);

View File

@ -58,17 +58,22 @@ if($modules_snmp_options != -1) {
} }
if(in_array($option, array_keys($options_alerts))) { if (in_array($option, array_keys($options_alerts))) {
$tab = 'massive_alerts'; $tab = 'massive_alerts';
}elseif(in_array($option, array_keys($options_agents))) { }
elseif (in_array($option, array_keys($options_agents))) {
$tab = 'massive_agents'; $tab = 'massive_agents';
}elseif(in_array($option, array_keys($options_users))) { }
elseif (in_array($option, array_keys($options_users))) {
$tab = 'massive_users'; $tab = 'massive_users';
}elseif(in_array($option, array_keys($options_modules))) { }
elseif (in_array($option, array_keys($options_modules))) {
$tab = 'massive_modules'; $tab = 'massive_modules';
}elseif(in_array($option, array_keys($options_policies))) { }
elseif (in_array($option, array_keys($options_policies))) {
$tab = 'massive_policies'; $tab = 'massive_policies';
}else { }
else {
$option = ''; $option = '';
} }
@ -91,7 +96,7 @@ switch($tab) {
} }
// Set the default option of the category // Set the default option of the category
if($option == ''){ if ($option == '') {
$option = array_shift(array_keys($options)); $option = array_shift(array_keys($options));
} }

View File

@ -42,7 +42,8 @@ if (is_ajax ()) {
$alert_templates = get_agent_alerts_simple ($id_agents); $alert_templates = get_agent_alerts_simple ($id_agents);
echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name')); echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name'));
return; return;
} else { }
else {
$id_alert_templates = (array) get_parameter ('id_alert_templates'); $id_alert_templates = (array) get_parameter ('id_alert_templates');
$standby = (int) get_parameter ('standby'); $standby = (int) get_parameter ('standby');
@ -71,7 +72,16 @@ switch($action) {
foreach($id_standby_alerts as $id_alert) { foreach($id_standby_alerts as $id_alert) {
$result = set_alerts_agent_module_standby ($id_alert, false); $result = set_alerts_agent_module_standby ($id_alert, false);
} }
print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'));
print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'));
$info = 'Alert: ' . json_encode($id_standby_alerts);
if ($result) {
pandora_audit("Masive management", "Set off standby alerts", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to set off standby alerts", false, false, $info);
}
break; break;
case 'set_standby_alerts': case 'set_standby_alerts':
$id_alert_templates = (int) get_parameter ('id_alert_template_standby', 0); $id_alert_templates = (int) get_parameter ('id_alert_template_standby', 0);
@ -80,7 +90,16 @@ switch($action) {
foreach($id_not_standby_alerts as $id_alert) { foreach($id_not_standby_alerts as $id_alert) {
$result = set_alerts_agent_module_standby ($id_alert, true); $result = set_alerts_agent_module_standby ($id_alert, true);
} }
print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'));
print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'));
$info = 'Alert: ' . json_encode($id_not_standby_alerts);
if ($result) {
pandora_audit("Masive management", "Set on standby alerts", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to set on standby alerts", false, false, $info);
}
break; break;
default: default:
$id_alert_templates = (int) get_parameter ('id_alert_template', 0); $id_alert_templates = (int) get_parameter ('id_alert_template', 0);