diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index a72cc8b438..c449a6de74 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2010-10-28 Miguel de Dios + + * godmode/alerts/alert_list.php, + godmode/alerts/configure_alert_template.php, + godmode/alerts/alert_templates.php, godmode/alerts/alert_actions.php, + godmode/alerts/alert_commands.php: now in the source code pick more info in + the audit for actions to create, update and delete profiles and user, and + for action to add and remove profiles to user. + 2010-10-28 Miguel de Dios * include/javascript/jquery.ui.datepicker.js, include/javascript/jquery.js, diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index d4803f23f5..8558ba6465 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -52,6 +52,13 @@ if ($copy_action) { $result = clone_alert_action ($id); + if ($result) { + pandora_audit("Command management", "Duplicate alert action " . $id . " clone to " . $result); + } + else { + pandora_audit("Command management", "Fail try to duplicate alert action " . $id); + } + print_result_message ($result, __('Successfully copied'), __('Could not be copied')); @@ -70,6 +77,16 @@ if ($create_action) { 'field2' => $field2, 'field3' => $field3, 'id_group' => $group)); + + $info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command . + ' Field1: ' . $field1 . ' Field2: ' . $field2 . ' Field3: ' . $field3 . ' Group: ' . $group; + + if ($result) { + pandora_audit("Command management", "Create alert action " . $result, false, false, $info); + } + else { + pandora_audit("Command management", "Fail try to create alert action", false, false, $info); + } print_result_message ($result, __('Successfully created'), @@ -95,6 +112,16 @@ if ($update_action) { $result = update_alert_action ($id, $values); + $info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command . + ' Field1: ' . $field1 . ' Field2: ' . $field2 . ' Field3: ' . $field3 . ' Group: ' . $group; + + if ($result) { + pandora_audit("Command management", "Update alert action " . $id, false, false, json_encode($values)); + } + else { + pandora_audit("Command management", "Fail try to update alert action " . $id, false, false, json_encode($values)); + } + print_result_message ($result, __('Successfully updated'), __('Could not be updated')); @@ -105,6 +132,13 @@ if ($delete_action) { $result = delete_alert_action ($id); + if ($result) { + pandora_audit("Command management", "Delete alert action " . $id); + } + else { + pandora_audit("Command management", "Fail try to delete alert action " . $id); + } + print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 6039e289c2..7a7a7e9c8b 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -53,6 +53,15 @@ if ($create_command) { $result = create_alert_command ($name, $command, array ('description' => $description)); + $info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description; + + if ($result) { + pandora_audit("Command management", "Create alert command " . $result, false, false, $info); + } + else { + pandora_audit("Command management", "Fail try to create alert command", false, false, $info); + } + print_result_message ($result, __('Successfully created'), __('Could not be created')); @@ -76,6 +85,14 @@ if ($update_command) { $values['description'] = $description; $result = update_alert_command ($id, $values); + $info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description; + if ($result) { + pandora_audit("Command management", "Create alert command " . $id, false, false, $info); + } + else { + pandora_audit("Command management", "Fail to create alert command " . $id, false, false, $info); + } + print_result_message ($result, __('Successfully updated'), __('Could not be updated')); @@ -94,6 +111,13 @@ if ($delete_command) { $result = delete_alert_command ($id); + if ($result) { + pandora_audit("Command management", "Delete alert command " . $id); + } + else { + pandora_audit("Command management", "Fail to delete alert command " . $id); + } + print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index f4a1b7e020..9a8adee95b 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -82,7 +82,11 @@ if ($create_alert) { // Audit the creation only when the alert creation is correct if($id) { pandora_audit("Alert management", - "Added alert '$alert_template_name' for module '$module_name' in agent '$agent_name'"); + "Added alert '$alert_template_name' for module '$module_name' in agent '$agent_name'", false, false, 'ID: ' . $id); + } + else { + pandora_audit("Alert management", + "Fail Added alert '$alert_template_name' for module '$module_name' in agent '$agent_name'"); } $messageAction = print_result_message ($id, __('Successfully created'), __('Could not be created'), '', true); @@ -110,10 +114,17 @@ if ($delete_alert) { $module_name = get_db_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module); $agent_name = get_agent_name (get_db_value ("id_agente", "tagente_modulo","id_agente_modulo", $id_agent_module)); - pandora_audit("Alert management", - "Deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_name'"); - $result = delete_alert_agent_module ($id_alert_agent_module); + + if ($result) { + pandora_audit("Alert management", + "Deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_name'"); + } + else { + pandora_audit("Alert management", + "Fail to deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_name'"); + } + $messageAction = print_result_message ($result, __('Successfully deleted'), __('Could not be deleted'), '', true); } @@ -129,6 +140,14 @@ if ($add_action) { $values['fires_max'] = $fires_max; $result = add_alert_agent_module_action ($id_alert_module, $id_action, $values); + + if ($result) { + pandora_audit("Alert management", 'Add action ' . $id_action . ' in alert ' . $id_alert_module); + } + else { + pandora_audit("Alert management", 'Fail to add action ' . $id_action . ' in alert ' . $id_alert_module); + } + $messageAction = print_result_message ($result, __('Successfully added'), __('Could not be added'), '', true); } @@ -137,6 +156,14 @@ if ($delete_action) { $id_alert = (int) get_parameter ('id_alert'); $result = delete_alert_agent_module_action ($id_action); + + if ($result) { + pandora_audit("Alert management", 'Delete action ' . $id_action . ' in alert ' . $id_alert_module); + } + else { + pandora_audit("Alert management", 'Fail to delete action ' . $id_action . ' in alert ' . $id_alert_module); + } + $messageAction = print_result_message ($result, __('Successfully deleted'), __('Could not be deleted'), '', true); } @@ -144,6 +171,14 @@ if ($enable_alert) { $id_alert = (int) get_parameter ('id_alert'); $result = set_alerts_agent_module_disable ($id_alert, false); + + if ($result) { + pandora_audit("Alert management", 'Enable ' . $id_alert); + } + else { + pandora_audit("Alert management", 'Fail to enable ' . $id_alert); + } + $messageAction = print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'), '', true); } @@ -151,6 +186,14 @@ if ($disable_alert) { $id_alert = (int) get_parameter ('id_alert'); $result = set_alerts_agent_module_disable ($id_alert, true); + + if ($result) { + pandora_audit("Alert management", 'Disable ' . $id_alert); + } + else { + pandora_audit("Alert management", 'Fail to disable ' . $id_alert); + } + $messageAction = print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'), '', true); } @@ -158,6 +201,14 @@ if ($standbyon_alert) { $id_alert = (int) get_parameter ('id_alert'); $result = set_alerts_agent_module_standby ($id_alert, true); + + if ($result) { + pandora_audit("Alert management", 'Standby ' . $id_alert); + } + else { + pandora_audit("Alert management", 'Fail to standby ' . $id_alert); + } + $messageAction = print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'), '', true); } @@ -165,6 +216,14 @@ if ($standbyoff_alert) { $id_alert = (int) get_parameter ('id_alert'); $result = set_alerts_agent_module_standby ($id_alert, false); + + if ($result) { + pandora_audit("Alert management", 'Standbyoff ' . $id_alert); + } + else { + pandora_audit("Alert management", 'Fail to standbyoff ' . $id_alert); + } + $messageAction = print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'), '', true); } diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index a899e3023e..ee4aa22370 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -134,6 +134,13 @@ if ($delete_template) { $result = delete_alert_template ($id); + if ($result) { + pandora_audit("Template alert management", "Delete alert template " . $id); + } + else { + pandora_audit("Template alert management", "Fail try to delete alert template " . $id); + } + print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 5f7f55a451..5bf2352044 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -37,6 +37,14 @@ if ($duplicate_template) { $source_id = (int) get_parameter ('source_id'); $id = duplicate_alert_template ($source_id); + + if ($id) { + pandora_audit("Template alert management", "Duplicate alert template " . $source_id . " clone to " . $id); + } + else { + pandora_audit("Template alert management", "Fail try to duplicate alert template " . $source_id); + } + print_result_message ($id, __('Successfully created from %s', get_alert_template_name ($source_id)), __('Could not be created')); @@ -59,7 +67,8 @@ function print_alert_template_steps ($step, $id) { echo __('Step').' 1 » '; echo ''.__('Conditions').''; echo ''; - } else { + } + else { echo __('Step').' 1 » '; echo ''.__('Conditions').''; } @@ -78,7 +87,8 @@ function print_alert_template_steps ($step, $id) { echo __('Step').' 2 » '; echo ''.__('Firing').''; echo ''; - } else { + } + else { echo __('Step').' 2 » '; echo ''.__('Firing').''; } @@ -97,7 +107,8 @@ function print_alert_template_steps ($step, $id) { echo __('Step').' 3 » '; echo ''.__('Recovery').''; echo ''; - } else { + } + else { echo __('Step').' 3 » '; echo ''.__('Recovery').''; } @@ -123,8 +134,7 @@ function update_template ($step) { $priority = (int) get_parameter ('priority'); $id_group = get_parameter ("id_group"); - $result = update_alert_template ($id, - array ('name' => $name, + $values = array ('name' => $name, 'type' => $type, 'description' => $description, 'value' => $value, @@ -132,9 +142,11 @@ function update_template ($step) { 'min_value' => $min, 'id_group' => $id_group, 'matches_value' => $matches, - 'priority' => $priority)); - - } elseif ($step == 2) { + 'priority' => $priority); + + $result = update_alert_template ($id,$values); + } + elseif ($step == 2) { $monday = (bool) get_parameter ('monday'); $tuesday = (bool) get_parameter ('tuesday'); $wednesday = (bool) get_parameter ('wednesday'); @@ -178,19 +190,29 @@ function update_template ($step) { ); $result = update_alert_template ($id, $values); - } elseif ($step == 3) { + } + elseif ($step == 3) { $recovery_notify = (bool) get_parameter ('recovery_notify'); $field2_recovery = (string) get_parameter ('field2_recovery'); $field3_recovery = (string) get_parameter ('field3_recovery'); + + $values = array ('recovery_notify' => $recovery_notify, + 'field2_recovery' => $field2_recovery, + 'field3_recovery' => $field3_recovery); - $result = update_alert_template ($id, - array ('recovery_notify' => $recovery_notify, - 'field2_recovery' => $field2_recovery, - 'field3_recovery' => $field3_recovery)); - } else { + $result = update_alert_template ($id, $values); + } + else { return false; } + if ($result) { + pandora_audit("Template alert management", "Update alert template " . $id, false, false, json_encode($values)); + } + else { + pandora_audit("Template alert management", "Fail try to update alert template " . $id, false, false, json_encode($values)); + } + return $result; } @@ -242,14 +264,22 @@ if ($create_template) { $priority = (int) get_parameter ('priority'); $id_group = get_parameter ("id_group"); - $result = create_alert_template ($name, $type, - array ('description' => $description, + $values = array ('description' => $description, 'value' => $value, 'max_value' => $max, 'min_value' => $min, 'id_group' => $id_group, 'matches_value' => $matches, - 'priority' => $priority)); + 'priority' => $priority); + + $result = create_alert_template ($name, $type, $values); + + if ($result) { + pandora_audit("Command management", "Create alert command " . $result, false, false, json_encode($values)); + } + else { + pandora_audit("Command management", "Fail try to create alert command", false, false, json_encode($values)); + } print_result_message ($result, __('Successfully created'),