2007-06-09 Sancho Lerena <slerena@artica.es>

* 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
This commit is contained in:
slerena 2007-06-10 13:19:27 +00:00
parent 47ce543acd
commit 7e25051712
5 changed files with 30 additions and 14 deletions

View File

@ -1,3 +1,13 @@
2007-06-09 Sancho Lerena <slerena@artica.es>
* 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 <slerena@artica.es> 2007-06-08 Sancho Lerena <slerena@artica.es>
* include/languages/language_en.php: New strings * include/languages/language_en.php: New strings

View File

@ -78,9 +78,9 @@
$total_alerts = $data_alert_total + $monitor_alert_total; $total_alerts = $data_alert_total + $monitor_alert_total;
$total_checks = $data_checks + $monitor_checks; $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);; $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 "<h3>".$lang_label["tactical_indicator"]."</h3>"; echo "<h3>".$lang_label["tactical_indicator"]."</h3>";
echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>"; echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
@ -156,4 +156,4 @@
echo "</div>"; // activity echo "</div>"; // activity
echo '</div>'; // class "jus" echo '</div>'; // class "jus"
?> ?>

View File

@ -273,7 +273,7 @@ if (comprueba_login() == 0)
} }
echo '</select>&nbsp;&nbsp;<input type=submit name="update_agent" class="sub upd" value="'.$lang_label["get_info"].'"><br><br>'; echo '</select>&nbsp;&nbsp;<input type=submit name="update_agent" class="sub upd" value="'.$lang_label["get_info"].'"><br><br>';
echo "<b>".$lang_label["modules"]."</b><br><br>"; echo "<b>".$lang_label["modules"]."</b><br><br>";
echo "<select name='origen_modulo[]' size=3 multiple=yes class='w130'>"; echo "<select name='origen_modulo[]' size=6 multiple=yes class='w130'>";
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) { if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
// Populate Module/Agent combo // Populate Module/Agent combo
$agente_modulo = $_POST["origen"]; $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"); audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Config Management Admin section");
require ("general/noaccess.php"); require ("general/noaccess.php");
} }
?> ?>

View File

@ -369,6 +369,7 @@ function pagination ($count, $url, $offset ) {
} }
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Render data in a fashion way :-) // Render data in a fashion way :-)
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -376,7 +377,7 @@ function format_numeric ( $number, $decimals=2, $dec_point=".", $thousands_sep="
if ($number == 0) if ($number == 0)
return 0; return 0;
// If has decimals // If has decimals
if (fmod($number , 1)> 0) if (fmod($number , 1) > 0)
return number_format ($number, $decimals, $dec_point, $thousands_sep); return number_format ($number, $decimals, $dec_point, $thousands_sep);
else else
return number_format ($number, 0, $dec_point, $thousands_sep); 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=",") { function format_for_graph ( $number , $decimals=2, $dec_point=".", $thousands_sep=",") {
if ($number > "1000000") 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") 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 has decimals
if (fmod($number , 1)> 0) if (fmod ($number , 1)> 0)
return number_format ($number, $decimals, $dec_point, $thousands_sep); return number_format ($number, $decimals, $dec_point, $thousands_sep);
else else
return number_format ($number, 0, $dec_point, $thousands_sep); return number_format ($number, 0, $dec_point, $thousands_sep);

View File

@ -6,10 +6,8 @@
// Main PHP/SQL code development and project architecture and management // Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com // Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP additions // 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 <contacto@indiseg.net> // Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// 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 // Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
@ -219,9 +217,9 @@
// Odometer Graph // 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);; $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 "<h3>".$lang_label["tactical_indicator"]."</h3>"; echo "<h3>".$lang_label["tactical_indicator"]."</h3>";
echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>"; echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";