' . html_print_image ("images/operation.png", true, array ("title" =>__('View'))) . ''; $viewtab['operation'] = true; $viewtab['active'] = false; $onheader = array('view' => $viewtab); // Header ui_print_page_header (__('Agents defined in %s', get_product_name()), "images/agent_mc.png", false, "", true, $onheader); // Perform actions $agent_to_delete = (int)get_parameter('borrar_agente'); $enable_agent = (int)get_parameter('enable_agent'); $disable_agent = (int)get_parameter('disable_agent'); if($disable_agent != 0){ $server_name = db_get_row_sql('select server_name from tagente where id_agente = '.$disable_agent); } elseif ($enable_agent != 0) { $server_name = db_get_row_sql('select server_name from tagente where id_agente = '.$enable_agent); } $result = null; if ($agent_to_delete) { $id_agente = $agent_to_delete; if (check_acl_one_of_groups ( $config["id_user"], agents_get_all_groups_agent($id_agente), "AW" )) { $id_agentes[0] = $id_agente; $result = agents_delete_agent($id_agentes); } else { // NO permissions. db_pandora_audit("ACL Violation", "Trying to delete agent \'" . agents_get_name ($id_agente). "\'"); require ("general/noaccess.php"); exit; } ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.')); if (enterprise_installed()) { // Check if the remote config file still exist if (isset ($config["remote_config"])) { enterprise_include_once('include/functions_config_agents.php'); if (enterprise_hook('config_agents_has_remote_configuration', array($id_agente))) { ui_print_error_message(__('Maybe the files conf or md5 could not be deleted')); } } } } if ($enable_agent) { $result = db_process_sql_update('tagente', array('disabled' => 0), array('id_agente' => $enable_agent)); $alias = agents_get_alias($enable_agent); if ($result) { // Update the agent from the metaconsole cache enterprise_include_once('include/functions_agents.php'); $values = array('disabled' => 0); enterprise_hook ('agent_update_from_cache', array($enable_agent, $values,$server_name)); db_pandora_audit("Agent management", 'Enable ' . $alias); } else { db_pandora_audit("Agent management", 'Fail to enable ' . $alias); } ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled')); } if ($disable_agent) { $result = db_process_sql_update('tagente', array('disabled' => 1), array('id_agente' => $disable_agent)); $alias = agents_get_alias($disable_agent); if ($result) { // Update the agent from the metaconsole cache enterprise_include_once('include/functions_agents.php'); $values = array('disabled' => 1); enterprise_hook ('agent_update_from_cache', array($disable_agent, $values,$server_name)); db_pandora_audit("Agent management", 'Disable ' . $alias); } else { db_pandora_audit("Agent management", 'Fail to disable ' . $alias); } ui_print_result_message ($result, __('Successfully disabled'), __('Could not be disabled')); } echo "
".__('Agent name') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . ''; echo " | "; echo "".__('R'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . ''; echo " | "; echo "".__('OS'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . ''; echo " | "; echo "".__('Type'). " | "; echo "".__('Group'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . ''; echo " | "; echo "" . __('Description') . " | "; echo "" . __('Actions') . " | "; $color=1; $rowPair = true; $iterator = 0; foreach ($agents as $agent) { /* Begin Update tagente.remote 0/1 with remote agent function return */ if(enterprise_hook('config_agents_has_remote_configuration',array($agent['id_agente']))){ db_process_sql_update('tagente', array('remote' => 1),'id_agente = '.$agent['id_agente'].''); } else{ db_process_sql_update('tagente', array('remote' => 0),'id_agente = '.$agent['id_agente'].''); } /* End Update tagente.remote 0/1 with remote agent function return */ $id_grupo = $agent["id_grupo"]; $cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']); if (! check_acl ($config["id_user"], $id_grupo, "AW", $agent['id_agente']) && ! check_acl ($config["id_user"], $id_grupo, "AD", $agent['id_agente'])) continue; if ($color == 1) { $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } if ($rowPair) $rowclass = 'rowPair'; else $rowclass = 'rowOdd'; $rowPair = !$rowPair; $iterator++; // Agent name echo "
---|---|---|---|---|---|---|
"; if ($agent["disabled"]) { echo ""; } echo ''; echo ""; if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { $main_tab = 'main'; } else { $main_tab = 'module'; } if($agent["alias"] == ''){ $agent["alias"] = $agent["nombre"]; } echo "" . ''.$agent["alias"].'' . ""; echo ""; $in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . ' AND tplanned_downtime.executed = 1'); if ($agent["disabled"]) { ui_print_help_tip(__('Disabled')); if (!$in_planned_downtime) { echo ""; } } if ($agent['quiet']) { echo " "; html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); } if ($in_planned_downtime) { ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png'); echo ""; } echo ' '; echo " | "; echo ""; // Has remote configuration ? if (enterprise_installed()) { enterprise_include_once('include/functions_config_agents.php'); if (enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]))) { echo ""; echo html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config'))); echo ""; } } echo " | "; // Operating System icon echo ""; ui_print_os_icon ($agent["id_os"], false); echo " | "; // Type agent (Networt, Software or Satellite) echo ""; echo ui_print_type_agent_icon ($agent["id_os"], $agent['ultimo_contacto_remoto'], $agent['ultimo_contacto'], $agent['remote'], $agent['agent_version']); echo " | "; // Group icon and name echo "" . ui_print_group_icon ($id_grupo, true)." | "; // Description echo "" . ui_print_truncate_text($agent["comentarios"], 'description', true, true, true, '[…]', 'font-size: 6.5pt;')." | "; // Action //When there is only one element in page it's necesary go back page. if ((count($agents) == 1) && ($offset >= $config["block_size"])) $offsetArg = $offset - $config["block_size"]; else $offsetArg = $offset; echo ""; if ($agent['disabled']) { echo ""; } else{ echo ' onClick="if (!confirm(\' '.__('You are going to enable a cluster agent. Are you sure?').'\')) return false;">'; } echo html_print_image('images/lightbulb_off.png', true, array('alt' => __('Enable agent'), 'title' => __('Enable agent'))) .""; } else { echo ""; } else{ echo ' onClick="if (!confirm(\' '.__('You are going to disable a cluster agent. Are you sure?').'\')) return false;">'; } echo html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) .""; } if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { echo " '; } else{ echo ' onClick="if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;">'; } echo html_print_image('images/cross.png', true, array("border" => '0')) . ""; } echo " | "; } echo "
";
}
else {
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined agents') ) );
}
if (check_acl ($config["id_user"], 0, "AW")) {
// Create agent button
echo ' ';
echo '";
echo ' ';
}
echo " |