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>
* godmode/massive/massive_delete_profiles.php: fixed result message of

View File

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

View File

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

View File

@ -40,7 +40,8 @@ if (is_ajax ()) {
$alert_templates = get_agent_alerts_simple ($id_agents);
echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name'));
return;
} else {
}
else {
$filter = '';
foreach ($id_agents as $id_agent) {
if ($filter != '') {
@ -100,7 +101,8 @@ if ($add) {
if (empty($agent_alerts_id) && empty($agent_alerts_id_compound)) {
print_result_message (false, '', __('Could not be added').". ".__('No alerts selected'));
} else {
}
else {
$results = true;
foreach ($agent_alerts_id as $agent_alert_id) {
$result = add_alert_agent_module_action($agent_alert_id, $action, $options);
@ -114,6 +116,10 @@ if ($add) {
$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'));
}
}
@ -150,7 +156,8 @@ $table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"),
if (empty($id_agents)) {
$alert_templates = '';
} else {
}
else {
$alert_templates = get_agent_alerts_simple ($id_agents);
}
$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)) {
$alert_compounds = '';
} else {
}
else {
$filter = '';
foreach ($id_agents as $id_agent) {
if ($filter != '') {

View File

@ -74,6 +74,13 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
$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,
__('Successfully added')."(".$contsuccess."/".$conttotal.")",
__('Could not be added'));

View File

@ -37,7 +37,8 @@ if($create_profiles) {
if ($profiles_id == -1 || $groups_id == -1 || $users_id == -1) {
$result = false;
}else{
}
else {
foreach ($profiles_id as $profile) {
foreach ($groups_id as $group) {
foreach ($users_id as $user) {
@ -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,
__('Profiles added successfully').'('.$n_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');
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 ();

View File

@ -118,6 +118,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']*/);
}
}

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 '<h4>'.__('Could not delete agent').' '.get_agent_name ($id_agent).'</h4>';
process_sql_rollback ();
} else {
return false;
}
else {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
process_sql_commit ();
return true;
}
}
@ -63,7 +68,16 @@ $id_agents = get_parameter ('id_agents');
$delete = (bool) get_parameter_post ('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 ();

View File

@ -81,6 +81,8 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
__('Successfully deleted')."(".$contsuccess."/".$conttotal.")",
__('Could not be deleted'));
return (bool)($contsuccess > 0);
}
$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');
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 ();

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 '<h4>'.__('Could not delete modules').'</h4>';
process_sql_rollback ();
} else {
return false;
}
else {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
process_sql_commit ();
return true;
}
}
@ -77,7 +82,16 @@ $module_name = (string) get_parameter ('module_name');
$delete = (bool) get_parameter_post ('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 ();

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,
__('Profiles deleted successfully'),
__('Profiles cannot be deleted'));

View File

@ -87,7 +87,8 @@ if ($update_agents) {
if (!$id_agents) {
print_error_message(__('No agents selected'));
$id_agents = array();
} else{
}
else {
if (empty($values) && empty($fields)) {
print_error_message(__('No values changed'));
$id_agents = array();
@ -105,6 +106,16 @@ if ($update_agents) {
$n_deleted += (int)$result;
}
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 cannot be deleted'));
@ -135,7 +146,8 @@ if ($update_agents) {
// Create custom field if not exist
$result = process_sql_insert ('tagent_custom_data',
array('id_field' => $key,'id_agent' => $id_agent, 'description' => $value));
}else {
}
else {
$result = process_sql_update ('tagent_custom_data',
array('description' => $value),
array('id_field' => $key,'id_agent' => $id_agent));
@ -145,6 +157,16 @@ if ($update_agents) {
$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,
__('Agents updated successfully').'('.$n_edited.')',
__('Agents cannot be updated'));
@ -445,6 +467,7 @@ $(document).ready (function () {
});
$("select#id_os").pandoraSelectOS ();
$("#text-id_parent").autocomplete ("ajax.php",
{
scroll: true,
@ -467,9 +490,11 @@ $(document).ready (function () {
delay: 200
}
);
$("#id_group").pandoraSelectGroupAgent ({
agentSelect: "select#id_agents"
});
$("#id_group").pandoraSelectGroupAgentDisabled ({
agentSelect: "select#id_agents"
});

View File

@ -168,6 +168,14 @@ if ($update) {
print_result_message ($success > 0,
__('Successfully updated')."(".$success."/".$count.")",
__('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';

View File

@ -71,7 +71,16 @@ switch($action) {
foreach($id_disabled_alerts as $id_alert) {
$result = set_alerts_agent_module_disable ($id_alert, false);
}
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;
case 'disable_alerts':
$id_alert_templates = (int) get_parameter ('id_alert_template_enabled', 0);
@ -80,7 +89,16 @@ switch($action) {
foreach($id_enabled_alerts as $id_alert) {
$result = set_alerts_agent_module_disable ($id_alert, true);
}
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;
default:
$id_alert_templates = (int) get_parameter ('id_alert_template', 0);

View File

@ -60,15 +60,20 @@ if($modules_snmp_options != -1) {
if (in_array($option, array_keys($options_alerts))) {
$tab = 'massive_alerts';
}elseif(in_array($option, array_keys($options_agents))) {
}
elseif (in_array($option, array_keys($options_agents))) {
$tab = 'massive_agents';
}elseif(in_array($option, array_keys($options_users))) {
}
elseif (in_array($option, array_keys($options_users))) {
$tab = 'massive_users';
}elseif(in_array($option, array_keys($options_modules))) {
}
elseif (in_array($option, array_keys($options_modules))) {
$tab = 'massive_modules';
}elseif(in_array($option, array_keys($options_policies))) {
}
elseif (in_array($option, array_keys($options_policies))) {
$tab = 'massive_policies';
}else {
}
else {
$option = '';
}

View File

@ -42,7 +42,8 @@ if (is_ajax ()) {
$alert_templates = get_agent_alerts_simple ($id_agents);
echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name'));
return;
} else {
}
else {
$id_alert_templates = (array) get_parameter ('id_alert_templates');
$standby = (int) get_parameter ('standby');
@ -71,7 +72,16 @@ switch($action) {
foreach($id_standby_alerts as $id_alert) {
$result = set_alerts_agent_module_standby ($id_alert, false);
}
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;
case 'set_standby_alerts':
$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) {
$result = set_alerts_agent_module_standby ($id_alert, true);
}
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;
default:
$id_alert_templates = (int) get_parameter ('id_alert_template', 0);