diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 008488318a..5ec2768e83 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,48 @@ +2008-04-03 Sancho Lerena + + * pandoradb_data.sql: IA to prediction in description. + + * pandoradb.sql: Added priority to alert and custom recovery fields. + + * include/styles/tip.css, include/styles/pandora.css: New styles + for tooltip info (combined and alerts) and some changes in frames for + agent management / view. + + * include/functions_db.php: Added check_server_status() function to check + from console server status. If in 15 minutes there is no updated keepalive + from any server, they will be marked as down. And function return down. + This function is now called on each page. Added funtions to display alert + status in a tooltip. + + * include/languages/language_en.php: More strings. + + * include/functions.php: Added several funtions to simplify alert report. + + * operation/agentes/estado_alertas.php: Updated. Shows also combined + alerts and give a lot of information in different tooltips. + + * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL. + + * operation/agentes/estado_monitores.php: now is possible to force a + module refresh from main view. + + * operation/agentes/ver_agente.php: Tab has been upgraded. + + * images/mod_data.png, + images/mod_data_inc.png + images/mod_proc.png + images/mod_keepalive.png + images/mod_string.png: Added new type icons and updated old ones. + + * general/header.php: Global check for servers and autorefresh control. + + * godmode/agentes/alert_manager.php: New alert management for combined + alerts, visualization, etc. + + * godmode/agentes/configurar_agente.php: Included new alert management. + + * godmode/agentes/alert_manager_editor.php: New alert management editor. + 2008-04-01 Sancho Lerena * pandoradb_data.sql: Alert type 0 is not 1. 1-3 are reserved. Removed diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index eeb7832a38..f36267a829 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -25,11 +25,12 @@ echo ' '; echo "
"; - -echo " +echo "
"; if (isset ($_SESSION["id_usuario"])){ - echo "
"; + + // Fist column + echo ""; $id_usuario = entrada_limpia ($_SESSION["id_usuario"]); if (dame_admin($_SESSION["id_usuario"])==1) echo " "; @@ -37,12 +38,36 @@ if (isset ($_SESSION["id_usuario"])){ echo " "; echo "".$lang_label["has_connected"]. ' ['. $id_usuario. ']'; - echo "
"; - echo " ". $lang_label["logout"].""; - echo "
"; + + // Second column + echo ""; echo " ". $lang_label["information"].""; - echo "
"; - echo " ". $lang_label["help"].""; + + // Third column + echo "
"; + // Autorefresh + if ((isset($_GET["refr"])) OR (isset($_POST["refr"]))) { + echo " ". lang_string("Autorefresh").""; + } else { + echo " ". lang_string("Autorefresh").""; + } + + + echo "
"; + echo " ". $lang_label["logout"].""; + + echo ""; + $server_status = check_server_status (); + if ($server_status == 0) + echo " ". lang_string("Server status: DOWN").""; + else + echo " ". lang_string("System ready").""; + + echo ""; + // Event - refresh + echo " ". lang_string("events").""; + + } echo "
"; echo "
"; diff --git a/pandora_console/godmode/agentes/alert_manager.php b/pandora_console/godmode/agentes/alert_manager.php index 23867615c2..5c5213fed7 100644 --- a/pandora_console/godmode/agentes/alert_manager.php +++ b/pandora_console/godmode/agentes/alert_manager.php @@ -1,20 +1,13 @@ -// Additions to Pandora FMS 1.2 graph code and new XML reporting template management -// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es -// +// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +// Please see http://pandora.sourceforge.net for full contribution list + // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 +// as published by the Free Software Foundation for version 2. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -22,7 +15,6 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - // ==================================================================================== // VIEW ALERTS // ==================================================================================== @@ -38,9 +30,7 @@ if (give_acl($config["id_user"], 0, "AW")!=1) { exit; }; - -echo "

".$lang_label["agent_conf"]." > ".$lang_label["modules"]."

"; - +echo "

".$lang_label["agent_conf"]." > ".$lang_label["alerts"]."

"; // ========================== // Create module/type combo // ========================== @@ -58,14 +48,15 @@ echo '"; echo ""; - -echo "

".$lang_label["agent_conf"]." > ".$lang_label["alerts"]."

"; +// ========================== +// Simple alerts view +// ========================== $sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'"'; $result=mysql_query($sql1); if ($row=mysql_num_rows($result)){ - echo "

".$lang_label["assigned_alerts"]."

"; + echo "

".lang_string ("Simple alerts")."

"; $color=1; $string=''; @@ -94,48 +85,7 @@ $result=mysql_query($sql1); $nombre_alerta = $row4["nombre"]; $string = $string."".$nombre_modulo; - if ($row3["disable"] == 1){ - $string .= "".$lang_label["disabled"].""; - } else { - if ($id_tipo > 0) { - $string .= ""; - } else - $string .= ""; - } - $string = $string."".$nombre_alerta; - - $string = $string."".human_time_description($row3["time_threshold"]); - - $mytempdata = fmod($row3["dis_min"], 1); - if ($mytempdata == 0) - $mymin = intval($row3["dis_min"]); - else - $mymin = $row3["dis_min"]; - $mymin = format_for_graph($mymin ); - - $mytempdata = fmod($row3["dis_max"], 1); - if ($mytempdata == 0) - $mymax = intval($row3["dis_max"]); - else - $mymax = $row3["dis_max"]; - $mymax = format_for_graph($mymax ); - - // We have alert text ? - if ($row3["alert_text"] != "") - $string = $string."".$lang_label["text"].""; - else { - $string = $string."".$mymin.""; - $string = $string."".$mymax.""; - } - $time_from_table =$row3["time_from"]; - $time_to_table =$row3["time_to"]; - $string = $string.""; - if ($time_to_table == $time_from_table) - $string .= $lang_label["N/A"]; - else - $string .= substr($time_from_table,0,5)." - ".substr($time_to_table,0,5); - - $string = $string."".salida_limpia($row3["descripcion"]); + $string .= show_alert_row_edit ($row3, $tdcolor, $row["id_tipo_modulo"],0); $string = $string.""; $id_grupo = dame_id_grupo($id_agente); if (give_acl($id_user, $id_grupo, "LW")==1){ @@ -145,7 +95,7 @@ $result=mysql_query($sql1); ".$lang_label["delete"]."   "; $string = $string." + id_agente=".$id_agente."&update_alert=".$row3["id_aam"]."'> ".$lang_label["update"].""; } $string = $string.""; @@ -161,6 +111,7 @@ $result=mysql_query($sql1); ".$lang_label["max."]." ".$lang_label["time"]." ".$lang_label["description"]." + ".lang_string ("info")." ".$lang_label["action"].""; echo $string; echo ""; @@ -171,22 +122,33 @@ $result=mysql_query($sql1); echo "
".$lang_label["no_modules"]."
"; } -// Combined alerts +// ========================== +// Combined alerts view +// ========================== echo "

".lang_string("combined alerts")."

