From 984bc09a5a74ca6a0fce7d19a66bcbaff5a805e3 Mon Sep 17 00:00:00 2001 From: slerena Date: Wed, 30 May 2007 17:32:35 +0000 Subject: [PATCH] 2007-05-30 Sancho Lerena * pandoradb_data.sql: Added "style" token for default config. * include/config.inc.php: Version primary information is now on index.php. Here is only a "copy" used in aditional pages that do not load index.php * index.php: Version information is now here. * operation/reporting/graph_builder.php: Solved other little bug. * reporting/Image/Canvas/GD.php: Now using Antialias !!!. This is a BIG improve for graphs (and a bit slower on old systems). * reporting/fgraph.php: Changed colours in main graphs. * general/login_page.php: Small change in login screen. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@481 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 20 ++++++++++++++++ pandora_console/general/login_page.php | 5 ++-- pandora_console/include/config.inc.php | 8 ++++--- pandora_console/index.php | 17 +++++++++---- .../operation/reporting/graph_builder.php | 18 ++++++++++---- pandora_console/pandoradb_data.sql | 2 +- pandora_console/reporting/Image/Canvas/GD.php | 4 +++- pandora_console/reporting/fgraph.php | 24 +++++++++++++------ 8 files changed, 75 insertions(+), 23 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 8a5fc3539e..0caded5fdf 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,23 @@ +2007-05-30 Sancho Lerena + + * pandoradb_data.sql: Added "style" token for default config. + + * include/config.inc.php: Version primary information is now on + index.php. Here is only a "copy" used in aditional pages that do + not load index.php + + * index.php: Version information is now here. + + * operation/reporting/graph_builder.php: Solved other little bug. + + * reporting/Image/Canvas/GD.php: Now using Antialias !!!. This is + a BIG improve for graphs (and a bit slower on old systems). + + * reporting/fgraph.php: Changed colours in main graphs. + + * general/login_page.php: Small change in login screen. + + 2007-05-28 Raul Mateos * include/styles/pandora.css, pandora_red.css: New style with icon diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index a1cb0c1ae1..c439e45d08 100644 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -27,13 +27,14 @@ logo
+ Login
- + Password
- + diff --git a/pandora_console/include/config.inc.php b/pandora_console/include/config.inc.php index b0997c24e8..6f3286ef50 100644 --- a/pandora_console/include/config.inc.php +++ b/pandora_console/include/config.inc.php @@ -20,9 +20,11 @@ // This is the base config file //Pandora Version -$build_version="PC070524"; //PCyymmdd -$pandora_version="v1.3 devel"; - +if (!isset($build_version)) + $build_version="PC070529"; +if (!isset($pandora_version)) + $pandora_version="v1.3 devel"; + // Database configuration (default ones) //$dbname="pandora13"; // MySQL DataBase //$dbuser="pandora"; // DB User diff --git a/pandora_console/index.php b/pandora_console/index.php index e170c94bbf..ad332b5395 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.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 code additions -// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com -// Javascript Active Console code. -// Copyright (c) 2006 Jose Navarro -// Additions to code for Pandora FMS 1.2 graph code and new XML reporting template managemement +// Copyright (c) 2006 Jose Navarro +// Additions to code for 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 @@ -29,6 +27,13 @@ // Pandora FMS shares much of it's code with project Babel Enterprise, also a // FreeSoftware Project coded by some of the people who makes Pandora FMS +//Pandora Version +$build_version="PC070529"; +$pandora_version="v1.3 devel"; +global $build_version; +global $pandora_version; + +// Set to 1 to do not check for installer or config file $develop_bypass = 1; if ($develop_bypass != 1){ @@ -58,13 +63,15 @@ if ($develop_bypass != 1){ } // Real start -session_start(); +session_start(); include "include/config.php"; include "include/languages/language_".$language_code.".php"; require "include/functions.php"; // Including funcions. require "include/functions_db.php"; ?> + + diff --git a/pandora_console/operation/reporting/graph_builder.php b/pandora_console/operation/reporting/graph_builder.php index ae6243c284..57ddbc918c 100644 --- a/pandora_console/operation/reporting/graph_builder.php +++ b/pandora_console/operation/reporting/graph_builder.php @@ -21,7 +21,7 @@ $id_module = 0; $name = "Pandora FMS combined graph"; $width = 550; $height = 210; -$period = ""; +$period = 86401; //$alerts= ""; $events = ""; $factor = 1; @@ -45,6 +45,8 @@ if (isset($_GET["store_graph"])){ $width = entrada_limpia($_POST["width"]); $height = entrada_limpia($_POST["height"]); $events = entrada_limpia($_POST["events"]); + if ($events == "") // Temporal workaround + $events = 0; $period = entrada_limpia($_POST["period"]); // Create graph $sql = "INSERT INTO tgraph @@ -80,7 +82,7 @@ if (isset($_GET["store_graph"])){ if (isset($_GET["get_agent"])) { $id_agent = $_POST["id_agent"]; if (isset($_POST["chunk"])) - $chunkdata = isset($_POST["chunk"]); + $chunkdata = $_POST["chunk"]; } if (isset($_GET["delete_module"] )) { @@ -130,7 +132,6 @@ if (isset($_GET["delete_module"] )) { } } - if ( (isset($_GET["add_module"]))){ $id_agent = $_POST["id_agent"]; $id_module = $_POST["id_module"]; @@ -160,7 +161,9 @@ if ( (isset($_GET["add_module"]))){ // Parse CHUNK information into showable information // Split id to get all parameters if (! isset($_GET["delete_module"])){ - if (isset($chunkdata)) { + if (isset($_POST["period"])) + $period = $_POST["period"]; + if ((isset($chunkdata) )&& ($chunkdata != "")) { $module_array = array(); $weight_array = array(); $agent_array = array(); @@ -195,6 +198,9 @@ if (isset($chunk1)) { echo ""; if (isset($id_agent)) echo ""; + if (isset($period)) + echo ""; + echo ""; echo "
AgentModuleWeightDelete"; $color=0; @@ -242,6 +248,10 @@ if (($render == 1) && (isset($modules))) { echo $lang_label["graph_builder"].""; echo ""; echo ""; + +if (isset($period)) + echo ""; + echo ""; echo "
".$lang_label["source_agent"]; echo ""; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 50740bf3f6..4a9339821b 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -16,7 +16,7 @@ UNLOCK TABLES; /*!40000 ALTER TABLE `tconfig` DISABLE KEYS */; LOCK TABLES `tconfig` WRITE; -INSERT INTO `tconfig` VALUES (1,'language_code','en'),(3,'block_size','20'),(4,'days_purge','60'),(5,'days_compact','15'),(6,'graph_res','5'),(7,'step_compact','1'),(8,'db_scheme_version','1.3'),(9,'db_scheme_build','PD60328'),(12,'bgimage','background4.jpg'),(13,'show_unknown','0'),(14,'show_lastalerts','1'); +INSERT INTO `tconfig` VALUES (1,'language_code','en'),(3,'block_size','20'),(4,'days_purge','60'),(5,'days_compact','15'),(6,'graph_res','5'),(7,'step_compact','1'),(8,'db_scheme_version','1.3'),(9,'db_scheme_build','PD60525'),(12,'bgimage','background4.jpg'),(13,'show_unknown','0'),(14,'show_lastalerts','1'),(15,'style','pandora'); UNLOCK TABLES; /*!40000 ALTER TABLE `tconfig` ENABLE KEYS */; diff --git a/pandora_console/reporting/Image/Canvas/GD.php b/pandora_console/reporting/Image/Canvas/GD.php index 3d3573178c..6c0ee542e0 100644 --- a/pandora_console/reporting/Image/Canvas/GD.php +++ b/pandora_console/reporting/Image/Canvas/GD.php @@ -87,7 +87,9 @@ class Image_Canvas_GD extends Image_Canvas_WithMap * @var string * @access private */ - var $_antialias = 'off'; +// Pandora FMS: Beware of this, could be slow on old systems + + var $_antialias = 'driver'; /** * Create the GD canvas. diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index a0a3c77ca9..43a7424eec 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -90,6 +90,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, // Init tables for ($y = 0; $y < $module_number; $y++){ $real_data[$y] = array(); + $mod_data[$y] = 1; // Data multiplier to get the same scale on all modules if ($show_event == 1) $real_event[$y] = array(); if (isset($weight_list[$y])){ @@ -108,9 +109,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $id_agente = dame_agente_id($nombre_agente); $nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo); - $module_list_name[$y] = substr($nombre_agente,0,8)." - ".substr($nombre_modulo,0,8); - if ($weight_list[$y] != 1) - $module_list_name[$y] .= " (x".$weight_list[$y].")"; + $module_list_name[$y] = substr($nombre_agente,0,8)."/".substr($nombre_modulo,0,8); for ($x = 0; $x <= $resolution; $x++) { $valores[$x][0] = 0; // SUM of all values for this interval $valores[$x][1] = 0; // counter @@ -195,8 +194,13 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $valores[$x][5] = $previous; } // Get max value for all graph - if ($valores[$x][5] * $weight_list[$y] > $max_value ) - $max_value = $valores[$x][5] * $weight_list[$y]; + if ($valores[$x][5] > $max_value ){ + $max_value = $valores[$x][5]; + } + // This stores in mod_data max values for each module + if ($mod_data[$y] < $valores[$x][5]){ + $mod_data[$y] = $valores[$x][5]; + } // Take prev. value // TODO: CHeck if there are more than 24hours between // data, if there are > 24h, module down. @@ -204,6 +208,12 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, } } + for ($y = 0; $y < $module_number; $y++){ + $weight_list[$y] = ($max_value / $mod_data[$y]) + ($weight_list[$y]-1); + if ($weight_list[$y] != 1) + $module_list_name[$y] .= " (x". format_numeric($weight_list[$y],1).")"; + } + // Create graph // ************* $Graph =& Image_Graph::factory('graph', array($width, $height)); @@ -257,7 +267,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, for ($cc=0; $cc <= $resolution; $cc++) { $tdate = date('d/m', $valores[$cc][2])."\n".date('H:i', $valores[$cc][2]); for ($y = 0; $y < $module_number; $y++){ - $dataset[$y]->addPoint($tdate, $real_data[$y][$cc]); + $dataset[$y]->addPoint($tdate, $real_data[$y][$cc] * $weight_list[$y]); if (($show_event == 1) AND (isset($real_event[$cc]))) { $dataset_event->addPoint($tdate, $max_value); } @@ -566,7 +576,7 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event, } else { $FillArray->addColor('yellow@0.5'); $FillArray->addColor('orange@0.6'); - $FillArray->addColor('brown@0.7'); + $FillArray->addColor('#e37907@0.7'); $FillArray->addColor('red@0.7'); $FillArray->addColor('blue@0.7'); $FillArray->addColor('green@0.7');