From f694d14d12707bc21f0855f19769e6e6317f9b1b Mon Sep 17 00:00:00 2001 From: slerena Date: Tue, 12 Jun 2007 11:57:03 +0000 Subject: [PATCH] 2007-06-12 Sancho Lerena * include/languages/language_en.php: New text * include/functions.php: Now all functions to render timeframes are using lang_label variable, some small adjustements and fixes. * operation/agentes/status_monitor.php, operation/agentes/estado_alertas.php, operation/agentes/estado_ultimopaquete.php: A lot of many small fixes and improvements on render output for all timestamp fields. * operation/agentes/exportdata.php: Now predefine last 24 hours. Fixed a bad combo (too small). * operation/agentes/estado_monitores.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php reporting/stat_win.php general/logon_ok.php godmode/agentes/alert_manager.php godmode/reporting/reporting_builder.php godmode/reporting/graph_builder.php: A lot of many small fixes and improvements on render output for all timestamp fields and in MIN/MAX, small icons for module types, and things like that. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@504 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 37 +++++++- pandora_console/general/logon_ok.php | 2 +- .../godmode/agentes/alert_manager.php | 29 ++++--- .../godmode/reporting/graph_builder.php | 6 ++ .../godmode/reporting/reporting_builder.php | 7 ++ pandora_console/include/functions.php | 84 +++++++++++-------- .../include/languages/language_en.php | 16 +++- .../operation/agentes/estado_alertas.php | 59 +++++++------ .../operation/agentes/estado_monitores.php | 11 ++- .../agentes/estado_ultimopaquete.php | 6 +- .../operation/agentes/exportdata.php | 10 ++- .../operation/agentes/status_monitor.php | 30 ++++--- .../operation/reporting/graph_viewer.php | 49 ++++++++--- .../operation/reporting/reporting_viewer.php | 10 ++- pandora_console/reporting/stat_win.php | 49 ++++++----- 15 files changed, 268 insertions(+), 137 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 57c147c5c1..039bb73e5f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,12 +1,41 @@ +2007-06-12 Sancho Lerena + + * include/languages/language_en.php: New text + + * include/functions.php: Now all functions to render timeframes + are using lang_label variable, some small adjustements and fixes. + + * operation/agentes/status_monitor.php, + operation/agentes/estado_alertas.php, + operation/agentes/estado_ultimopaquete.php: A lot of many small + fixes and improvements on render output for all timestamp fields. + + * operation/agentes/exportdata.php: Now predefine last 24 + hours. Fixed a bad combo (too small). + + * operation/agentes/estado_monitores.php + operation/reporting/reporting_viewer.php + operation/reporting/graph_viewer.php reporting/stat_win.php + general/logon_ok.php godmode/agentes/alert_manager.php + godmode/reporting/reporting_builder.php + godmode/reporting/graph_builder.php: A lot of many small fixes and + improvements on render output for all timestamp fields and in + MIN/MAX, small icons for module types, and things like that. + + 2007-06-09 Sancho Lerena - * include/functions.php: Solved decimals problem in format_numeric() function + * include/functions.php: Solved decimals problem in + format_numeric() function - * operation/agentes/tactical.php: General indicator formula improvement. + * operation/agentes/tactical.php: General indicator formula + improvement. - * general/logon_ok.php: Tactical ODO graph update (the same that above). + * general/logon_ok.php: Tactical ODO graph update (the same that + above). - * godmode/agentes/manage_config.php: Select list too small, bad render fixed. + * godmode/agentes/manage_config.php: Select list too small, bad + render fixed. 2007-06-08 Sancho Lerena diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 40a4889be6..6d7c2e9913 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -53,7 +53,7 @@ while ($row = mysql_fetch_array ($result_news)) { echo ''; echo "".$row["subject"].""; - echo "".$lang_label["by"]."".$row["author"]. " ".$lang_label["at"]." ".$row["timestamp"].""; + echo "".$lang_label["by"]." ".$row["author"]. " ".$lang_label["at"]." ".$row["timestamp"].""; echo ''; echo clean_output_breaks($row["text"]); } diff --git a/pandora_console/godmode/agentes/alert_manager.php b/pandora_console/godmode/agentes/alert_manager.php index f3cce85a1e..d4a2347d13 100644 --- a/pandora_console/godmode/agentes/alert_manager.php +++ b/pandora_console/godmode/agentes/alert_manager.php @@ -39,10 +39,7 @@ $result=mysql_query($sql1); $string=''; while ($row=mysql_fetch_array($result)){ // All modules of this agent $id_tipo = $row["id_tipo_modulo"]; - $nombre_modulo =$row["nombre"]; - $sql2='SELECT * FROM ttipo_modulo WHERE id_tipo = "'.$id_tipo.'"'; - $result2=mysql_query($sql2); - $row2=mysql_fetch_array($result2); + $nombre_modulo = substr($row["nombre"],0,21); //module type modulo is $row2["nombre"]; $sql3='SELECT * @@ -62,11 +59,15 @@ $result=mysql_query($sql1); $result4=mysql_query($sql4); $row4=mysql_fetch_array($result4); // Alert name defined by $row4["nombre"]; - $tipo_modulo = $row2["nombre"]; $nombre_alerta = $row4["nombre"]; - $string = $string."".$nombre_modulo."/".$tipo_modulo; + $string = $string."".$nombre_modulo; + + if ($id_tipo > 0) { + $string .= ""; + } + $string = $string."".$nombre_alerta; - $string = $string."".$row3["time_threshold"]; + $string = $string."".human_time_description($row3["time_threshold"]); $mytempdata = fmod($row3["dis_min"], 1); if ($mytempdata == 0) @@ -83,9 +84,11 @@ $result=mysql_query($sql1); $mymax = format_for_graph($mymax ); // We have alert text ? if ($row3["alert_text"] != "") - $string = $string."".$lang_label["text"]; - else - $string = $string."".$mymin." / ".$mymax; + $string = $string."".$lang_label["text"]; + else { + $string = $string."".$mymin; + $string = $string."".$mymax; + } $string = $string."".salida_limpia($row3["descripcion"]); $string = $string.""; $id_grupo = dame_id_grupo($id_agente); @@ -104,10 +107,12 @@ $result=mysql_query($sql1); } if (isset($string) & $string!='') { echo " - + + - + + "; echo $string; diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 7868493759..098bac120e 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -37,6 +37,12 @@ if (comprueba_login() != 0) { exit; } +if ((give_acl($id_user,0,"AW") != 1 ) AND (dame_admin($id_user)!=1)) { + audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder"); + include ("general/noaccess.php"); + exit; +} + if (isset($_GET["store_graph"])){ $name = entrada_limpia($_POST["name"]); $description = entrada_limpia($_POST["description"]); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 0564d0f9da..b7d7bd63a3 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -27,6 +27,13 @@ if (comprueba_login() != 0) { exit; } +if ((give_acl($id_user,0,"AW") != 1 ) AND (dame_admin($id_user)!=1)) { + audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder"); + include ("general/noaccess.php"); + exit; +} + + $form_report_name = ""; $form_report_private=0; $form_report_description = ""; diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 47b53a3598..a63d92a2c6 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -399,10 +399,10 @@ function format_for_graph ( $number , $decimals=2, $dec_point=".", $thousands_se else return number_format ($number/1000, 0, $dec_point, $thousands_sep )." K"; // If has decimals - if (fmod ($number , 1)> 0) - return number_format ($number, $decimals, $dec_point, $thousands_sep); - else - return number_format ($number, 0, $dec_point, $thousands_sep); + if (fmod ($number , 1)> 0) + return number_format ($number, $decimals, $dec_point, $thousands_sep); + else + return number_format ($number, 0, $dec_point, $thousands_sep); } function give_parameter_get ( $name, $default = "" ){ @@ -422,50 +422,62 @@ function give_parameter_post ( $name, $default = "" ){ } function human_time_comparation ( $timestamp ){ - global $config; - require ("include/languages/language_".$config["language_code"].".php"); + global $lang_label; $ahora=date("Y/m/d H:i:s"); $seconds = strtotime($ahora) - strtotime($timestamp); + + if ($seconds < 3600) + $render = format_numeric($seconds/60,1)." ".$lang_label["minutes"]; + elseif (($seconds >= 3600) and ($seconds < 86400)) + $render = format_numeric ($seconds/3600,1)." ".$lang_label["hours"]; + elseif (($seconds >= 86400) and ($seconds < 2592000)) + $render = format_numeric ($seconds/86400,1)." ".$lang_label["days"]; + elseif (($seconds >= 2592000) and ($seconds < 15552000)) + $render = format_numeric ($seconds/2592000,1)." ".$lang_label["months"]; + elseif ($seconds >= 15552000) + $render = " +6 ".$lang_label["months"]; + return $render; +} + +function human_time_description_raw ($seconds){ + global $lang_label; if ($seconds < 3600) $render = format_numeric($seconds/60,2)." ".$lang_label["minutes"]; elseif (($seconds >= 3600) and ($seconds < 86400)) $render = format_numeric ($seconds/3600,2)." ".$lang_label["hours"]; elseif ($seconds >= 86400) $render = format_numeric ($seconds/86400,2)." ".$lang_label["days"]; - return $render; + return $render; } function human_time_description ($period){ + global $lang_label; switch ($period) { - case 3600: $period_label = "Hour"; - break; - case 7200: $period_label = "2 Hours"; - break; - case 10800: $period_label = "3 Hours"; - break; - case 21600: $period_label = "6 Hours"; - break; - case 43200: $period_label = "12 Hours"; - break; - case 86400: $period_label = "Day"; - break; - case 172800: $period_label = "Two days"; - break; - case 345600: $period_label = "Four days"; - break; - case 604800: $period_label = "Last Week"; - break; - case 1296000: $period_label = "15 Days"; - break; - case 2592000: $period_label = "Last Month"; - break; - case 5184000: $period_label = "Two Month"; - break; - case 15552000: $period_label = "Six Months"; - break; - case 31104000: $period_label = "One year"; - break; - default: $period_label = "Day"; + case 3600: $period_label = $lang_label["hour"]; + break; + case 7200: $period_label = $lang_label["2_hours"]; + break; + case 21600: $period_label = $lang_label["6_hours"]; + break; + case 43200: $period_label = $lang_label["12_hours"]; + break; + case 86400: $period_label = $lang_label["last_day"]; + break; + case 172800: $period_label = $lang_label["two_days"]; + break; + case 432000: $period_label = $lang_label["five_days"]; + break; + case 604800: $period_label = $lang_label["last_week"]; + break; + case 1296000: $period_label = $lang_label["15_days"]; + break; + case 2592000: $period_label = $lang_label["last_month"]; + break; + case 5184000: $period_label = $lang_label["two_month"]; + break; + case 15552000: $period_label = $lang_label["six_months"]; + break; + default: $period_label = human_time_description_raw ($period); } return $period_label; } diff --git a/pandora_console/include/languages/language_en.php b/pandora_console/include/languages/language_en.php index 34e3c7f159..7860d6f28d 100644 --- a/pandora_console/include/languages/language_en.php +++ b/pandora_console/include/languages/language_en.php @@ -710,7 +710,7 @@ $lang_label["day"]="day"; $lang_label["week"]="week"; $lang_label["weeks"]="weeks"; $lang_label["month"]="month"; -$lang_label["months"]="monts"; +$lang_label["months"]="months"; $lang_label["hours"]="hours"; $lang_label["hour"]="hour"; $lang_label['network_profile']="Network profile"; @@ -837,6 +837,20 @@ $lang_label["create_reporting_no"]="There was a problem creating reporting"; $lang_label["delete_reporting_ok"]="Reporting successfully deleted"; $lang_label["delete_reporting_no"]="There was a problem deleting reporting"; +$lang_label["hour"]="One hour"; +$lang_label["2_hours"]="Two hours"; +$lang_label["6_hours"]="Six hours"; +$lang_label["12_hours"]="12 hours"; +$lang_label["last_day"]="One day"; +$lang_label["two_days"]="Two days"; +$lang_label["five_days"]="Five days"; +$lang_label["last_week"]="One week"; +$lang_label["15_days"]="15 days"; +$lang_label["last_month"]="One month"; +$lang_label["two_month"]="Two monts"; +$lang_label["six_months"]="Six months"; +$lang_label["min."]="Min."; +$lang_label["max."]="Max."; global $lang_label; global $help_label; ?> diff --git a/pandora_console/operation/agentes/estado_alertas.php b/pandora_console/operation/agentes/estado_alertas.php index e00954bdfd..268f2e65cb 100644 --- a/pandora_console/operation/agentes/estado_alertas.php +++ b/pandora_console/operation/agentes/estado_alertas.php @@ -58,7 +58,8 @@ if (isset($_GET["id_agente"])){ echo " - + + @@ -75,7 +76,7 @@ if (isset($_GET["id_agente"])){ } echo ""; echo ""; - echo ""; + echo ""; echo ""; $mytempdata = fmod($data["dis_min"], 1); @@ -93,17 +94,21 @@ if (isset($_GET["id_agente"])){ $mymax = format_for_graph($mymax ); // Text alert ? if ($data["alert_text"] != "") - echo ""; - else - echo ""; - echo ""; + else { + echo ""; + echo ""; + } + echo ""; + echo ""; } else { - echo ""; + echo ""; } - echo ""; + echo ""; if ($data["times_fired"] <> 0) echo ""; else @@ -193,21 +198,6 @@ if (isset($_GET["id_agente"])){ sec2=operation/agentes/ver_agente& id_agente=".$id_agente."'> ".$nombre_agente.""; - - $string = $string.""; - $string=$string.""; - if ($data["last_fired"] == "0000-00-00 00:00:00") { - $string=$string.""; - } - else { - $string=$string.""; - } - $string=$string.""; if ($data["times_fired"] <> 0) $string=$string.""; + + $string = $string.""; + $string=$string.""; + if ($data["last_fired"] == "0000-00-00 00:00:00") { + $string=$string.""; + } else { + $string=$string.""; + + + } + $string=$string.""; } } else if($ag_group>1) { @@ -234,11 +240,12 @@ if (isset($_GET["id_agente"])){ echo "
".$lang_label["name_type"]."
".$lang_label["name"]."".$lang_label["type"]." ".$lang_label["alert"]." ".$lang_label["threshold"]."".$lang_label["min_max"]."".$lang_label["min."]."".$lang_label["max."]." ".$lang_label["description"]." ".$lang_label["action"]."
".$lang_label["type"]."".$lang_label["name"]." ".$lang_label["description"]."".$lang_label["min_max"]."".$lang_label["min."]."".$lang_label["max."]." ".$lang_label["time_threshold"]." ".$lang_label["last_fired"]." ".$lang_label["times_fired"]."
".dame_nombre_alerta($data["id_alerta"])."".$data["nombre"]."".substr($data["nombre"],0,21)."".$data["descripcion"]."".$lang_label["text"]."".$mymin." / ".$mymax."".$data["time_threshold"]; + echo "".$lang_label["text"]."".$mymin."".$mymax."".human_time_comparation($data["time_threshold"]); + + if ($data["last_fired"] == "0000-00-00 00:00:00") { - echo "".$lang_label["never"]."".$lang_label["never"]."".$data["last_fired"]."".human_time_comparation ($data["last_fired"])."".$data["times_fired"]."".$data["times_fired"]."" - .dame_nombre_alerta($data["id_alerta"])."". - $data["descripcion"]."". - $lang_label["never"]."". - $data["last_fired"]."". - $data["times_fired"]." @@ -216,6 +206,22 @@ if (isset($_GET["id_agente"])){ $string=$string." " + .dame_nombre_alerta($data["id_alerta"])."". + $data["descripcion"]."". + $lang_label["never"]."". + human_time_comparation($data["last_fired"])."". + $data["times_fired"]."
"; 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"]."".$lang_label["status"]."".$lang_label["times_fired"]."
"; } diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index e4458c75ad..544e3f9e07 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -72,7 +72,7 @@ if (comprueba_login() == 0) { echo ""; echo "".$est_modulo.""; echo "" - .substr($est_description,0,32).""; + .substr($est_description,0,35).""; // echo "".$row3["datos"]; if ($agent_down == 1) echo " @@ -88,8 +88,11 @@ if (comprueba_login() == 0) { else echo " "; - echo ""; - echo $temp_interval.""; + echo ""; + if ($temp_interval != $intervalo) + echo $temp_interval.""; + else + echo "--"; echo ""; if ($agent_down == 1) { // If agent down, it's shown red and bold echo ""; @@ -100,7 +103,7 @@ if (comprueba_login() == 0) { if ($row_t["timestamp"]=='0000-00-00 00:00:00') { echo $lang_label["never"]; } else { - echo $row_t["timestamp"]; + echo human_time_comparation($row_t["timestamp"]); } echo ""; } diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index 07ee35469e..c20ced8ace 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -27,7 +27,7 @@