"; $sql1='SELECT * FROM talerta_agente_modulo WHERE id_agent = '.$id_agente; $result=mysql_query($sql1); if ($row=mysql_num_rows($result)){ - $color=1; - $string=''; + $color = 1; + $string = ''; while ($row=mysql_fetch_array($result)){ // All modules of this agent + // Show data for this combined alert + $string = ""; + $string .= lang_string("Combined")." #".$row["id_aam"]; + $string .= show_alert_row_edit ($row, "datos3", 0, 1); + $string .= ''; // action + if (give_acl($id_user, $id_grupo, "LW")==1){ + $string .= " ".$lang_label["delete"]."   "; + $string .= " + ".$lang_label["update"].""; + } $id_aam = $row["id_aam"]; - - $sql2 = "SELECT * FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam"; $result2=mysql_query($sql2); - while ($row2=mysql_fetch_array($result2)){ // All modules of this agent + while ($row2=mysql_fetch_array($result2)){ + // Show data for each component of this combined alert if ($color == 1){ $tdcolor="datos"; $color =0; @@ -195,61 +157,18 @@ $result=mysql_query($sql1); $color =1; } $module = get_db_row ("tagente_modulo", "id_agente_modulo", $row2["id_agente_modulo"]); - $description = $row2["descripcion"]; $alert_mode = $row2["operation"]; $id_agente_name = get_db_value ("nombre", "tagente", "id_agente", $module["id_agente"]); - $string = $string."".$module["nombre"]."/".$id_agente_name; + $string = $string."".$id_agente_name." - ".substr($module["nombre"],0,15).""; - if ($row2["disable"] == 1){ - $string .= "".$lang_label["disabled"].""; - } else { - $string .= ""; - } - $string = $string."".$row2["operation"]; - - $string = $string."".human_time_description($module["time_threshold"]); - - $mytempdata = fmod($module["dis_min"], 1); - if ($mytempdata == 0) - $mymin = intval($module["dis_min"]); - else - $mymin = $module["dis_min"]; - $mymin = format_for_graph($mymin ); + $string .= show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1); - $mytempdata = fmod($module["dis_max"], 1); - if ($mytempdata == 0) - $mymax = intval($module["dis_max"]); - else - $mymax = $module["dis_max"]; - $mymax = format_for_graph($mymax ); - - // We have alert text ? - if ($module["alert_text"] != "") - $string = $string."".$lang_label["text"].""; - else { - $string = $string."".$mymin.""; - $string = $string."".$mymax.""; - } - $time_from_table =$$module["time_from"]; - $time_to_table =$module["time_to"]; - $string = $string.""; - if ($time_to_table == $time_from_table) - $string .= $lang_label["N/A"]; - else - $string .= substr($time_from_table,0,5)." - ".substr($time_to_table,0,5); - - $string = $string."".salida_limpia ($module["descripcion"]); $string = $string.""; $id_grupo = dame_id_grupo($id_agente); if (give_acl($id_user, $id_grupo, "LW")==1){ - $string = $string." - ".$lang_label["delete"]."   "; - $string = $string." + $string = $string." ".$lang_label["delete"]."   "; + $string = $string." ".$lang_label["update"].""; } $string = $string.""; @@ -259,12 +178,13 @@ $result=mysql_query($sql1); echo " - + + "; echo $string; echo "
".$lang_label["name"]." ".$lang_label["type"]."".$lang_label["alert"]."".lang_string ("Oper")." ".$lang_label["threshold"]." ".$lang_label["min."]." ".$lang_label["max."]." ".$lang_label["time"]." ".$lang_label["description"]."".lang_string ("info")." ".$lang_label["action"]."
"; diff --git a/pandora_console/godmode/agentes/alert_manager_editor.php b/pandora_console/godmode/agentes/alert_manager_editor.php index 054a5eb4bb..023b9202b7 100644 --- a/pandora_console/godmode/agentes/alert_manager_editor.php +++ b/pandora_console/godmode/agentes/alert_manager_editor.php @@ -1,11 +1,32 @@ -

+".$lang_label["alert_asociation_form"].""; -'; + +if ($form_alerttype == "combined") + echo ""; +else + echo ""; + if (! isset($update_alert)) $update_alert = -1; @@ -15,187 +36,16 @@ if ($update_alert != 1) { echo ''; echo ''; } -?> - - +echo ''; - - -
- -"; - - echo ""; - echo $lang_label["alert_status"]; - echo ""; - echo '"; - -// Trigger values for alert +// AgentModule association +echo '
'.lang_string("assigned_module"); +echo ''; if ($form_alerttype != "combined"){ - echo '
'.$lang_label["min_value"]; - echo " ";echo $lang_label["min_valid_value_help"].""; - echo ''; - - echo ""; - echo $lang_label["max_value"]; - echo " "; - echo $lang_label["max_valid_value_help"]; - echo ""; - echo ""; - echo ""; - - // - - echo '
'.$lang_label["alert_text"]." Regular Expression Supported "; - echo ''; -} - -echo '
'.$lang_label["description"]; -echo ''; - -?> - -
- - -Macros:
-_agent_
-_timestamp_
-_data_
-
- - -
- - -Macros:
-_agent_
-_timestamp_
-_data_
-
- -
- - -Macros:
-_agent_
-_timestamp_
-_data_
-
- -
".$lang_label["time_from"]; - echo ""; - - echo "".$lang_label["time_to"]; - echo ""; - - ?> - -
-   - - - '; - - echo ''; - echo $lang_label["other"]; - echo ''; - echo ''; - - // Max / Min alerts - echo "
".$lang_label["min_alerts"]; - echo ''; - echo ''; - - - echo ''; - echo $lang_label["max_alerts"]; - echo ''; - echo ''; -} - - -if ($form_alerttype != "combined"){ - echo '
'.lang_string("assigned_module"); - echo ''; if ($update_alert != 1) { - echo ' '; $sql2 = "SELECT id_agente_modulo, id_tipo_modulo, nombre FROM tagente_modulo WHERE id_agente = $id_agente ORDER BY nombre"; $result2=mysql_query($sql2); while ($row2=mysql_fetch_array($result2)){ @@ -211,9 +61,225 @@ if ($form_alerttype != "combined"){ echo ""; } else { $agentmodule_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $alerta_id_agentemodulo); +echo "DEBUG $alerta_id_agentemodulo"; echo $agentmodule_name; } +} else { + echo lang_string ("N/A"); } +echo ''; +echo lang_string ("Priority"); +echo '
'; +echo $lang_label["alert_type"]; +echo '"; + +// Alert disable / enable +echo ""; +echo $lang_label["alert_status"]; +echo ""; +echo '"; + +// Descripcion +echo '
'.$lang_label["description"]; +echo ''; + +// Trigger values for alert +if ($form_alerttype != "combined"){ + echo '
'.$lang_label["min_value"]; + echo " ";echo $lang_label["min_valid_value_help"].""; + echo ''; + + echo ""; + echo $lang_label["max_value"]; + echo " "; + echo $lang_label["max_valid_value_help"]; + echo ""; + echo ""; + echo ""; + + // + + echo '
'.$lang_label["alert_text"]." NOTE: This field is for matching text on data. Regular Expression Supported "; + echo ''; +} + +// Time Threshold (TT) +echo '
'.$lang_label["time_threshold"]; +echo " ".$lang_label["alert_time_threshold_help"].""; +echo ''; +echo ''; + +// Other TT +echo ''; +echo $lang_label["other"]; +echo ''; +echo ''; + +// Max / Min alerts +echo "
".$lang_label["min_alerts"]; +echo ''; +echo ''; + +echo ''; +echo $lang_label["max_alerts"]; +echo ''; +echo ''; + +// Field1 +echo '
'.lang_string ("field1"); +echo ''; +echo "Macros:
_agent_
"; +echo '_timestamp_
_data_
'; + +// Field2 +echo '
'.$lang_label["field2"]; +echo ''; +echo ''; +echo ""; +echo 'Macros:
_agent_
_timestamp_
_data_
'; + +//Field3 +echo '
'.lang_string ("field3"); +echo ''; +echo 'Macros:
_agent_
'; +echo '_timestamp_
_data_
'; + +// Time for alerting +echo "
".$lang_label["time_from"]; +echo ""; + +echo "".$lang_label["time_to"]; +echo ""; + +// Days of week +echo "
".lang_string ("Days of week"); +echo ""; +echo lang_string("Mon"); +echo form_render_check ("alert_d1", $alert_d1); +echo "  "; +echo lang_string("Tue"); +echo form_render_check ("alert_d2", $alert_d2); +echo "  "; +echo lang_string("Wed"); +echo form_render_check ("alert_d3", $alert_d3); +echo "  "; +echo lang_string("Thu"); +echo form_render_check ("alert_d4", $alert_d4); +echo "  "; +echo lang_string("Fri"); +echo form_render_check ("alert_d5", $alert_d5); +echo "  "; +echo lang_string("Sat"); +echo form_render_check ("alert_d6", $alert_d6); +echo "  "; +echo lang_string("Sun"); +echo form_render_check ("alert_d7", $alert_d7); + + + +// Field2 Recovery +echo '
'.lang_string ("Field #2 (Rec)"); +echo ''; +echo ''; + +// Alert recovery disable / enable +echo ""; +echo lang_string ("Alert recovery"); +echo ""; +echo '"; + + +//Field3 - Recovery +echo '
'.lang_string ("Field #3 (Rec)"); +echo ''; +echo ''; // End block only if $creacion_agente != 1; @@ -228,19 +294,101 @@ echo '
'; echo ''; echo '
'; -if ($form_alerttype == "combined"){ + +if (($form_alerttype == "combined") AND ($update_alert != -1)){ echo "

