From 7e250517126ed383d516d02fb1a117e9d1edd2a7 Mon Sep 17 00:00:00 2001 From: slerena Date: Sun, 10 Jun 2007 13:19:27 +0000 Subject: [PATCH] 2007-06-09 Sancho Lerena * include/functions.php: Solved decimals problem in format_numeric() function * operation/agentes/tactical.php: General indicator formula improvement. * general/logon_ok.php: Tactical ODO graph update (the same that above). * godmode/agentes/manage_config.php: Select list too small, bad render fixed. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@502 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 ++++++++++ pandora_console/general/logon_ok.php | 6 +++--- .../godmode/agentes/manage_config.php | 4 ++-- pandora_console/include/functions.php | 16 ++++++++++++---- pandora_console/operation/agentes/tactical.php | 8 +++----- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0e47e4d0fa..57c147c5c1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2007-06-09 Sancho Lerena + + * include/functions.php: Solved decimals problem in format_numeric() function + + * operation/agentes/tactical.php: General indicator formula improvement. + + * general/logon_ok.php: Tactical ODO graph update (the same that above). + + * godmode/agentes/manage_config.php: Select list too small, bad render fixed. + 2007-06-08 Sancho Lerena * include/languages/language_en.php: New strings diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index adb3cdd078..40a4889be6 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -78,9 +78,9 @@ $total_alerts = $data_alert_total + $monitor_alert_total; $total_checks = $data_checks + $monitor_checks; - $monitor_health = format_numeric (($monitor_ok / $monitor_checks) * 100,1); + $monitor_health = format_numeric ((($monitor_ok - $monitor_alert - $monitor_unknown) / $monitor_checks) * 100,1); $data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);; - $global_health = format_numeric( ((($monitor_ok)+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1); + $global_health = format_numeric( ((($monitor_ok - $monitor_alert - $monitor_unknown)+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1); echo "

".$lang_label["tactical_indicator"]."

"; echo ""; @@ -156,4 +156,4 @@ echo ""; // activity echo ''; // class "jus" -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/agentes/manage_config.php b/pandora_console/godmode/agentes/manage_config.php index fdab0c9a67..e00f12a9bc 100644 --- a/pandora_console/godmode/agentes/manage_config.php +++ b/pandora_console/godmode/agentes/manage_config.php @@ -273,7 +273,7 @@ if (comprueba_login() == 0) } echo '  

'; echo "".$lang_label["modules"]."

"; - echo ""; if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) { // Populate Module/Agent combo $agente_modulo = $_POST["origen"]; @@ -317,4 +317,4 @@ if (comprueba_login() == 0) audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Config Management Admin section"); require ("general/noaccess.php"); } -?> \ No newline at end of file +?> diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 22aedabb5e..47b53a3598 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -369,6 +369,7 @@ function pagination ($count, $url, $offset ) { } } + // --------------------------------------------------------------- // Render data in a fashion way :-) // --------------------------------------------------------------- @@ -376,7 +377,7 @@ function format_numeric ( $number, $decimals=2, $dec_point=".", $thousands_sep=" if ($number == 0) return 0; // If has decimals - if (fmod($number , 1)> 0) + if (fmod($number , 1) > 0) return number_format ($number, $decimals, $dec_point, $thousands_sep); else return number_format ($number, 0, $dec_point, $thousands_sep); @@ -387,11 +388,18 @@ function format_numeric ( $number, $decimals=2, $dec_point=".", $thousands_sep=" // --------------------------------------------------------------- function format_for_graph ( $number , $decimals=2, $dec_point=".", $thousands_sep=",") { if ($number > "1000000") - return number_format ($number/1000000, $decimals, $dec_point, $thousands_sep)." M"; + if (fmod ($number, 1000000) > 0) + return number_format ($number/1000000, $decimals, $dec_point, $thousands_sep)." M"; + else + return number_format ($number/1000000, 0, $dec_point, $thousands_sep)." M"; + if ($number > "1000") - return number_format ($number/1000, $decimals, $dec_point, $thousands_sep )." K"; + if (fmod ($number, 1000) > 0) + return number_format ($number/1000, $decimals, $dec_point, $thousands_sep )." K"; + else + return number_format ($number/1000, 0, $dec_point, $thousands_sep )." K"; // If has decimals - if (fmod($number , 1)> 0) + if (fmod ($number , 1)> 0) return number_format ($number, $decimals, $dec_point, $thousands_sep); else return number_format ($number, 0, $dec_point, $thousands_sep); diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index f98af74515..36b1de630d 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -6,10 +6,8 @@ // Main PHP/SQL code development and project architecture and management // Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com // CSS and some PHP additions -// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com -// Javascript Active Console code. // Copyright (c) 2006 Jose Navarro -// Additions to Pandora FMS 1.2 graph code and new XML reporting template management +// Additions to Pandora FMS 1.2 graph code // Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es // // This program is free software; you can redistribute it and/or @@ -219,9 +217,9 @@ // Odometer Graph // ~~~~~~~~~~~~~~~ - $monitor_health = format_numeric (($monitor_ok / $monitor_checks) * 100,1); + $monitor_health = format_numeric ((($monitor_ok - $monitor_alert - $monitor_unknown)/ $monitor_checks) * 100,1); $data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);; - $global_health = format_numeric( ((($monitor_ok)+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1); + $global_health = format_numeric( ((($monitor_ok -$monitor_alert - $monitor_unknown )+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1); echo "

".$lang_label["tactical_indicator"]."

"; echo "";