2008-07-17 Esteban Sanchez <estebans@artica.es>

* godmode/reporting/map_builder.php: Check background existance to
        avoid warnings.

        * include/functions.php: Added Giga magnitude in format_for_graph(),
        thansk to tono user in openideas.

        * include/functions_db.php: Check database result on
        return_status_layout(). Deleted "LIMIT 1" on get_previous_data() which
        was causing SQL failures. Style correction.

        * include/functions_reporting.php: Check database result on
        get_agent_module_sla().

        * operation/agentes/datos_agente.php: Removed useless code.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@961 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2008-07-17 12:21:17 +00:00
parent 71c8b82918
commit 401620e8fa
6 changed files with 36 additions and 13 deletions

View File

@ -1,3 +1,20 @@
2008-07-17 Esteban Sanchez <estebans@artica.es>
* godmode/reporting/map_builder.php: Check background existance to
avoid warnings.
* include/functions.php: Added Giga magnitude in format_for_graph(),
thansk to tono user in openideas.
* include/functions_db.php: Check database result on
return_status_layout(). Deleted "LIMIT 1" on get_previous_data() which
was causing SQL failures. Style correction.
* include/functions_reporting.php: Check database result on
get_agent_module_sla().
* operation/agentes/datos_agente.php: Removed useless code.
2008-07-17 Raul Mateos <raulofpandora@gmail.com> 2008-07-17 Raul Mateos <raulofpandora@gmail.com>
* operation/agentes/status_monitor.php: Closed html tags. * operation/agentes/status_monitor.php: Closed html tags.

View File

@ -94,7 +94,10 @@ if ($update_layout) {
$width = (int) get_parameter ('width'); $width = (int) get_parameter ('width');
$height = (int) get_parameter ('height'); $height = (int) get_parameter ('height');
$background = (string) get_parameter ('background'); $background = (string) get_parameter ('background');
$bg_info = getimagesize ('images/console/background/'.$background); $bg_info = array (0, 0);
if (file_exists ('images/console/background/'.$background))
$bg_info = getimagesize ('images/console/background/'.$background);
if (! $width) if (! $width)
$width = $bg_info[0]; $width = $bg_info[0];
if (! $height) if (! $height)

View File

@ -422,6 +422,11 @@ function format_numeric ($number, $decimals = 1, $dec_point = ".", $thousands_se
* @return A number rendered to be displayed gently on a graph. * @return A number rendered to be displayed gently on a graph.
*/ */
function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands_sep = ",") { function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands_sep = ",") {
if ($number > 1000000000) {
if (fmod ($number, 1000000000) > 0){
return number_format ($number / 1000000000, $decimals, $dec_point, $thousands_sep)." G";
}
}
if ($number > 1000000) { if ($number > 1000000) {
if (fmod ($number, 1000000) > 0) if (fmod ($number, 1000000) > 0)
return number_format ($number / 1000000, $decimals, $dec_point, $thousands_sep)." M"; return number_format ($number / 1000000, $decimals, $dec_point, $thousands_sep)." M";

View File

@ -21,7 +21,7 @@
*/ */
function check_login () { function check_login () {
global $config; global $config;
if (!isset($config["homedir"])){ if (! isset ($config["homedir"])) {
// No exists $config. Exit inmediatly // No exists $config. Exit inmediatly
include("general/noaccess.php"); include("general/noaccess.php");
exit; exit;
@ -32,7 +32,7 @@ function check_login () {
return 0; return 0;
} }
} }
audit_db("N/A", getenv("REMOTE_ADDR"), "No session", "Trying to access without a valid session"); audit_db ("N/A", getenv ("REMOTE_ADDR"), "No session", "Trying to access without a valid session");
include ($config["homedir"]."/general/noaccess.php"); include ($config["homedir"]."/general/noaccess.php");
exit; exit;
} }
@ -1438,6 +1438,9 @@ function return_status_layout ($id_layout = 0) {
$temp_total = 0; $temp_total = 0;
$sql = sprintf ("SELECT id_agente_modulo, parent_item, id_layout_linked FROM `tlayout_data` WHERE `id_layout` = '%d'",$id_layout); $sql = sprintf ("SELECT id_agente_modulo, parent_item, id_layout_linked FROM `tlayout_data` WHERE `id_layout` = '%d'",$id_layout);
$result = get_db_all_rows_sql ($sql); $result = get_db_all_rows_sql ($sql);
if ($result === false)
return 0;
foreach ($result as $rownum => $data) { foreach ($result as $rownum => $data) {
if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) {
$temp_status += return_status_layout ($data["id_layout_linked"]); $temp_status += return_status_layout ($data["id_layout_linked"]);
@ -1449,9 +1452,9 @@ function return_status_layout ($id_layout = 0) {
} }
if ($temp_status == $temp_total) { if ($temp_status == $temp_total) {
return 1; return 1;
} else {
return 0;
} }
return 0;
} }
/** /**
@ -1506,7 +1509,7 @@ function get_previous_data ($id_agent_module, $utimestamp) {
WHERE id_agente_modulo = %d WHERE id_agente_modulo = %d
AND utimestamp <= %d AND utimestamp <= %d
AND utimestamp > %d AND utimestamp > %d
ORDER BY utimestamp DESC LIMIT 1', ORDER BY utimestamp DESC',
$id_agent_module, $utimestamp, $utimestamp - $interval); $id_agent_module, $utimestamp, $utimestamp - $interval);
return get_db_row_sql ($sql); return get_db_row_sql ($sql);

View File

@ -53,7 +53,7 @@ function get_agent_module_sla ($id_agent_module, $period, $min_value, $max_value
array_unshift ($datas, $previous_data); array_unshift ($datas, $previous_data);
$previous_data_timestamp = $previous_data['utimestamp']; $previous_data_timestamp = $previous_data['utimestamp'];
} }
if (sizeof ($datas) == 0) { if ($datas === false) {
return false; return false;
} }

View File

@ -91,12 +91,7 @@ function datos_raw($id_agente_modulo, $periodo){
echo "<td class='".$tdcolor."' style='width:150px'>".$row["timestamp"]."</td>"; echo "<td class='".$tdcolor."' style='width:150px'>".$row["timestamp"]."</td>";
echo "<td class='".$tdcolor."'>"; echo "<td class='".$tdcolor."'>";
if (is_numeric($row["datos"])) { if (is_numeric($row["datos"])) {
$mytempdata = fmod($row["datos"], 1); echo format_for_graph ($row["datos"]);
if ($mytempdata == 0)
$myvalue = intval($row["datos"]);
else
$myvalue = $row["datos"];
echo format_for_graph($myvalue );
} else { } else {
echo salida_limpia($row["datos"]); echo salida_limpia($row["datos"]);
} }