".lang_string ("Combined alert components")."

"; + echo ''; + echo ''; + + if ($form_alerttype == "combined") + echo ""; + else + echo ""; + + echo ''; + echo ''; + + echo "
"; + echo lang_string ("Source Agent/Alert"); + echo ""; + echo ""; + echo ""; + echo lang_string ("Operation"); + echo ""; + echo ""; + echo ""; + echo ''; + echo ""; + echo "
"; + echo ''; - echo ''; echo ' + + + + + + + + "; + + $id_aam = $alerta_id_aam; + $sql2 = "SELECT * FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam"; + $result2=mysql_query($sql2); + $string = ""; + $color = 1; + + while ($row2=mysql_fetch_array($result2)){ + // Show data for each component of this combined alert + if ($color == 1){ + $tdcolor="datos"; + $color =0; + } else { + $tdcolor="datos2"; + $color =1; + } + $module = get_db_row ("tagente_modulo", "id_agente_modulo", $row2["id_agente_modulo"]); + $description = $row2["descripcion"]; + $alert_mode = $row2["operation"]; + $id_agente_name = get_db_value ("nombre", "tagente", "id_agente", $module["id_agente"]); + + echo ""; + echo ""; + } echo "
'.lang_string ("operation"); + echo '
'.lang_string ("agent"); echo ''.lang_string ("module"); - echo ''.lang_string ("max_value"); - echo ''.lang_string ("min_value"); - echo ''.lang_string ("tt"); - echo ''.lang_string ("min_alerts"); - echo ''.lang_string ("max_alerts"); - echo ''.lang_string ("delete"); - echo "
"; + echo "".$lang_label["type"]."".lang_string ("Oper")."".$lang_label["threshold"]."".$lang_label["min."]."".$lang_label["max."]."".$lang_label["time"]."".$lang_label["description"]."".lang_string ("info")."".$lang_label["action"]."
".$id_agente_name; + echo "".$module["nombre"]; + echo show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1); + echo ""; + $id_grupo = dame_id_grupo($id_agente); + if (give_acl($id_user, $id_grupo, "LW")==1){ + echo " ".$lang_label["delete"]."   "; + echo " + ".$lang_label["update"].""; + } + echo "
"; } diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 7afb1c9b0e..efcc391df1 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -35,7 +35,7 @@ else { // Get passed variables $tab = get_parameter_get("tab","main"); $form_moduletype = get_parameter_post ("form_moduletype"); -$form_alerttype = get_parameter_post ("form_alerttype"); +$form_alerttype = get_parameter ("form_alerttype"); // Init vars $descripcion = ""; @@ -82,6 +82,18 @@ $create_agent = 0; $alert_text = ""; $time_from= ""; $time_to = ""; +$alerta_campo2_rec = ""; +$alerta_campo3_rec = ""; +$alert_id_agent = ""; +$alert_d1 = "1"; +$alert_d2 = "1"; +$alert_d3 = "1"; +$alert_d4 = "1"; +$alert_d5 = "1"; +$alert_d6 = "1"; +$alert_d7 = "1"; +$alert_recovery = "0"; +$alert_priority = "0"; // ================================ // Create AGENT @@ -232,31 +244,60 @@ if (isset($_GET["delete_alert"])){ // if modified some parameter } +// Delete Alert component (from a combined) +// ========================================== +if (isset($_GET["delete_alert_comp"])){ // if modified some parameter + $id_borrar_modulo = $_GET["delete_alert_comp"]; + // get info about agent + $sql1='DELETE FROM tcompound_alert WHERE id_aam = '.$id_borrar_modulo; + $result=mysql_query($sql1); + if (! $result) + echo "

".$lang_label["delete_alert_no"]."

"; + else + echo "

".$lang_label["delete_alert_ok"]."

"; +} + // Create alert // ============= if (isset($_POST["insert_alert"])){ // if created alert - //$id_agente = $_POST["id_agente"]; - $id_agente_modulo = entrada_limpia($_POST["agente_modulo"]); - $descripcion= entrada_limpia($_POST["descripcion"]); - $campo_1 = entrada_limpia($_POST["campo_1"]); - $campo_2 = entrada_limpia($_POST["campo_2"]); - $campo_3 = entrada_limpia($_POST["campo_3"]); - $maximo = entrada_limpia($_POST["maximo"]); - $minimo = entrada_limpia($_POST["minimo"]); - $tipo_alerta = entrada_limpia($_POST["tipo_alerta"]); - $alert_text = entrada_limpia($_POST["alert_text"]); - $time_threshold = entrada_limpia($_POST["time_threshold"]); - $max_alerts = entrada_limpia($_POST["max_alerts"]); - $min_alerts = entrada_limpia($_POST["min_alerts"]); - $time_from = entrada_limpia($_POST["time_from"]); - $time_to= entrada_limpia($_POST["time_to"]); - $other = entrada_limpia($_POST["other"]); - $disable_alert = entrada_limpia($_POST["disable_alert"]); + + $id_agente_modulo = get_parameter ("agente_modulo",0); + $maximo = get_parameter ("maximo",0); + $minimo = get_parameter ("minimo",0); + $descripcion= get_parameter ('descripcion', ''); + $campo_1 = get_parameter ('campo_1', ''); + $campo_2 = get_parameter ('campo_2', ''); + $campo_3 = get_parameter ('campo_3', ''); + $tipo_alerta = get_parameter ("tipo_alerta",3); + $alert_text = get_parameter ("alert_text",''); + $time_threshold = get_parameter ("time_threshold",900); + $max_alerts = get_parameter ("max_alerts",1); + $min_alerts = get_parameter ("min_alerts",0); + $time_from = get_parameter ("time_from"); + $time_to= get_parameter ("time_to"); + $other = get_parameter ("other",0); + $disable_alert = get_parameter ("disable_alert"); + $alert_d1 = get_parameter("alert_d1",0); + $alert_d2 = get_parameter("alert_d2",0); + $alert_d3 = get_parameter("alert_d3",0); + $alert_d4 = get_parameter("alert_d4",0); + $alert_d5 = get_parameter("alert_d5",0); + $alert_d6 = get_parameter("alert_d6",0); + $alert_d7 = get_parameter("alert_d7",0); + $alert_recovery = get_parameter("alert_recovery", 1); + $alert_priority = get_parameter("alert_priority", 0); + $campo2_rec = get_parameter ("campo_2_rec",""); + $campo3_rec = get_parameter ("campo_3_rec",""); + + if ((isset($combined)) AND ($combined == 1)) + $alert_id_agent = $id_agente; + else + $alert_id_agent = 0; if ($time_threshold == -1) { $time_threshold = $other; } $sql_insert="INSERT INTO talerta_agente_modulo - (id_agente_modulo,id_alerta,al_campo1,al_campo2,al_campo3,descripcion,dis_max,dis_min,time_threshold,max_alerts, min_alerts, alert_text, disable, time_from, time_to) VALUES + (id_agente_modulo,id_alerta,al_campo1,al_campo2,al_campo3,descripcion,dis_max,dis_min,time_threshold,max_alerts, min_alerts, alert_text, disable, time_from, time_to, id_agent, monday, tuesday, wednesday, thursday, friday, saturday, sunday, recovery_notify, priority, al_f2_recovery, al_f3_recovery) VALUES ('$id_agente_modulo', '$tipo_alerta', '$campo_1', @@ -271,7 +312,19 @@ if (isset($_POST["insert_alert"])){ // if created alert '$alert_text', '$disable_alert', '$time_from', - '$time_to' )"; + '$time_to', + $alert_id_agent, + $alert_d1, + $alert_d2, + $alert_d3, + $alert_d4, + $alert_d5, + $alert_d6, + $alert_d7, + $alert_recovery, + $alert_priority, + '$campo2_rec', + '$campo2_rec' )"; $result=mysql_query($sql_insert); if (! $result) { echo "

".$lang_label["create_alert_no"]."

"; @@ -281,28 +334,66 @@ if (isset($_POST["insert_alert"])){ // if created alert } } + +// Combined ALERT - Add component +// ================================ +if (isset($_POST["add_alert_combined"])){ // Update an existing alert + $alerta_id_aam = get_parameter ("update_alert",-1); + $component_item = get_parameter ("component_item",-1); + $component_operation = get_parameter ("component_operation","AND"); + $sql_insert = "INSERT INTO tcompound_alert (id, id_aam, operation) + VALUES ($alerta_id_aam, $component_item, '$component_operation')"; + $result=mysql_query($sql_insert); + if (! $result) { + echo "

".lang_string ("Problem adding component alert")."

"; + } else { + echo "

".lang_string ("Alert component added ok")."

"; + } + +} + // Update ALERT // ============= if (isset($_POST["update_alert"])){ // Update an existing alert - $id_aam = entrada_limpia($_POST["id_aam"]); - $tipo_alerta = entrada_limpia($_POST["tipo_alerta"]); - if (isset($_POST["agente_modulo"])) { - $id_agente_modulo = entrada_limpia($_POST["agente_modulo"]); - } - $descripcion= entrada_limpia($_POST["descripcion"]); - $campo_1 = entrada_limpia($_POST["campo_1"]); - $campo_2 = entrada_limpia($_POST["campo_2"]); - $campo_3 = entrada_limpia($_POST["campo_3"]); - $maximo = entrada_limpia($_POST["maximo"]); - $minimo = entrada_limpia($_POST["minimo"]); - $time_threshold = entrada_limpia($_POST["time_threshold"]); - $max_alerts = entrada_limpia($_POST["max_alerts"]); - $min_alerts = entrada_limpia($_POST["min_alerts"]); - $other = entrada_limpia($_POST["other"]); - $alert_text = entrada_limpia($_POST["alert_text"]); - $time_from = entrada_limpia($_POST["time_from"]); - $time_to= entrada_limpia($_POST["time_to"]); - $disable_alert = entrada_limpia($_POST["disable_alert"]); + $id_agente_modulo = get_parameter ("agente_modulo",0); + $id_aam = get_parameter ("id_aam",0); + $maximo = get_parameter ("maximo",0); + $minimo = get_parameter ("minimo",0); + $descripcion= get_parameter ('descripcion', ''); + $campo_1 = get_parameter ('campo_1', ''); + $campo_2 = get_parameter ('campo_2', ''); + $campo_3 = get_parameter ('campo_3', ''); + $tipo_alerta = get_parameter ("tipo_alerta",3); + $alert_text = get_parameter ("alert_text",''); + $time_threshold = get_parameter ("time_threshold",900); + $max_alerts = get_parameter ("max_alerts",1); + $min_alerts = get_parameter ("min_alerts",0); + $time_from = get_parameter ("time_from"); + $time_to= get_parameter ("time_to"); + $other = get_parameter ("other",0); + $disable_alert = get_parameter ("disable_alert"); + $alert_d1 = get_parameter("alert_d1",0); + $alert_d2 = get_parameter("alert_d2",0); + $alert_d3 = get_parameter("alert_d3",0); + $alert_d4 = get_parameter("alert_d4",0); + $alert_d5 = get_parameter("alert_d5",0); + $alert_d6 = get_parameter("alert_d6",0); + $alert_d7 = get_parameter("alert_d7",0); + $alert_recovery = get_parameter("alert_recovery", 1); + $alert_priority = get_parameter("alert_priority", 0); + $campo2_rec = get_parameter ("campo_2_rec",""); + $campo3_rec = get_parameter ("campo_3_rec",""); + $alert_d1 = get_parameter("alert_d1",0); + $alert_d2 = get_parameter("alert_d2",0); + $alert_d3 = get_parameter("alert_d3",0); + $alert_d4 = get_parameter("alert_d4",0); + $alert_d5 = get_parameter("alert_d5",0); + $alert_d6 = get_parameter("alert_d6",0); + $alert_d7 = get_parameter("alert_d7",0); + $alert_recovery = get_parameter("alert_recovery", 1); + $alert_priority = get_parameter("alert_priority", 0); + $campo2_rec = get_parameter ("campo_2_rec",""); + $campo3_rec = get_parameter ("campo_3_rec",""); if ($time_threshold == -1) { $time_threshold = $other; } @@ -321,7 +412,19 @@ if (isset($_POST["update_alert"])){ // Update an existing alert alert_text = '$alert_text', time_to = '$time_to', time_from = '$time_from', - disable = '$disable_alert' + disable = '$disable_alert', + monday = '$alert_d1', + tuesday = '$alert_d2', + wednesday = '$alert_d3', + thursday = '$alert_d4', + friday = '$alert_d5', + saturday = '$alert_d6', + sunday = '$alert_d7', + recovery_notify = $alert_recovery, + priority = $alert_priority, + al_f2_recovery = '$campo2_rec', + al_f3_recovery = '$campo3_rec', + id_alerta = $tipo_alerta WHERE id_aam = ".$id_aam; $result=mysql_query($sql_insert); if (! $result) { @@ -446,7 +549,9 @@ if ((isset($_GET["update_module"])) && (!isset($_POST["oid"])) && (!isset($_POST $modulo_min ="N/A"; } } -// Read alert data if editing alert +// Read ALERT data if editing alert +// ================================== + if (isset($_GET["update_alert"])){ $id_grupo = dame_id_grupo($id_agente); if (give_acl($id_user, $id_grupo, "LW")==0){ @@ -465,6 +570,8 @@ if (isset($_GET["update_alert"])){ $alerta_campo1 = $row["al_campo1"]; $alerta_campo2 = $row["al_campo2"]; $alerta_campo3 = $row["al_campo3"]; + $alerta_campo2_rec = $row["al_f2_recovery"]; + $alerta_campo3_rec = $row["al_f3_recovery"]; $alerta_dis_max = $row["dis_max"]; $alerta_dis_min = $row["dis_min"]; $tipo_alerta = $row["id_alerta"]; @@ -477,8 +584,17 @@ if (isset($_GET["update_alert"])){ $time_from = $row["time_from"]; $time_to = $row["time_to"]; $alerta_id_agentemodulo = $row["id_agente_modulo"]; // Only to show, cannot be changed - } - + $alert_id_agent = $row["id_agent"]; + $alert_d1 = $row["monday"]; + $alert_d2 = $row["tuesday"]; + $alert_d3 = $row["wednesday"]; + $alert_d4 = $row["thursday"]; + $alert_d5 = $row["friday"]; + $alert_d6 = $row["saturday"]; + $alert_d7 = $row["sunday"]; + $alert_recovery = $row["recovery_notify"]; + $alert_priority = $row["priority"]; + } } // GET DATA for MODULE UPDATE OR MODULE INSERT @@ -680,7 +796,7 @@ case "module": require "module_manager_editor.php"; break; case "alert": - if ($form_alerttype == "") + if (($form_alerttype == "") AND (!isset($_GET["update_alert"]))) require "alert_manager.php"; else require "alert_manager_editor.php"; diff --git a/pandora_console/images/mod_data.png b/pandora_console/images/mod_data.png index d0a57239e3..4cc81920e6 100644 Binary files a/pandora_console/images/mod_data.png and b/pandora_console/images/mod_data.png differ diff --git a/pandora_console/images/mod_data_inc.png b/pandora_console/images/mod_data_inc.png index 162186ac8e..d64b58ffa0 100644 Binary files a/pandora_console/images/mod_data_inc.png and b/pandora_console/images/mod_data_inc.png differ diff --git a/pandora_console/images/mod_keepalive.png b/pandora_console/images/mod_keepalive.png index 56626132fc..90b466fba7 100644 Binary files a/pandora_console/images/mod_keepalive.png and b/pandora_console/images/mod_keepalive.png differ diff --git a/pandora_console/images/mod_proc.png b/pandora_console/images/mod_proc.png index 296293ca4a..998ace35c2 100644 Binary files a/pandora_console/images/mod_proc.png and b/pandora_console/images/mod_proc.png differ diff --git a/pandora_console/images/mod_string.png b/pandora_console/images/mod_string.png index 971625a01b..dd0de728c9 100644 Binary files a/pandora_console/images/mod_string.png and b/pandora_console/images/mod_string.png differ diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 2395ff733d..9dd094fcdc 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -600,8 +600,307 @@ function get_parameter_post ( $name, $default = "" ){ return $default; } +function get_alert_priority ( $prio ){ + $priority = "NORMAL"; + switch ($prio){ + case 0: + $priority = "NORMAL"; + break; + case 1: + $priority = "WARNING"; + break; + case 2: + $priority = "MINOR"; + break; + case 3: + $priority = "MAJOR"; + break; + case 4: + $priority = "CRITICAL"; + break; + } + return $priority; +} + +function get_alert_days ( $row ){ + global $config; + global $lang_label; + $days_output = ""; + + $check = $row["monday"] + $row["tuesday"] + $row["wednesday"] + $row["thursday"]+ $row["friday"] + $row["saturday"] + $row["sunday"]; + + if ($row["monday"] != 0) + $days_output .= "Mo"; + if ($row["tuesday"] != 0) + $days_output .= "Tu"; + if ($row["wednesday"] != 0) + $days_output .= "We"; + if ($row["thursday"] != 0) + $days_output .= "Th"; + if ($row["friday"] != 0) + $days_output .= "Fr"; + if ($row["saturday"] != 0) + $days_output .= "Sa"; + if ($row["sunday"] != 0) + $days_output .= "Su"; + if ($days_output == "") + $days_output = lang_string ("none"); + if ($check == 7) + $days_output = lang_string ("all"); + return $days_output; +} + +function get_alert_times ($row2){ + global $config; + global $lang_label; + + if ($row2["time_from"]){ + $time_from_table = $row2["time_from"]; + } else { + $time_from_table = lang_string("N/A"); + } + if ($row2["time_to"]){ + $time_to_table = $row2["time_to"]; + } else { + $time_to_table = lang_string("N/A"); + } + $string = ""; + if ($time_to_table == $time_from_table) + $string .= $lang_label["N/A"]; + else + $string .= substr($time_from_table,0,5)." - ".substr($time_to_table,0,5); + return $string; +} + +function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $combined = 0){ + global $config; + global $lang_label; + + $string = ""; + if ($row2["disable"] == 1){ + $string .= "".$lang_label["disabled"].""; + } elseif ($id_tipo_modulo != 0) { + $string .= ""; + } else { + $string .= "--"; + } + + if (isset($row2["operation"])){ + $string = $string."".$row2["operation"]; + } else { + $string = $string."".get_db_sql("SELECT nombre FROM talerta WHERE id_alerta = ".$row2["id_alerta"]); + } + + $string = $string."".human_time_description($row2["time_threshold"]); + if ($row2["dis_min"]!=0){ + $mytempdata = fmod($row2["dis_min"], 1); + if ($mytempdata == 0) + $mymin = intval($row2["dis_min"]); + else + $mymin = $row2["dis_min"]; + $mymin = format_for_graph($mymin ); + } else { + $mymin = 0; + } + + if ($row2["dis_max"]!=0){ + $mytempdata = fmod($row2["dis_max"], 1); + if ($mytempdata == 0) + $mymax = intval($row2["dis_max"]); + else + $mymax = $row2["dis_max"]; + $mymax = format_for_graph($mymax ); + } else { + $mymax = 0; + } + + if (($mymin == 0) && ($mymax == 0)){ + $mymin = lang_string ("N/A"); + $mymax = $mymin; + } + + // We have alert text ? + if ($row2["alert_text"]!= "") { + $string = $string."".$lang_label["text"].""; + } else { + $string = $string."".$mymin.""; + $string = $string."".$mymax.""; + } + + // Alert times + $string = $string.""; + $string .= get_alert_times ($row2); + + // Description + $string = $string."".salida_limpia ($row2["descripcion"]); + + // Has recovery notify activated ? + if ($row2["recovery_notify"] > 0) + $recovery_notify = lang_string("Yes"); + else + $recovery_notify = lang_string("No"); + + // calculate priority + $priority = get_alert_priority ($row2["priority"]); + + // calculare firing conditions + if ($row2["alert_text"] != ""){ + $firing_cond = lang_string("text")."(".substr($row2["alert_text"],0,8).")"; + } else { + $firing_cond = $row2["min_alerts"]." / ".$row2["max_alerts"]; + } + // calculate days + $firing_days = get_alert_days ( $row2 ); + + // More details EYE tooltip + $string = $string.""; + $string.= "
"; + + // Add float info table + $string.= " + + + + + + + + + + +
". + lang_string("Recovery")."
$recovery_notify
". + lang_string("Priority")."
$priority
". + lang_string("Alert Ctrl.")."
".$firing_cond."
". + lang_string("Firing days")."
".$firing_days."
"; + return $string; +} + +function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0){ + global $config; + global $lang_label; + + if ($combined == 0){ + $module_name = get_db_sql ("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$data["id_agente_modulo"]); + $agent_name = get_db_sql ("SELECT tagente.nombre FROM tagente_modulo, tagente WHERE tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_agente_modulo = ".$data["id_agente_modulo"]); + $id_agente = get_db_sql ("SELECT id_agente FROM tagente_modulo WHERE id_agente_modulo = ".$data["id_agente_modulo"]); + } else { + $agent_name = get_db_sql ("SELECT nombre FROM tagente WHERE id_agente =".$data["id_agent"]); + $id_agente = $data["id_agent"]; + } + $alert_name = get_db_sql ("SELECT nombre FROM talerta WHERE id_alerta = ".$data["id_alerta"]); + + echo "".$alert_name.""; + if ($combined == 0){ + echo "".substr($module_name,0,21).""; + } else { + echo ""; + // More details EYE tooltip (combined) + echo " "; + echo show_alert_row_mini ($data["id_aam"]); + echo " "; + echo substr($agent_name,0,21).""; + } + + // Description + echo "".$data["descripcion"].""; + + // Extended info + echo ""; + + // Has recovery notify activated ? + if ($data["recovery_notify"] > 0) + $recovery_notify = lang_string("Yes"); + else + $recovery_notify = lang_string("No"); + + // calculate priority + $priority = get_alert_priority ($data["priority"]); + + // calculare firing conditions + if ($data["alert_text"] != ""){ + $firing_cond = lang_string("text")."(".substr($data["alert_text"],0,8).")"; + } else { + $firing_cond = $data["min_alerts"]." / ".$data["max_alerts"]; + } + // calculate days + $firing_days = get_alert_days ($data); + + // More details EYE tooltip + echo ""; + + // Add float info table + echo " + + + + + + + + + + +
". + lang_string("Recovery")."
$recovery_notify
". + lang_string("Priority")."
$priority
". + lang_string("Alert Ctrl.")."
".$firing_cond."
". + lang_string("Firing days")."
".$firing_days."
"; + + $mytempdata = fmod($data["dis_min"], 1); + if ($mytempdata == 0) + $mymin = intval($data["dis_min"]); + else + $mymin = $data["dis_min"]; + $mymin = format_for_graph($mymin ); + + $mytempdata = fmod($data["dis_max"], 1); + if ($mytempdata == 0) + $mymax = intval($data["dis_max"]); + else + $mymax = $data["dis_max"]; + $mymax = format_for_graph($mymax ); + // Text alert ? + if ($data["alert_text"] != "") + echo "".$lang_label["text"].""; + else { + echo "".$mymin.""; + echo "".$mymax.""; + } + echo "".human_time_description($data["time_threshold"]); + if ($data["last_fired"] == "0000-00-00 00:00:00") { + echo "".$lang_label["never"].""; + } + else { + echo "".human_time_comparation ($data["last_fired"]).""; + } + echo "".$data["times_fired"].""; + if ($data["times_fired"] <> 0){ + echo ""; + echo ""; + $id_grupo_alerta = get_db_value ("id_grupo", "tagente", "id_agente", $id_agente); + if (give_acl($config["id_user"], $id_grupo_alerta, "AW") == 1) { + echo ""; + echo ""; + echo ""; + } + } else + echo ""; +} + +function form_render_check ($name_form, $value_form = 1){ + echo ""; +} ?> diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index fafeadd768..3b0a951d72 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1289,4 +1289,126 @@ function lang_string ($string){ else return "[".$string."]"; } + + +function check_server_status (){ + global $config; + // This check assumes that server_keepalive should be AT LEAST 15 MIN + $sql = "SELECT COUNT(id_server) FROM tserver WHERE status = 1 AND keepalive > NOW() - INTERVAL 15 MINUTE"; + $res = get_db_sql ($sql); + // Set servers to down + if ($res == 0){ + $res2 = mysql_query("UPDATE tserver SET status = 0"); + } + return $res; +} + +function show_alert_row_mini ($id_combined_alert){ + global $config; + global $lang_label; + + $color=1; + $sql_com = "SELECT talerta_agente_modulo.*, tcompound_alert.operation FROM talerta_agente_modulo, tcompound_alert WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam AND tcompound_alert.id = ".$id_combined_alert; + $result_com = mysql_query ($sql_com); + echo ""; + echo ""; + + if ($row2["disable"] == 1){ + $tdcolor = "datos3"; + } + echo ""; + } else { + echo ""; + } + + // Alert times + echo ""; + else + echo ""; + + } + echo "
".lang_string("Name"); + echo "".lang_string("Oper"); + echo "".lang_string("Tt"); + echo "".lang_string("Firing"); + echo "".lang_string("Time"); + echo "".lang_string("Desc"); + echo "".lang_string("Recovery"); + echo "".lang_string("MinMax.Al"); + echo "".lang_string("Days"); + echo "".lang_string("Fired"); + while ($row2=mysql_fetch_array($result_com)){ + + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } + else { + $tdcolor = "datos2"; + $color = 1; + } + echo "
".get_db_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo =".$row2["id_agente_modulo"]); + echo "".$row2["operation"]; + + echo "".human_time_description($row2["time_threshold"]); + + if ($row2["dis_min"]!=0){ + $mytempdata = fmod($row2["dis_min"], 1); + if ($mytempdata == 0) + $mymin = intval($row2["dis_min"]); + else + $mymin = $row2["dis_min"]; + $mymin = format_for_graph($mymin ); + } else { + $mymin = 0; + } + + if ($row2["dis_max"]!=0){ + $mytempdata = fmod($row2["dis_max"], 1); + if ($mytempdata == 0) + $mymax = intval($row2["dis_max"]); + else + $mymax = $row2["dis_max"]; + $mymax = format_for_graph($mymax ); + } else { + $mymax = 0; + } + + if (($mymin == 0) && ($mymax == 0)){ + $mymin = lang_string ("N/A"); + $mymax = $mymin; + } + + // We have alert text ? + if ($row2["alert_text"]!= "") { + echo "".$lang_label["text"]."".$mymin."/".$mymax.""; + echo get_alert_times ($row2); + + // Description + echo "".substr($row2["descripcion"],0,20); + + // Has recovery notify activated ? + if ($row2["recovery_notify"] > 0) + $recovery_notify = lang_string("Yes"); + else + $recovery_notify = lang_string("No"); + + echo "".$recovery_notify; + + // calculare firing conditions + if ($row2["alert_text"] != ""){ + $firing_cond = lang_string("text")."(".substr($row2["alert_text"],0,8).")"; + } else { + $firing_cond = $row2["min_alerts"]." / ".$row2["max_alerts"]; + } + echo "".$firing_cond; + + // calculate days + $firing_days = get_alert_days ( $row2 ); + echo "".$firing_days; + + // Fired ? + if ($row2["times_fired"]>0) + echo "
"; +} ?> diff --git a/pandora_console/include/languages/language_en.php b/pandora_console/include/languages/language_en.php index 1bd5d2f50f..309583ef92 100644 --- a/pandora_console/include/languages/language_en.php +++ b/pandora_console/include/languages/language_en.php @@ -155,7 +155,7 @@ $lang_label["log_filter"]="Log type filter"; $lang_label["not_connected"]="You're not connected"; $lang_label["administrator"]="Administrator"; $lang_label["normal_user"]="Standard user"; -$lang_label["has_connected"]="You are connected as"; +$lang_label["has_connected"]="You are "; $lang_label["logged_out"]="Logged Out"; $lang_label["logout_msg"]="Your session is over. Please close your browser window to close session on Pandora.

"; $lang_label["user_last_activity"]="This is your last activity in Pandora FMS console"; @@ -895,6 +895,31 @@ $lang_label["post_process"]="Post process"; $lang_label["max_timeout"]="Max. timeout"; $lang_label["snmp_walk"]="SNMP walk"; +$lang_label["System ready"]="Sytem ready"; +$lang_label["System ready"]="Sytem ready"; +$lang_label["Server status: DOWN"]="Server status: DOWN"; +$lang_label["Autorefresh"]="Autorefresh"; +$lang_label["Autorefresh active"]="Autorefresh active"; + +$lang_label["Mon"]="Mon"; +$lang_label["Tue"]="Tue"; +$lang_label["Wed"]="Wed"; +$lang_label["Thu"]="Thu"; +$lang_label["Fri"]="Fri"; +$lang_label["Sat"]="Sat"; +$lang_label["Sun"]="Sun"; +$lang_label["Days of week"] = "Days of week"; +$lang_label["Alert recovery"]="Alert recovery"; +$lang_label["Priority"]="Priority"; +$lang_label["Field #2 (Rec)"]="Field #2 (Rec)"; +$lang_label["Field #3 (Rec)"]="Field #3 (Rec)"; +$lang_label["Simple alerts"]="Simple alerts"; +$lang_label["Combined alerts"]="Combined alerts"; +$lang_label["Oper"]="Oper"; +$lang_label["info"]="info"; +$lang_label["Operation"]="Operation"; +$lang_label["Source Agent/Alert"]="Source Agent/Alert"; + global $lang_label; global $help_label; diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 1d79c87324..07895429b8 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -102,6 +102,13 @@ a.white_bold { text-decoration: none; font-weight: bold; } + +a.white_grey_bold { + color: #999; + text-decoration: none; + font-weight: bold; +} + a.white { color: #eee; text-decoration: none; @@ -439,6 +446,17 @@ div.title_line { float:left; border-bottom: 1px solid #778866; } +#menu_tab_frame_view { + background: #66AA44; + width: 805px; + min-height: 22px; + padding-left: 0x; + margin-left: -25px; + float:left; + border-bottom: 1px solid #778866; +} + + #menu_tab .mn, #menu_tab ul, #menu_tab .mn ul { padding: 0px; list-style: none; @@ -601,8 +619,8 @@ span.rmess, span.nrmess { } #head_m { position: absolute; - padding-top: 7px; - padding-left: 210px; + padding-top: 6px; + padding-left: 200px; } span#logo_text1 { font: bolder 3em Arial, Sans-serif; diff --git a/pandora_console/include/styles/tip.css b/pandora_console/include/styles/tip.css index 4255d7f188..3b38fcb604 100644 --- a/pandora_console/include/styles/tip.css +++ b/pandora_console/include/styles/tip.css @@ -18,10 +18,17 @@ a.help { a.info { padding: 25px 0px 0px 0px; } + +a.info_table { + padding: 25px 0px 0px 0px; + margin: -50px 0px 0px 0px; +} + a.info2 { padding: 2px 0px 0px 0px; } -a.tip, a.tip2, a.tipp, a.help , a.info, a.info2 { + +a.tip, a.tip2, a.tipp, a.help , a.info, a.info2, a.info_table { position: relative; text-decoration: none; } @@ -38,14 +45,14 @@ a.tipp:hover { text-decoration: none; background-color: #778866; } -a.info:hover, a.info2:hover, a.help:hover { +a.info:hover, a.info2:hover, a.help:hover, a.info_table:hover { text-decoration: none; } -a.tip span, a.tip2 span, a.tipp span, a.info span, a.info2 span, a.help span { +a.tip span, a.tip2 span, a.tipp span, a.info span, a.info2 span, a.help span, a.info_table span { display: none; } a.tip:hover span, a.tip2:hover span,a.tipp:hover span, a.info:hover span, -a.info2:hover span, a.help:hover span { +a.info2:hover span, a.help:hover span, a.info_table:hover span { display: block; text-decoration: none; position: absolute; @@ -58,6 +65,16 @@ a.info2:hover span, a.help:hover span { color: #000; padding: 2px; } + +a.info_table:hover span{ + width: 1px; + height: 1px; + left: -140px; + top: 50px; + background-color: #fff; + border: 0px solid #fff; +} + a.info:hover span { top: 45px; left: 20px; diff --git a/pandora_console/operation/agentes/estado_alertas.php b/pandora_console/operation/agentes/estado_alertas.php index ad26566887..3a94ad57cd 100644 --- a/pandora_console/operation/agentes/estado_alertas.php +++ b/pandora_console/operation/agentes/estado_alertas.php @@ -1,13 +1,12 @@ ".$lang_label["ag_title"]." > ".$lang_label["alert_listing"].""; } - $query_gen='SELECT talerta_agente_modulo.alert_text, talerta_agente_modulo.id_alerta, talerta_agente_modulo.descripcion, talerta_agente_modulo.last_fired, talerta_agente_modulo.times_fired, tagente_modulo.nombre, talerta_agente_modulo.dis_max, talerta_agente_modulo.dis_min, talerta_agente_modulo.max_alerts, talerta_agente_modulo.time_threshold, talerta_agente_modulo.min_alerts, talerta_agente_modulo.id_agente_modulo, tagente_modulo.id_agente_modulo, talerta_agente_modulo.id_aam FROM tagente_modulo, talerta_agente_modulo WHERE tagente_modulo.id_agente = '.$id_agente.' AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.disable = 0 ORDER BY tagente_modulo.nombre'; + $query_gen='SELECT talerta_agente_modulo.* FROM talerta_agente_modulo, tagente_modulo WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente ='.$id_agente; $result_gen=mysql_query($query_gen); if (mysql_num_rows ($result_gen)) { @@ -66,6 +65,7 @@ if (isset($_GET["id_agente"])){ echo " ".$lang_label["type"]."".$lang_label["name"]." ".$lang_label["description"]." + ".lang_string ("info")." ".$lang_label["min."]." ".$lang_label["max."]." ".$lang_label["time_threshold"]." @@ -84,52 +84,25 @@ if (isset($_GET["id_agente"])){ $color = 1; } echo ""; - echo "".dame_nombre_alerta($data["id_alerta"]).""; - echo "".substr($data["nombre"],0,21).""; - echo "".$data["descripcion"].""; - - $mytempdata = fmod($data["dis_min"], 1); - if ($mytempdata == 0) - $mymin = intval($data["dis_min"]); - else - $mymin = $data["dis_min"]; - $mymin = format_for_graph($mymin ); - - $mytempdata = fmod($data["dis_max"], 1); - if ($mytempdata == 0) - $mymax = intval($data["dis_max"]); - else - $mymax = $data["dis_max"]; - $mymax = format_for_graph($mymax ); - // Text alert ? - if ($data["alert_text"] != "") - echo "".$lang_label["text"].""; - else { - echo "".$mymin.""; - echo "".$mymax.""; - } - echo "".human_time_description($data["time_threshold"]); - - - if ($data["last_fired"] == "0000-00-00 00:00:00") { - echo "".$lang_label["never"].""; - } - else { - echo "".human_time_comparation ($data["last_fired"]).""; - } - echo "".$data["times_fired"].""; - if ($data["times_fired"] <> 0){ - echo ""; - echo ""; - $id_grupo_alerta = get_db_value ("id_grupo", "tagente", "id_agente", $id_agente); - if (give_acl($id_user, $id_grupo_alerta, "AW") == 1) { - echo ""; - echo ""; - echo ""; - } - } else - echo ""; + show_alert_show_view ($data, $tdcolor, 0); } + + echo "
".lang_string("Combined alerts")."
"; + // Show combined alerts for this agent + $result_com = mysql_query("SELECT * FROM talerta_agente_modulo WHERE id_agent = $id_agente"); + while ($data_com=mysql_fetch_array($result_com)){ + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } + else { + $tdcolor = "datos2"; + $color = 1; + } + echo ""; + show_alert_show_view ($data_com, $tdcolor, 1); + } + echo ''; } else { @@ -176,8 +149,9 @@ if (isset($_GET["id_agente"])){ "; - // Show only selected groups + // Display single alerts + // ======================= if ($ag_group > 1) $sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre'; else @@ -245,35 +219,101 @@ if (isset($_GET["id_agente"])){ unset($string); } //end result } //end disabled=0 - } //end while - if (isset($string)) { - echo ""; - echo " ".$lang_label["fired"].""; - echo ""; - echo " ".$lang_label["not_fired"]; - echo ""; - echo "
"; - echo ""; - echo " - - - - - - "; - - echo $string; //built table of alerts - echo "
".$lang_label["agent"]."".$lang_label["status"]."".$lang_label["type"]."".$lang_label["description"]."".$lang_label["last_fired"]."".$lang_label["times_fired"]."
"; - } - else { - echo "
". - $lang_label["no_alert"]."
"; - } - } else { - echo "
". - $lang_label["no_agent"].$lang_label["no_agent_alert"]."
"; - } -} + } + // Display combined alerts + // ======================= + if ($ag_group > 1) + $sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre'; + else + $sql='SELECT id_agente, nombre, disabled FROM tagente ORDER BY id_grupo, nombre'; + $result=mysql_query($sql); + + if (mysql_num_rows($result)){ + $color=1; + while ($row=mysql_fetch_array($result)){ //while there are agents + if ($row["disabled"] == 0) { + $id_agente = $row['id_agente']; + $nombre_agente = strtoupper($row["nombre"]); + $query_gen='SELECT talerta_agente_modulo.id_alerta, + talerta_agente_modulo.descripcion, + talerta_agente_modulo.last_fired, + talerta_agente_modulo.times_fired, + talerta_agente_modulo.id_agent + FROM talerta_agente_modulo + WHERE talerta_agente_modulo.id_agent = '.$id_agente.' AND talerta_agente_modulo.disable = 0 '; + $result_gen=mysql_query($query_gen); + if (mysql_num_rows ($result_gen)) { + while ($data=mysql_fetch_array($result_gen)){ + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } + else { + $tdcolor = "datos2"; + $color = 1; + } + if (!isset($string)) { + $string=''; + } + $string = $string." + + ".$nombre_agente." (*)"; + $string .= ""; + if ($data["times_fired"] <> 0) + $string .= ""; + else + $string .= ""; + + $string = $string."" + .dame_nombre_alerta($data["id_alerta"]).""; + $string=$string."". + $data["descripcion"].""; + if ($data["last_fired"] == "0000-00-00 00:00:00") { + $string=$string."". + $lang_label["never"].""; + } else { + $string=$string."". + human_time_comparation($data["last_fired"]).""; + + + } + $string=$string."". + $data["times_fired"].""; + } + } + else if($ag_group>1) { + unset($string); + } //end result + } //end disabled=0 + } //end while + } // if rows.. + + if (isset($string)) { + echo ""; + echo " ".$lang_label["fired"].""; + echo ""; + echo " ".$lang_label["not_fired"]; + echo "(*) ".lang_string("Combined alert").""; + echo "
"; + echo ""; + echo " + + + + + + "; + + echo $string; //built table of alerts + echo "
".$lang_label["agent"]."".$lang_label["status"]."".$lang_label["type"]."".$lang_label["description"]."".$lang_label["last_fired"]."".$lang_label["times_fired"]."
"; + } + else { + echo "
". + $lang_label["no_alert"]."
"; + } +} // Main alert view ?> diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index aa5dfd9fc3..b10fe7f30d 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -29,7 +29,8 @@ if (comprueba_login() == 0) { if (mysql_num_rows ($result_t)) { echo "

".$lang_label["monitor_listing"]."

"; echo ""; - echo " + echo ""; + echo " @@ -67,8 +68,19 @@ if (comprueba_login() == 0) { else $agent_down = 0; + + + echo ""; echo "
".$lang_label["type"]."
X".$lang_label["type"]." ".$lang_label["module_name"]." ".$lang_label["description"]." ".$lang_label["status"]."
"; - + + if (($row_t["id_modulo"] != 1) AND ($row_t["id_tipo_modulo"] < 100)) { + if ($row_t["flag"] == 0){ + echo ""; + } else { + echo ""; + } + } + echo ""; echo ""; echo "".$est_modulo."" diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index fc96866fd9..f83185367e 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -78,23 +78,11 @@ if (comprueba_login() == 0) { $id_grupo = $row_t["id_grupo"]; $id_usuario=$_SESSION["id_usuario"]; if (give_acl($id_usuario, $id_grupo, "AW")==1){ - if ($row3["id_tipo_modulo"] > 4 AND ($row3["id_tipo_modulo"] < 100)){ + if (($row3["id_modulo"] != 1) AND ($row3["id_tipo_modulo"] < 100)) { if ($row3["flag"] == 0){ - echo " - "; + echo ""; } else { - echo " - "; + echo ""; } } } diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index fb55d64516..f49401e0b8 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1,19 +1,12 @@ -// Additions to Pandora FMS 1.2 graph code and new XML reporting template management -// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es -// +// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +// Please see http://pandora.sourceforge.net for full contribution list + // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 +// as published by the Free Software Foundation for version 2. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -21,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + // Load global vars require("include/config.php"); @@ -56,7 +50,7 @@ if (comprueba_login() == 0) { } } if (give_acl($id_usuario,$id_grupo, "AR") == 1){ - + echo "