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:
parent
ca2b11c3ec
commit
4c5e817aff
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -40,14 +40,15 @@ 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 {
|
||||
$filter = '';
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if ($filter != '') {
|
||||
$filter .= ' OR ';
|
||||
}
|
||||
$filter .= 'id_agent=' . $id_agent;
|
||||
};
|
||||
}
|
||||
else {
|
||||
$filter = '';
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if ($filter != '') {
|
||||
$filter .= ' OR ';
|
||||
}
|
||||
$filter .= 'id_agent=' . $id_agent;
|
||||
};
|
||||
$alert_compounds = get_alert_compounds ($filter, array('id', 'name'));
|
||||
echo json_encode (index_array ($alert_compounds, 'id', 'name'));
|
||||
return;
|
||||
|
@ -71,7 +72,7 @@ if ($add) {
|
|||
$fires_min = get_parameter ('fires_min');
|
||||
$fires_max = get_parameter ('fires_max');
|
||||
|
||||
if($action > 0){
|
||||
if ($action > 0) {
|
||||
$agent_alerts = get_agent_alerts($id_agents);
|
||||
$cont = 0;
|
||||
$agent_alerts_id = array();
|
||||
|
@ -100,20 +101,25 @@ 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){
|
||||
foreach ($agent_alerts_id as $agent_alert_id) {
|
||||
$result = add_alert_agent_module_action($agent_alert_id, $action, $options);
|
||||
if($result === 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);
|
||||
if($result === 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'));
|
||||
}
|
||||
}
|
||||
|
@ -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 != '') {
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -29,25 +29,26 @@ require_once ('include/functions_alerts.php');
|
|||
|
||||
$create_profiles = (int) get_parameter ('create_profiles');
|
||||
|
||||
if($create_profiles) {
|
||||
if ($create_profiles) {
|
||||
$profiles_id = get_parameter ('profiles_id', -1);
|
||||
$groups_id = get_parameter ('groups_id', -1);
|
||||
$users_id = get_parameter ('users_id', -1);
|
||||
$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;
|
||||
}else{
|
||||
foreach($profiles_id as $profile){
|
||||
foreach($groups_id as $group){
|
||||
foreach($users_id as $user){
|
||||
}
|
||||
else {
|
||||
foreach ($profiles_id as $profile) {
|
||||
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));
|
||||
// If the profile doesnt exist, we create it
|
||||
if ($profile_data === false) {
|
||||
pandora_audit("User management",
|
||||
"Added profile for user ".safe_input($user));
|
||||
$return = create_user_profile ($user, $profile, $group);
|
||||
if($return !== false){
|
||||
if ($return !== false) {
|
||||
$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,
|
||||
__('Profiles added successfully').'('.$n_added.')',
|
||||
__('Profiles cannot be added'));
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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']*/);
|
||||
}
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -79,8 +79,10 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
|
|||
|
||||
print_result_message ($contsuccess > 0,
|
||||
__('Successfully deleted')."(".$contsuccess."/".$conttotal.")",
|
||||
__('Could not be deleted'));
|
||||
__('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 ();
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -52,90 +52,102 @@ $update_agents = get_parameter ('update_agents', 0);
|
|||
if ($update_agents) {
|
||||
$values = array();
|
||||
|
||||
if(get_parameter ('group', '') != -1)
|
||||
if (get_parameter ('group', '') != -1)
|
||||
$values['id_grupo'] = get_parameter ('group');
|
||||
if(get_parameter ('interval', '') != '')
|
||||
if (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');
|
||||
if(get_parameter ('id_parent', '') != '')
|
||||
if (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');
|
||||
if(get_parameter ('description', '') != '')
|
||||
if (get_parameter ('description', '') != '')
|
||||
$values['comentarios'] = get_parameter ('description');
|
||||
if(get_parameter ('mode', '') != -1)
|
||||
if (get_parameter ('mode', '') != -1)
|
||||
$values['modo'] = get_parameter ('mode');
|
||||
if(get_parameter ('disabled', '') != -1)
|
||||
if (get_parameter ('disabled', '') != -1)
|
||||
$values['disabled'] = get_parameter ('disabled');
|
||||
if(get_parameter ('icon_path', '') != '')
|
||||
if (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');
|
||||
if(get_parameter ('custom_id', '') != '')
|
||||
if (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');
|
||||
if(get_parameter ('delete_conf', 0) != 0)
|
||||
if (get_parameter ('delete_conf', 0) != 0)
|
||||
$values['delete_conf'] = get_parameter('delete_conf');
|
||||
|
||||
$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);
|
||||
if(!$id_agents) {
|
||||
if (!$id_agents) {
|
||||
print_error_message(__('No agents selected'));
|
||||
$id_agents = array();
|
||||
} else{
|
||||
if(empty($values) && empty($fields)){
|
||||
}
|
||||
else {
|
||||
if (empty($values) && empty($fields)) {
|
||||
print_error_message(__('No values changed'));
|
||||
$id_agents = array();
|
||||
}
|
||||
}
|
||||
|
||||
// CONF FILE DELETION
|
||||
if(isset($values['delete_conf'])) {
|
||||
if (isset($values['delete_conf'])) {
|
||||
unset($values['delete_conf']);
|
||||
$n_deleted = 0;
|
||||
foreach($id_agents as $id_agent) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$agent_md5 = md5(get_agent_name($id_agent));
|
||||
@unlink ($config["remote_config"]."/md5/".$agent_md5.".md5");
|
||||
$result = @unlink ($config["remote_config"]."/conf/".$agent_md5.".conf");
|
||||
|
||||
$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 cannot be deleted'));
|
||||
}
|
||||
|
||||
if(empty($values) && empty($fields)){
|
||||
if (empty($values) && empty($fields)) {
|
||||
$id_agents = array();
|
||||
}
|
||||
|
||||
$n_edited = 0;
|
||||
$result = false;
|
||||
foreach($id_agents as $id_agent) {
|
||||
if(!empty($values)) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if (!empty($values)) {
|
||||
$result = process_sql_update ('tagente',
|
||||
$values,
|
||||
array ('id_agente' => $id_agent));
|
||||
}
|
||||
|
||||
// Update Custom Fields
|
||||
foreach($fields as $field) {
|
||||
if(get_parameter_post ('customvalue_'.$field['id_field'], '') != '') {
|
||||
foreach ($fields as $field) {
|
||||
if (get_parameter_post ('customvalue_'.$field['id_field'], '') != '') {
|
||||
$key = $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));
|
||||
|
||||
if($old_value === false) {
|
||||
if ($old_value === false) {
|
||||
// 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'));
|
||||
|
@ -152,7 +174,7 @@ if ($update_agents) {
|
|||
}
|
||||
$id_group = 0;
|
||||
|
||||
$groups = get_user_groups ();
|
||||
$groups = get_user_groups();
|
||||
|
||||
$table->id = 'delete_table';
|
||||
$table->width = '95%';
|
||||
|
@ -328,7 +350,7 @@ $table->data = array ();
|
|||
|
||||
$fields = get_db_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
if($fields === false) $fields = array();
|
||||
if ($fields === false) $fields = array();
|
||||
|
||||
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));
|
||||
|
||||
if($custom_value === false) {
|
||||
if ($custom_value === false) {
|
||||
$custom_value = '';
|
||||
}
|
||||
|
||||
|
@ -345,7 +367,7 @@ foreach ($fields as $field) {
|
|||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
if(!empty($fields)) {
|
||||
if (!empty($fields)) {
|
||||
toggle(print_table ($table, true), __('Custom fields'));
|
||||
}
|
||||
|
||||
|
@ -424,7 +446,7 @@ $(document).ready (function () {
|
|||
"id_agents[]" : idAgents
|
||||
},
|
||||
function (data, status) {
|
||||
if(data == 0){
|
||||
if (data == 0) {
|
||||
$("#delete_configurations").attr("style", "display: none");
|
||||
$("#not_available_configurations").attr("style", "");
|
||||
}
|
||||
|
@ -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"
|
||||
});
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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'));
|
||||
|
||||
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'));
|
||||
|
||||
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);
|
||||
|
|
|
@ -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';
|
||||
}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 = '';
|
||||
}
|
||||
|
||||
|
@ -91,7 +96,7 @@ switch($tab) {
|
|||
}
|
||||
|
||||
// Set the default option of the category
|
||||
if($option == ''){
|
||||
if ($option == '') {
|
||||
$option = array_shift(array_keys($options));
|
||||
}
|
||||
|
||||
|
|
|
@ -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'));
|
||||
|
||||
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'));
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue