diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ad1758affd..36569ef543 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,22 @@ +2009-04-09 Evi Vanoost + + * include/functions_reporting.php: Added get_agent_module_info which gives + valuable information that can be re-used and expanded + + * include/functions_events.php, include/functions_ui.php: The chunk_split + only works with set width removed for wide css. General cleanup + + * include/functions_db.php: get_group_agents allows search now + + * include/styles/pandora_width.css, include/styles/pandora.css, + include/styles/menu.css: The menu for the agent editor is now even with the + operation menu and also takes up the whole width + + * operation/agentes/tactical.php: Changed for width. Now takes up the wide + + * operation/agentes/estado_agente.php: Rewritten. Now outputs variable + width table and is cleaner + 2009-04-08 Jorge Gonzalez * images/console/icons/dotmin_ok.png, diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 93034264d2..d39ce07daa 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -321,12 +321,12 @@ function give_disabled_group ($id_group) { * Get all the agents within a group(s). * * @param mixed $id_group Group id or an array of ID's. If nothing is selected, it will select all - * @param bool $disabled Add disabled agents to agents. Default: False. + * @param mixed $search to add Default: False. If True will return disabled agents as well. If searching array (disabled => (bool), string => (string)) * @param string $case Which case to return the agentname as (lower, upper, none) * * @return array An array with all agents in the group or an empty array */ -function get_group_agents ($id_group = 0, $disabled = false, $case = "lower") { +function get_group_agents ($id_group = 0, $search = false, $case = "lower") { global $config; $id_group = safe_acl_group ($config["id_user"], $id_group, "AR"); @@ -337,8 +337,20 @@ function get_group_agents ($id_group = 0, $disabled = false, $case = "lower") { } $search = sprintf ('WHERE id_grupo IN (%s)', implode (",", $id_group)); - - if (!empty ($disabled)) { + + if ($search === true) { + //No added search. Show both disabled and non-disabled + } elseif (is_array ($search)) { + if (isset ($search["disabled"])) { + $search .= ' AND disabled = '.($search["disabled"] ? 1 : 0); //Bool, no cleanup necessary + } else { + $search .= ' AND disabled = 0'; + } + if (isset ($search["string"])) { + $string = safe_input ($search["string"]); + $search .= ' (nombre LIKE "'.$string.'" OR comentarios LIKE "'.$string.'" OR direccion LIKE "'.$string.'"'; + } + } else { $search .= ' AND disabled = 0'; } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 420aab8d24..50d22bb973 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -294,16 +294,11 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return = // Event description wrap around by default at 44 or ~3 lines (10 seems to be a good ratio to wrap around for most sizes. Smaller number gets longer strings) $wrap = floor ($width / 10); - $data[2] = ''.safe_input (chunk_split (mb_substr ($event["evento"],0, $wrap),8, "­")); - - if (mb_strlen ($event["evento"]) > $wrap) { - $data[2] .= "…"; - } - $data[2] .= ''; + $data[2] = ''.safe_input ($event["evento"]).''; if ($event["id_agente"] > 0) { // Agent name - $data[3] = print_agent_name ($event["id_agente"], true, floor ($width / 20)); //At 440 this would be be 22. + $data[3] = print_agent_name ($event["id_agente"], true); // for System or SNMP generated alerts } elseif ($event["event_type"] == "system") { $data[3] = __('System'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 3020e9096f..7ba8757c37 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -738,4 +738,99 @@ function get_agents_detailed_event_reporting ($id_agents, $period = 0, $date = 0 return print_table ($table, $return); } +/** + * Get a detailed report of the modules of the agent + * + * @param int $id_agent Agent id to get the report for. + * + * @return array An array + */ +function get_agent_module_info ($id_agent) { + global $config; + + $return = array (); + $return["modules"] = 0; //Number of modules + $return["monitor_normal"] = 0; //Number of 'good' monitors + $return["monitor_warning"] = 0; //Number of 'warning' monitors + $return["monitor_critical"] = 0; //Number of 'critical' monitors + $return["monitor_down"] = 0; //Number of 'down' monitors + $return["last_contact"] = 0; //Last agent contact + $return["interval"] = get_agent_interval ($id_agent); //How often the agent gets contacted + $return["status_img"] = print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data'), true); + $return["alert_status"] = "notfired"; + $return["alert_img"] = print_status_image(STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true); + $return["agent_group"] = get_agent_group ($id_agent); + + if (!give_acl ($config["id_user"], $return["agent_group"], "AR")) { + return $return; + } + + $sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo + WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND + tagente_modulo.disabled = 0 AND tagente_modulo.id_agente = %d", $id_agent); + + $modules = get_db_all_rows_sql ($sql); + + if ($modules === false) { + return $return; + } + + $now = get_system_time (); + + // Calculate modules for this agent + foreach ($modules as $module) { + $return["modules"]++; + + if ($module["module_interval"] > $return["interval"]) { + $return["interval"] = $module["module_interval"]; + } elseif ($module["module_interval"] == 0) { + $module["module_interval"] = $return["interval"]; + } + + if ($module["utimestamp"] > $return["last_contact"]) { + $return["last_contact"] = $module["utimestamp"]; + } + + if ($module["id_tipo_modulo"] < 21 || $module["id_tipo_modulo"] != 100) { + $async = 0; + } else { + $async = 1; + } + + if ($async == 0 && ($module["utimestamp"] < ($now - $module["module_interval"] * 2))) { + $return["monitor_down"]++; + } elseif ($module["estado"] == 2) { + $return["monitor_warning"]++; + } elseif ($module["estado"] == 1) { + $return["monitor_critical"]++; + } else { + $return["monitor_normal"]++; + } + } + + //No modules is by default + if ($return["modules"] > 0) { + if ($return["monitor_down"] > 0) { + $return["status_img"] = print_status_image (STATUS_AGENT_DOWN, __('At least one module DOWN'), true); + } elseif ($return["monitor_critical"] > 0) { + $return["status_img"] = print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true); + } elseif ($return["monitor_warning"] > 0) { + $return["status_img"] = print_status_image (STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true); + } else { + $return["status_img"] = print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true); + } + } + + //Alert not fired is by default + if (give_disabled_group ($return["agent_group"])) { + $return["alert_status"] = "disabled"; + $return["alert_img"] = print_status_image (STATUS_ALERT_DISABLED, __('Alert disabled'), true); + } elseif (check_alert_fired ($id_agent) == 1) { + $return["alert_status"] = "fired"; + $return["alert_img"] = print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true); + } + + return $return; +} + ?> diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index cb084ab647..6628a3f036 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -208,10 +208,10 @@ function print_group_icon ($id_group, $return = false, $path = "groups_small") { $output .= ''.get_group_name ($id_group).''; $output .= ''; - if ($return) - return $output; + if (!$return) + echo $output; - echo $output; + return $output; } /** @@ -236,10 +236,10 @@ function print_os_icon ($id_os, $name = true, $return = false) { $output .= ' - '.$os_name; } - if ($return) - return $output; + if (!$return) + echo $output; - echo $output; + return $output; } /** @@ -247,20 +247,13 @@ function print_os_icon ($id_os, $name = true, $return = false) { * * @param int Agent id * @param bool Whether to return the string or echo it too - * @param int After how much characters to cut off the inside of the - * link. The full agent name will remain in the roll-over + * @param int Now uses styles to accomplish this * * @return string HTML with agent name and link */ function print_agent_name ($id_agent, $return = false, $cutoff = 0) { $agent_name = (string) get_agent_name ($id_agent); - $output = ''; - if ($cutoff > 0 && (mb_strlen ($agent_name, "UTF-8") > $cutoff)) { - $output .= mb_substr (utf8_decode ($agent_name), 0, $cutoff, "UTF-8").'...'; - } else { - $output .= $agent_name; - } - $output .= ''; + $output = ''.$agent_name.''; //TODO: Add a pretty javascript (using jQuery) popup-box with agent details @@ -1055,13 +1048,12 @@ define('STATUS_ALERT_DISABLED', 'alert_disabled.png'); define('STATUS_SERVER_OK', 'server_ok.png'); define('STATUS_SERVER_DOWN', 'server_down.png'); -function print_status_image($type, $title = "", $return = false) -{ +function print_status_image($type, $title = "", $return = false) { list($imagepath) = get_status_images_path(); $imagepath .= "/" . $type; - return print_image ($imagepath, $return, array ("border" => 0, "title" => $title)); + return print_image ($imagepath, $return, array ("border" => 0, "title" => $title)); } ?> diff --git a/pandora_console/include/styles/menu.css b/pandora_console/include/styles/menu.css index 078ffa1ad3..db41de802d 100644 --- a/pandora_console/include/styles/menu.css +++ b/pandora_console/include/styles/menu.css @@ -24,7 +24,6 @@ border-width: 1px 0 0 1px; border-style: solid; border-color: #dadbdc; - width: 155px; } .menu ul { list-style-type: none; @@ -56,7 +55,7 @@ .submenu { font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; margin: 0px 10px 0px 0; - width:155px; + width: 164px; } .submenu li a { background-color: #fff; diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 8a00bdf850..5357ff6e7d 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -31,6 +31,7 @@ body { input, textarea { border: 1px solid #ddd; } + textarea { padding: 5px; min-height: 100px; @@ -178,7 +179,7 @@ div#page { border-top: solid 5px #786; } div#main { - width: 780px; + width: 785px; min-height: 500px; float: right; padding-left: 0px; @@ -192,7 +193,7 @@ div#main { margin-right: 0px; } div#menu { - width: 155px; + width: 165px; float: left; } div#head { @@ -445,23 +446,17 @@ div.title_line { height: 5px; width: 762px; } -#menu_tab_frame { - background: #D84437; - width: 805px; - min-height: 22px; - padding-left: 0px; - margin-left: -25px; - float:left; - border-bottom: 1px solid #778866; +#menu_tab_frame, #menu_tab_frame_view { + background:#D84437 none repeat scroll 0 0; + border-bottom:1px solid #778866; + float:left; + margin-left:-8px; + min-height:25px; + padding-right:8px; + width:100%; } #menu_tab_frame_view { - background: #66AA44; - width: 805px; - min-height: 22px; - padding-left: 0px; - margin-left: -25px; - float:left; - border-bottom: 1px solid #778866; + background: #66AA44; } #menu_tab .mn, #menu_tab ul, #menu_tab .mn ul { padding: 0px; @@ -472,21 +467,17 @@ div.title_line { float: right; position: relative; } -#menu_tab li a, #menu_tab li.nomn a { +#menu_tab li a, #menu_tab a { background: #d4ddc6; - padding: 2px 5px 2px 5px; + padding: 3px 5px; color: #333; border-left: 2px solid #778866; font-weight: bold; - line-height: 18px; + line-height: 19px; } #menu_tab li.nomn_high a { background: #799E48; color: #fff; - padding: 2px 10px 2px 10px; - border-left: 2px solid #778866; - font-weight: bold; - line-height: 18px; } #menu_tab .mn li a { display: block; diff --git a/pandora_console/include/styles/pandora_width.css b/pandora_console/include/styles/pandora_width.css index 471d3588de..2f029737eb 100644 --- a/pandora_console/include/styles/pandora_width.css +++ b/pandora_console/include/styles/pandora_width.css @@ -42,7 +42,7 @@ div#main { padding-left: 0px; padding-top: 0px; padding-bottom: 20px; - margin-left: 180px; + margin-left: 175px; margin-right: 20px; } div#head { @@ -57,8 +57,10 @@ ol.steps { div#steps_clean { display:none; } -div#menu_tab_frame { +#menu_tab_frame, #menu_tab_frame_view { width: 100%; + padding-right: 28px; + margin-left: -8px; } div#events_list { float: left; diff --git a/pandora_console/operation/agentes/bulbs.php b/pandora_console/operation/agentes/bulbs.php index 68ecf7b69d..0c74977856 100644 --- a/pandora_console/operation/agentes/bulbs.php +++ b/pandora_console/operation/agentes/bulbs.php @@ -16,25 +16,25 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -echo " - +echo ' +
- - - + + + - - + + - + - - - + + + - +
" . print_status_image(STATUS_AGENT_OK, __('All Monitors OK'), true) . __('All Monitors OK') . "" . print_status_image(STATUS_MODULE_CRITICAL, __('At least one monitor fails'), true) . __('At least one monitor fails') . "" . print_status_image(STATUS_MODULE_WARNING, __('Change between Green/Red state'), true) . __('Change between Green/Red state') . "' . print_status_image(STATUS_AGENT_OK, __('All Monitors OK'), true) . __('All Monitors OK') . '' . print_status_image(STATUS_MODULE_CRITICAL, __('At least one monitor fails'), true) . __('At least one monitor fails') . '' . print_status_image(STATUS_MODULE_WARNING, __('Change between Green/Red state'), true) . __('Change between Green/Red state') . '" . print_status_image(STATUS_ALERT_FIRED, __('Alert fired'), true) . __('Alert fired') . "" . print_status_image(STATUS_ALERT_DISABLED, __('Alert disabled'), true) . __('Alerts disabled') . "' . print_status_image(STATUS_ALERT_FIRED, __('Alert fired'), true) . __('Alert fired') . '' . print_status_image(STATUS_ALERT_DISABLED, __('Alert disabled'), true) . __('Alerts disabled') . '
" . print_status_image(STATUS_AGENT_NO_MONITORS, __('Agent without monitors'), true) . __('Agent without monitors') . "" . print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data'), true) . __('Agent without data') . "" . print_status_image(STATUS_AGENT_DOWN, __('Agent down'), true) . __('Agent down') . "' . print_status_image(STATUS_AGENT_NO_MONITORS, __('Agent without monitors'), true) . __('Agent without monitors') . '' . print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data'), true) . __('Agent without data') . '' . print_status_image(STATUS_AGENT_DOWN, __('Agent down'), true) . __('Agent down') . '" . print_status_image(STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true) . __('Alert not fired') . "' . print_status_image(STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true) . __('Alert not fired') . '
-"; +'; ?> diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index a1a6ef1629..17283b0f14 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -18,6 +18,7 @@ // Load global vars require_once ("include/config.php"); +require_once ("include/functions_reporting.php"); check_login (); if (! give_acl ($config['id_user'], 0, "AR")) { @@ -56,302 +57,141 @@ echo "

