From 5b65d42409f605eb924c18723a98817f2205a4ee Mon Sep 17 00:00:00 2001 From: slerena <slerena@gmail.com> Date: Sun, 6 Apr 2008 22:18:33 +0000 Subject: [PATCH] 2008-04-09 Sancho Lerena <slerena@gmail.com> * pandoradb.sql: New header. * pandoradb_data.sql: Removed /**/ comments, due problems with installer. * install.php: Updated installer for 2.0 version. * functions.php: Fix small problem in pandora_help() with icon. * estado_alertas.php: Do not show header "combined alert" if there is no complex alerts. * reporting_viewer.php: Round data for monitor SLA report. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@796 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 16 ++++++++++ pandora_console/include/config.inc.php | 14 ++++---- pandora_console/include/config.php | 28 ++++++++++------ pandora_console/include/functions.php | 2 +- pandora_console/install.php | 18 +++++------ .../operation/agentes/estado_alertas.php | 4 ++- .../operation/reporting/reporting_viewer.php | 2 +- pandora_console/pandoradb.sql | 18 +++++++++++ pandora_console/pandoradb_data.sql | 32 ++++++++++++++++--- 9 files changed, 103 insertions(+), 31 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1aee538faa..267d96b1a6 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2008-04-09 Sancho Lerena <slerena@gmail.com> + + * pandoradb.sql: New header. + + * pandoradb_data.sql: Removed /**/ comments, due problems with + installer. + + * install.php: Updated installer for 2.0 version. + + * functions.php: Fix small problem in pandora_help() with icon. + + * estado_alertas.php: Do not show header "combined alert" if there + is no complex alerts. + + * reporting_viewer.php: Round data for monitor SLA report. + 2008-04-04 Jorge Gonzalez <jorge.gonzalez@artica.es> * godmode/agentes/module_manager_editor_data.php, diff --git a/pandora_console/include/config.inc.php b/pandora_console/include/config.inc.php index 7f4dc05975..aa8e7ebca0 100644 --- a/pandora_console/include/config.inc.php +++ b/pandora_console/include/config.inc.php @@ -16,14 +16,16 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Database configuration (default ones) -$config["dbname"]="pandora"; -$config["dbuser"]="pandora"; -$config["dbpass"]="pandora"; -$config["dbhost"]="localhost"; +// Default values + +// $config["dbname"]="pandora"; +// $config["dbuser"]="pandora"; +// $config["dbpass"]="pandora"; +// $config["dbhost"]="localhost"; // This is used for reporting, please add "/" character at the end -$config["homedir"]="/var/www/pandora_console/"; -$config["homeurl"]="/pandora_console/"; +// $config["homedir"]="/var/www/pandora_console/"; +// $config["homeurl"]="/pandora_console/"; // Do not display any ERROR //error_reporting(0); // Need to use active console at this moment diff --git a/pandora_console/include/config.php b/pandora_console/include/config.php index 9bfc28348b..e91fd10a85 100644 --- a/pandora_console/include/config.php +++ b/pandora_console/include/config.php @@ -1,4 +1,13 @@ <?php +// Begin of automatic config file +$config["dbname"]="pandora"; // MySQL DataBase name +$config["dbuser"]="pandora"; // DB User +$config["dbpass"]="iysukzjq"; // DB Password +$config["dbhost"]="localhost"; // DB Host +$config["homedir"]="/var/www/pandora/"; // Config homedir +$config["homeurl"]="http://localhost/pandora"; // Base URL +// End of automatic config file +?><?php // Pandora FMS - the Free Monitoring System // ======================================== // Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es @@ -14,23 +23,24 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - // Database configuration (default ones) -$config["dbname"]="pandora"; -$config["dbuser"]="pandora"; -$config["dbpass"]="pandora"; -$config["dbhost"]="localhost"; +// Default values + +// $config["dbname"]="pandora"; +// $config["dbuser"]="pandora"; +// $config["dbpass"]="pandora"; +// $config["dbhost"]="localhost"; // This is used for reporting, please add "/" character at the end -$config["homedir"]="/var/www/pandora_console/"; -$config["homeurl"]="/pandora_console/"; +// $config["homedir"]="/var/www/pandora_console/"; +// $config["homeurl"]="/pandora_console/"; // Do not display any ERROR //error_reporting(0); // Need to use active console at this moment // Display ALL errors -error_reporting(E_ALL); +error_reporting(E_ERROR); // This is directory where placed "/attachment" directory, to upload files stores. // This MUST be writtable by http server user, and should be in pandora root. @@ -39,7 +49,7 @@ error_reporting(E_ALL); $config["attachment_store"]=$config["homedir"]; // Default font used for graphics (a Free TrueType font included with Pandora FMS) -$config["fontpath"] = $config["homedir"]."/include/FreeSans.ttf"; +$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf"; // Style (pandora by default) $config["style"] = "pandora"; diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 9dd094fcdc..d77745546d 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -19,7 +19,7 @@ function pandora_help ($id, $return = false) { global $config; - $output = '<img src="'.$config['homeurl'].'images/help.png" onClick="pandora_help(\''.$id.'\')">'; + $output = '<img src="'.$config['homeurl'].'/images/help.png" onClick="pandora_help(\''.$id.'\')">'; if ($return) return $return; echo $output; diff --git a/pandora_console/install.php b/pandora_console/install.php index 5727932884..a1ce98bddd 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -128,6 +128,7 @@ function parse_mysql_dump($url){ if(trim($sql_line) != "" && strpos($sql_line, "--") === false){ $query .= $sql_line; if(preg_match("/;[\040]*\$/", $sql_line)){ + // echo "DEBUG $query <br>"; if (!$result = mysql_query($query)) return 0; $query = ""; @@ -153,7 +154,7 @@ function install_step1() { <h1>Pandora FMS installation wizard. Step #1 of 4</h1> <div id='wizard' style='height: 380px;'> <div id='install_box'> - <h1>Welcome to Pandora FMS 1.3 installation Wizard</h1> + <h1>Welcome to Pandora FMS 2.0 installation Wizard</h1> <p>This wizard helps you to quick install Pandora FMS console in your system.</p> <p>In four steps checks all dependencies and make your configuration for a quick installation.</p> <p>For more information, please refer to documentation.</p> @@ -163,7 +164,7 @@ function install_step1() { echo "<div class='warn'><b>Warning:</b> You already have a config.php file. Configuration and database would be overwritten if you continued.</div>"; } echo "<div class='warn'><b>Warning:</b> This installer will <b>overwrite and destroy</b> your existing Pandora FMS configuration and <b>Database</b>. Before continue, please <b>be sure that you have no valuable Pandora FMS data in your Database.</b><br></div>"; - echo "<div class='info'>If you want to <b>upgrade</b> from Pandora FMS 1.2 to 1.3 version, + echo "<div class='info'>If you want to <b>upgrade</b> from Pandora FMS 1.3.x to 2.0 version, use the <a href='upgrade.php'>automated update wizard</a></div>"; echo " </div> @@ -345,15 +346,14 @@ function install_step4() { $cfgin = fopen ("include/config.inc.php","r"); $cfgout = fopen ($pandora_config,"w"); $config_contents = fread ($cfgin, filesize("include/config.inc.php")); - $config_new = '<?php // Begin of automatic config file -$dbname="'.$dbname.'"; // MySQL DataBase name -$dbuser="pandora"; // DB User -$dbpassword="'.$random_password.'"; // DB Password -$dbhost="'.$dbhost.'"; // DB Host -$config_homedir="'.$path.'"; // Config homedir -$BASE_URL="'.$url.'"; // Base URL +$config["dbname"]="'.$dbname.'"; // MySQL DataBase name +$config["dbuser"]="pandora"; // DB User +$config["dbpass"]="'.$random_password.'"; // DB Password +$config["dbhost"]="'.$dbhost.'"; // DB Host +$config["homedir"]="'.$path.'"; // Config homedir +$config["homeurl"]="'.$url.'"; // Base URL // End of automatic config file ?>'; $step7 = fputs ($cfgout, $config_new); diff --git a/pandora_console/operation/agentes/estado_alertas.php b/pandora_console/operation/agentes/estado_alertas.php index 3a94ad57cd..bd51b4a427 100644 --- a/pandora_console/operation/agentes/estado_alertas.php +++ b/pandora_console/operation/agentes/estado_alertas.php @@ -87,9 +87,11 @@ if (isset($_GET["id_agente"])){ show_alert_show_view ($data, $tdcolor, 0); } - echo "<tr><td colspan=11 class='datos3'><center>".lang_string("Combined alerts")."</center>"; // Show combined alerts for this agent $result_com = mysql_query("SELECT * FROM talerta_agente_modulo WHERE id_agent = $id_agente"); + if (mysql_num_rows ($result_com)) { + echo "<tr><td colspan=11 class='datos3'><center>".lang_string("Combined alerts")."</center>"; + } while ($data_com=mysql_fetch_array($result_com)){ if ($color == 1){ $tdcolor = "datos"; diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index de1c2c5125..c624bcf8a4 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -209,7 +209,7 @@ if (($report_user == $id_user) OR (dame_admin($id_user)==1) OR ($report_private echo "<p style='font: bold 3em Arial, Sans-serif; color: #000000;'>"; echo $monitor_value." %"."<img src='images/b_green.png' height=32 width=32>"; echo "</p>"; - $monitor_value2 = 100 - $monitor_value ; + $monitor_value2 = format_numeric(100 - $monitor_value,2) ; echo "<p style='font: bold 3em Arial, Sans-serif; color: #ff0000;'>"; echo $monitor_value2." %"."<img src='images/b_red.png' height=32 width=32>"; echo "</p>"; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0129e0bded..cb249c7dda 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1,4 +1,22 @@ +-- Pandora FMS - the Free Monitoring System +-- ======================================== +-- Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +-- Please see http://pandora.sourceforge.net for full contribution list +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation for version 2. +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +-- PLEASE NO NOT USE MULTILINE COMMENTS +-- Because Pandora Installer don't understand them +-- and fails creating database !!! -------------------------------------------------------------- -- Pandora FMS official tables for 2.0 version -- -------------------------------------------------------------- diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index b016a84042..01c27a78cd 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -1,3 +1,27 @@ +-- Pandora FMS - the Free Monitoring System +-- ======================================== +-- Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +-- Please see http://pandora.sourceforge.net for full contribution list + +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation for version 2. +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +-- Database Data for Pandora FMS 2.0 + +-- PLEASE NO NOT USE MULTILINE COMMENTS +-- Because Pandora Installer don't understand them +-- and fails creating database !!! + + + -- -- Dumping data for table `talerta` -- @@ -62,10 +86,10 @@ UNLOCK TABLES; /*!40000 ALTER TABLE `tlanguage` DISABLE KEYS */; LOCK TABLES `tlanguage` WRITE; INSERT INTO `tlanguage` VALUES ('en','English'); -/*INSERT INTO `tlanguage` VALUES ('es_es','Español'); -INSERT INTO `tlanguage` VALUES ('de','Deutch'); -INSERT INTO `tlanguage` VALUES ('fr','Français'); -INSERT INTO `tlanguage` VALUES ('pt_br','Português-Brasil'); */ +--INSERT INTO `tlanguage` VALUES ('es_es','Español'); +--INSERT INTO `tlanguage` VALUES ('de','Deutch'); +--INSERT INTO `tlanguage` VALUES ('fr','Français'); +--INSERT INTO `tlanguage` VALUES ('pt_br','Português-Brasil'); UNLOCK TABLES; /*!40000 ALTER TABLE `tlanguage` ENABLE KEYS */;