From 4dfbdca423fe4066e1c6e9ffca9713f9d8d29479 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 24 Jul 2017 15:53:31 +0200 Subject: [PATCH] add new field table view agents for type of agent --- .../godmode/agentes/modificar_agente.php | 9 ++++ pandora_console/include/functions_ui.php | 22 ++++++++ .../operation/agentes/estado_agente.php | 50 +++++++++++-------- 3 files changed, 61 insertions(+), 20 deletions(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 4fa9725bf9..712abb5dbb 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -488,6 +488,7 @@ if ($agents !== false) { '' . 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)) . ''; @@ -606,6 +607,14 @@ if ($agents !== false) { 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 diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 5aa917b5d4..46a9556e4b 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -660,6 +660,28 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, return $output; } +function ui_print_type_agent_icon ( $id_os = false, $remote_contact = false, $contact = false, + $return = false, $remote = 0, $version = ""){ + + if($id_os == 19){ + //Satellite + $options['title'] = __('Satellite'); + $output = html_print_image("images/op_satellite.png", true, $options, false, false, false, true); + } + else if ($remote_contact == $contact && $remote == 0 && $version == ""){ + //Network + $options['title'] = __('Network'); + $output = html_print_image("images/network.png", true, $options, false, false, false, true); + } + else{ + //Software + $options['title'] = __('Software'); + $output = html_print_image("images/data.png", true, $options, false, false, false, true); + } + + return $output; +} + /** * Prints an agent name with the correct link * diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 64a9f65097..c58c72bdd2 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -466,7 +466,10 @@ else { 'unknown_count', 'notinit_count', 'total_count', - 'fired_count'), + 'fired_count', + 'ultimo_contacto_remoto', + 'remote', + 'agent_version'), $access, $order); } @@ -498,11 +501,11 @@ $table->head[1] = __('Description'). ' ' . $table->size[1] = "16%"; -$table->head[9] = __('Remote'). ' ' . +$table->head[10] = __('Remote'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown, "alt" => "down")) . ''; -$table->size[9] = "9%"; +$table->size[10] = "9%"; $table->head[2] = __('OS'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp, "alt" => "up")) . '' . @@ -517,21 +520,24 @@ $table->size[3] = "10%"; $table->head[4] = __('Group'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown, "alt" => "down")) . ''; -$table->size[4] = "15%"; +$table->size[4] = "8%"; -$table->head[5] = __('Modules'); -$table->size[5] = "10%"; +$table->head[5] = __('Type'); +$table->size[5] = "8%"; -$table->head[6] = __('Status'); -$table->size[6] = "4%"; +$table->head[6] = __('Modules'); +$table->size[6] = "10%"; -$table->head[7] = __('Alerts'); +$table->head[7] = __('Status'); $table->size[7] = "4%"; -$table->head[8] = __('Last contact'). ' ' . +$table->head[8] = __('Alerts'); +$table->size[8] = "4%"; + +$table->head[9] = __('Last contact'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . ''; -$table->size[8] = "15%"; +$table->size[9] = "15%"; $table->align = array (); @@ -542,9 +548,9 @@ $table->align[5] = "left"; $table->align[6] = "left"; $table->align[7] = "left"; $table->align[8] = "left"; +$table->align[9] = "left"; $table->style = array(); -//$table->style[0] = 'width: 15%'; $table->data = array (); @@ -584,14 +590,14 @@ foreach ($agents as $agent) { $data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[…]', 'font-size: 6.5pt'); - $data[9] = ""; + $data[10] = ""; if (enterprise_installed()) { enterprise_include_once('include/functions_config_agents.php'); if (enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]))) { - $data[9] = html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Remote config'))); + $data[10] = html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Remote config'))); } } @@ -602,14 +608,18 @@ foreach ($agents as $agent) { $data[4] = ui_print_group_icon ($agent["id_grupo"], true); $agent['not_init_count'] = $agent['notinit_count']; - $data[5] = reporting_tiny_stats($agent, true, 'modules', ':', $strict_user); + + $data[5] = ui_print_type_agent_icon ($agent["id_os"], $agent['ultimo_contacto_remoto'], + $agent['ultimo_contacto'], $agent['remote'], + $agent['agent_version']); + + $data[6] = reporting_tiny_stats($agent, true, 'modules', ':', $strict_user); + + $data[7] = $status_img; + $data[8] = $alert_img; - $data[6] = $status_img; - - $data[7] = $alert_img; - - $data[8] = agents_get_interval_status ($agent); + $data[9] = agents_get_interval_status ($agent); // This old code was returning "never" on agents without modules, BAD !! // And does not print outdated agents in red. WRONG !!!!