Merge branch 'feature/ticket#1412-AgentLogViewer' into develop

This commit is contained in:
Alejandro Gallardo Escobar 2014-12-05 10:50:23 +01:00
commit 4012c6f5e6
1 changed files with 38 additions and 15 deletions

View File

@ -870,6 +870,21 @@ else {
}
/* Log viewer tab */
if (enterprise_installed() && $config['log_collector']) {
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
$agent_has_logs = (bool) db_get_value('id_agent', 'tagent_module_log', 'id_agent', $id_agente);
if ($agent_has_logs && !$is_windows) {
$log_viewer_tab = array();
$log_viewer_tab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=log_viewer&id_agente='.$id_agente.'">'
. html_print_image("images/gm_log.png", true, array("title" => __('Log Viewer')))
. '</a>';
$log_viewer_tab['active'] = $tab == 'log_viewer';
}
}
$onheader = array('manage' => $managetab,
'main' => $maintab,
'alert' => $alerttab,
@ -888,6 +903,10 @@ if ($total_incidents) {
if ($agent['url_address'] != '') {
$onheader['url_address'] = $urladdresstab;
}
// If the log viewer tab exists
if (isset($log_viewer_tab) && !empty($log_viewer_tab)) {
$onheader['log_viewer'] = $log_viewer_tab;
}
//Tabs for extensions
foreach ($config['extensions'] as $extension) {
@ -909,21 +928,21 @@ foreach ($config['extensions'] as $extension) {
}
}
//RHEV extension is only available for RHEV Virtual Machines
if ($extension['extension_ope_tab']['id'] === "rhev_manager") {
//Get id for remote field "rhev_type"
$id_remote_field = db_get_value("id_field", "tagent_custom_fields", "name", "rhev_type");
//Get rhev type for this agent
$rhev_type = db_get_value_filter ("description", "tagent_custom_data", array ("id_field" => $id_remote_field, "id_agent" => $agent['id_agente']));
//Check if rhev type is a vm
if ($rhev_type != "vm") {
continue;
}
}
//RHEV extension is only available for RHEV Virtual Machines
if ($extension['extension_ope_tab']['id'] === "rhev_manager") {
//Get id for remote field "rhev_type"
$id_remote_field = db_get_value("id_field", "tagent_custom_fields", "name", "rhev_type");
//Get rhev type for this agent
$rhev_type = db_get_value_filter ("description", "tagent_custom_data", array ("id_field" => $id_remote_field, "id_agent" => $agent['id_agente']));
//Check if rhev type is a vm
if ($rhev_type != "vm") {
continue;
}
}
$image = $extension['extension_ope_tab']['icon'];
$name = $extension['extension_ope_tab']['name'];
@ -1029,6 +1048,10 @@ switch ($tab) {
case "url_address":
require("operation/agentes/url_address.php");
break;
case "log_viewer":
$embebed_into_agent_view = true;
enterprise_include ("operation/log/log_viewer.php");
break;
case "extension":
$found = false;
foreach($config['extensions'] as $extension) {