".__('Pandora Agents')." > ".__('Summary')."

"; // Show group selector (POST) if (isset($_POST["ag_group"])){ - $ag_group = $_POST["ag_group"]; - echo "
"; + $ag_group = get_parameter_post ("ag_group"); + echo ''; } else { - echo ""; + echo ''; } -echo ""; -echo ""; -echo "
".__('Group').""; +echo ''; +echo ''; + +echo '
'.__('Group').''; $groups = get_user_groups (); print_select ($groups, 'ag_group', $ag_group, 'this.form.submit()', '', ''); -echo " - -"; +echo ''; -echo __('Free text for search (*)'); -echo ""; -echo "
"; -echo ""; -echo "
"; -echo ""; -echo ""; -echo "
"; +echo __('Free text for search').' (*)'; +echo '
'; +print_input_text ("search", $search, '', 15); + +echo ''; + +print_submit_button (__('Search'), "srcbutton", '', array ("class" => "sub")); + +echo "
"; if ($search != ""){ - $search_sql = " AND ( nombre LIKE '%$search%' OR comentarios LIKE '%$search%' OR direccion LIKE '%$search%' ) "; + $search_sql = array ("string" => '%'.$search.'%'); } else { - $search_sql = ""; + $search_sql = array (); } // Show only selected groups -if ($ag_group > 1){ - $sql="SELECT * FROM tagente WHERE id_grupo=$ag_group - AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"]; - $sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo=$ag_group - AND disabled = 0 $search_sql ORDER BY nombre"; +if ($ag_group > 1) { + $agent_names = get_group_agents ($ag_group, $search_sql, "upper"); // Not selected any specific group } else { - // Is admin user ?? - if (is_user_admin ($config["id_user"])) { - $sql = "SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"]; - $sql2 = "SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo"; - // standard user - } else { - // User has explicit permission on group 1 ? - $sql = sprintf ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='%s' AND id_grupo = 1", $config['id_user']); - $all_group = get_db_sql ($sql); - - if ($all_group > 0) { - $sql = sprintf ("SELECT * FROM tagente - WHERE disabled = 0 %s - ORDER BY nombre, id_grupo LIMIT %d,%d", - $search_sql, $offset, - $config["block_size"]); - $sql2 = sprintf ("SELECT COUNT(id_agente) - FROM tagente WHERE disabled = 0 %s - ORDER BY nombre, id_grupo", - $search_sql); - } else { - $sql = sprintf ("SELECT * FROM tagente - WHERE disabled = 0 %s - AND id_grupo IN (SELECT id_grupo - FROM tusuario_perfil - WHERE id_usuario='%s') - ORDER BY nombre, id_grupo LIMIT %d,%d", - $search_sql, $config['id_user'], $offset, - $config["block_size"]); - $sql2 = sprintf ("SELECT COUNT(id_agente) - FROM tagente - WHERE disabled = 0 %s - AND id_grupo IN (SELECT id_grupo - FROM tusuario_perfil - WHERE id_usuario='%s') - ORDER BY nombre, id_grupo", - $search_sql, $config['id_user']); - } - - } + $user_group = get_user_groups ($config["id_user"], "AR"); + $agent_names = get_group_agents (array_keys ($user_group), $search_sql, "upper"); } +if (!empty ($agent_names)) { + $agents = get_db_all_rows_sql (sprintf ("SELECT * FROM tagente WHERE id_agente IN (%s)", implode (",", array_keys ($agent_names)))); +} + +if (empty ($agents)) { + $agents = array (); +} -$result2 = mysql_query ($sql2); -$row2 = mysql_fetch_array ($result2); -$total_events = $row2[0]; // Prepare pagination +pagination (count ($agents), "index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$ag_group&refr=60&search=$search", $offset); -pagination ($total_events, - "index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$ag_group&refr=60&search=$search", - $offset); // Show data. -$agents = get_db_all_rows_sql ($sql); +$table->cellpadding = 4; +$table->cellspacing = 4; +$table->width = "90%"; +$table->class = "databox"; -if ($agents !== false) { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - // For every agent defined in the agent table - $color = 1; - foreach ($agents as $agent) { - $intervalo = $agent["intervalo"]; // Interval in seconds - $id_agente = $agent['id_agente']; - $nombre_agente = substr (strtoupper ($agent["nombre"]), 0, 18); - $direccion_agente = $agent["direccion"]; - $id_grupo = $agent["id_grupo"]; - $id_os = $agent["id_os"]; - $ultimo_contacto = $agent["ultimo_contacto"]; - $biginterval = $intervalo; - - // New check for agent down only based on last contact - $diff_agent_down = get_system_time () - strtotime ($agent["ultimo_contacto"]); - if ($diff_agent_down > $intervalo * 2) - $agent_down = 1; - else - $agent_down = 0; - - $belongs = false; - //Verifiy if the group this agent begins is one of the user groups - foreach ($groups as $migrupo) { - if ($migrupo || $id_grupo == $migrupo) { - $belongs = true; - break; - } - } - if (! $belongs) - continue; +$table->head = array (); +$table->head[0] = __('Agent'); +$table->head[1] = __('OS'); +$table->head[2] = __('Interval'); +$table->head[3] = __('Group'); +$table->head[4] = __('Modules'); +$table->head[5] = __('Status'); +$table->head[6] = __('Alerts'); +$table->head[7] = __('Last contact'); + +$table->align = array (); +$table->align[1] = "center"; +$table->align[2] = "center"; +$table->align[3] = "center"; +$table->align[4] = "center"; +$table->align[5] = "center"; +$table->align[6] = "center"; +$table->align[7] = "right"; + +$table->data = array (); + +foreach ($agents as $agent) { + $agent_info = get_agent_module_info ($agent["id_agente"]); - // Obtenemos la lista de todos los modulos de cada agente - $sql = "SELECT * FROM tagente_estado, tagente_modulo - WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND - tagente_modulo.disabled = 0 - AND tagente_modulo.id_agente=".$id_agente; - $modules = get_db_all_rows_sql ($sql); - if ($modules === false) - $modules = array (); - $numero_modulos = 0; - $est_timestamp = ""; - $monitor_normal = 0; - $monitor_warning = 0; - $monitor_critical = 0; - $monitor_down = 0; - $now = get_system_time (); - - // Calculate module/monitor totals for this agent - foreach ($modules as $module) { - $numero_modulos ++; - $ultimo_contacto_modulo = $module["timestamp"]; - $module_interval = $module["module_interval"]; - $module_type = $module["id_tipo_modulo"]; - - if ($module_interval > $biginterval) - $biginterval = $module_interval; - if ($module_interval != 0) - $intervalo_comp = $module_interval; - else - $intervalo_comp = $intervalo; - if ($ultimo_contacto != "") - $seconds = $now - strtotime ($ultimo_contacto_modulo); - else - $seconds = -1; - if ($module_type < 21 || $module_type != 100) { - $async = 0; - } else { - $async = 1; - } - // Defines if Agent is down (interval x 2 > time last contact - if (($seconds >= ($intervalo_comp * 2)) && ($module_type < 21)) { // If (intervalx2) secs. ago we don't get anything, show alert - - if ($async == 0) - $monitor_down++; - } else { - if ($module["estado"] == 2) - $monitor_warning++; - elseif ($module["estado"]== 1) - $monitor_critical++; - else - $monitor_normal++; - } - } - // Color change for each line (1.2 beta2) - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - echo ""; - echo ""; - - // Show SO icon - echo ""; - // If there are a module interval bigger than agent interval - if ($biginterval > $intervalo) { - echo ""; - } else { - echo ""; - } - - // Show GROUP icon - echo '"; + $data = array (); - - echo ""; - echo ""; + $data[0] = ''; + if (give_acl ($config['id_user'], $agent["id_grupo"], "AW")) { + $data[0] .= ''; + $data[0] .= print_image ("images/setup.png", true, array ("border" => 0, "width" => 16)); + $data[0] .= ' '; } - echo ""; - echo "
".__('Agent')."".__('OS')."".__('Interval')."".__('Group')."".__('Modules')."".__('Status')."".__('Alerts')."".__('Last contact')."
"; - if (give_acl ($config['id_user'], $id_grupo, "AW")) { - echo " -  "; - } - echo ''; - echo $nombre_agente; - echo ""; - print_os_icon ($id_os, false); - echo " - ".$biginterval."".$intervalo."'; - echo ""; - echo print_group_icon ($id_grupo); - //echo ' ('; - //echo get_group_name ($id_grupo); - //echo ")"; - echo ""; - - - echo "".$numero_modulos." "; - if ($monitor_normal > 0) - echo " : ".$monitor_normal." "; - if ($monitor_warning > 0) - echo " : ".$monitor_warning." "; - if ($monitor_critical > 0) - echo " : ".$monitor_critical." "; - if ($monitor_down > 0) - echo " : ".$monitor_down.""; - echo ""; - if ($numero_modulos > 0){ - if ($agent_down > 0) { - print_status_image(STATUS_AGENT_DOWN, __('Agent down')); - } elseif ($monitor_critical > 0) { - print_status_image(STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status')); - } elseif ($monitor_warning > 0) { - print_status_image(STATUS_AGENT_WARNING, __('At least one module in WARNING status')); - } else { - print_status_image(STATUS_AGENT_OK, __('All Monitors OK')); - } - } else { - print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data')); - } - - // checks if an alert was fired recently - echo ""; - if (give_disabled_group ($id_grupo)) { - print_status_image(STATUS_ALERT_DISABLED, __('Alert disabled')); - } else { - if (check_alert_fired ($id_agente) == 1) - print_status_image(STATUS_ALERT_FIRED, __('Alert fired')); - else - print_status_image(STATUS_ALERT_NOT_FIRED, __('Alert not fired')); - } - echo ""; - print_timestamp ($ultimo_contacto); - echo "

"; + + $data[0] .= print_agent_name ($agent["id_agente"], true, "upper"); + + $data[1] = print_os_icon ($agent["id_os"], false, true); + + if ($agent_info["interval"] > $agent["intervalo"]) { + $data[2] = ''.$agent_info["interval"].''; + } else { + $data[2] = $agent["intervalo"]; + } + + $data[3] = print_group_icon ($agent["id_grupo"], true); + + $data[4] = ''; + $data[4] .= $agent_info["modules"]; + $data[4] .= ' : '.$agent_info["monitor_normal"].''; + $data[4] .= ' : '.$agent_info["monitor_warning"].''; + $data[4] .= ' : '.$agent_info["monitor_critical"].''; + $data[4] .= ' : '.$agent_info["monitor_down"].''; + + $data[5] = $agent_info["status_img"]; + + $data[6] = $agent_info["alert_img"]; + + $data[7] = print_timestamp ($agent_info["last_contact"], true); + + array_push ($table->data, $data); +} + +if (!empty ($table->data)) { + print_table ($table); + unset ($table); require ("bulbs.php"); } else { - echo '
'.__('There are no agents included in this group').'
'; - if (give_acl ($config['id_user'], 0, "LM") - || give_acl ($config['id_user'], 0, "AW") - || give_acl ($config['id_user'], 0, "PM") - || give_acl ($config['id_user'], 0, "DM") - || give_acl ($config['id_user'], 0, "UM")) { - - echo '
'; - print_input_hidden ('new_agent', 1); - print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"'); - echo '
'; - } + echo '
'.__('There are no agents included in this group').'
'; } +if (give_acl ($config['id_user'], 0, "LM") || give_acl ($config['id_user'], 0, "AW") + || give_acl ($config['id_user'], 0, "PM") || give_acl ($config['id_user'], 0, "DM") + || give_acl ($config['id_user'], 0, "UM")) { + + echo '
'; + print_input_hidden ('new_agent', 1); + print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"'); + echo '
'; +} ?> diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index 77a130e323..a81daf524c 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -51,7 +51,7 @@ echo "

