From 4792299b5abab542ff5d7a2a6f02c052eadb80dd Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 5 Dec 2014 10:49:50 +0100 Subject: [PATCH] Added a new tab to the agent view --- .../operation/agentes/ver_agente.php | 53 +++++++++++++------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index dbd9234eab..5b5eb1c4ae 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -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'] = '' + . html_print_image("images/gm_log.png", true, array("title" => __('Log Viewer'))) + . ''; + $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) {