".__('Pandora Agents')." > ".__('Tactical view')."

"; $data = get_group_stats (); -echo '
'; +echo '
'; // Monitor checks $table->width = "100%"; @@ -69,19 +69,19 @@ $table->style[0] = "padding-top:4px; padding-bottom:4px;"; $table->data[0][0] =''.__('Monitor health').''; $table->style[1] = "padding-top:4px; padding-bottom:4px;"; -$table->data[1][0] = print_image ($img.$data["monitor_health"], true, array ("title" => $data["monitor_health"].'% '.__('of monitors up'))); +$table->data[1][0] = print_image ($img.$data["monitor_health"], true, array ("width" => '100%', "height" => 20, "title" => $data["monitor_health"].'% '.__('of monitors up'))); $table->style[2] = "padding-top:4px; padding-bottom:4px;"; $table->data[2][0] = ''.__('Module sanity').''; $table->style[3] = "padding-top:4px; padding-bottom:4px;"; -$table->data[3][0] = print_image ($img.$data["module_sanity"], true, array ("title" => $data["module_sanity"].'% '.__('of total modules inited'))); +$table->data[3][0] = print_image ($img.$data["module_sanity"], true, array ("width" => '100%', "height" => 20, "title" => $data["module_sanity"].'% '.__('of total modules inited'))); $table->style[4] = "padding-top:4px; padding-bottom:4px;"; $table->data[4][0] = ''.__('Alert level').''; $table->style[5] = "padding-top:4px; padding-bottom:4px;"; -$table->data[5][0] = print_image ($img.$data["alert_level"], true, array ("title" => $data["alert_level"].'% '.__('of defined alerts not fired'))); +$table->data[5][0] = print_image ($img.$data["alert_level"], true, array ("width" => '100%', "height" => 20, "title" => $data["alert_level"].'% '.__('of defined alerts not fired'))); print_table ($table); unset ($table); @@ -150,7 +150,7 @@ print_cells_temp ($cells); echo ""; echo '
'; //Left column -echo '
'; +echo '
'; // Server information @@ -205,7 +205,7 @@ if (!empty ($table->data)) { } unset ($table); -print_events_table ("", 10, 570); +print_events_table ("", 10, "100%"); echo '
'; ?>