From 70e2f9d797cf6c8b56c7a47068d3779c41e328cc Mon Sep 17 00:00:00 2001 From: slerena Date: Wed, 11 Apr 2007 03:12:48 +0000 Subject: [PATCH] 2007-04-10 Sancho Lerena * pandoradb_data.sql: Fixed some odd problems with schema data. * pandoradb.sql: Fixed some odd problems with schema structure and added new table tnews for publish board updates. * include/styles/pandora.css: Changed color for data2 style. * include/config.inc.php: Deleted two last blank lines who makes config.php unusable for graphs. FIXED. * include/languages/language_en.php: Added some new strings. * include/config.php: some problems with new config variables. Need to recheck. * include/functions.php: Added function to render normal text, replacing carriage return with HTML br tag. * install.php: Many small bugs fixed. Now uses dbname variable and use default variables in form. * estado_grupo.php: Small bug fixed. * estado_ultimopaquete: Small bug fixed. * estado_generalagente.php: Small bug fixed. * view_server.php: Small bug fixed. * fgraph.php: Now agent with only one kind of module render module distribution graph. * stat_win.php: Fixed small bug with windows ids. * module_manager.php: Fixed small bug. * modificar_agente.php: Fixed small bug. * module_list.php: Fixed stupid bug. * god_mode/menu.php: Fixed problem with menu position. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@415 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 45 +++ pandora_console/general/logon_ok.php | 35 +- .../godmode/agentes/configurar_agente.php | 7 +- .../godmode/agentes/modificar_agente.php | 12 +- .../godmode/agentes/module_manager.php | 2 +- pandora_console/godmode/menu.php | 2 +- .../godmode/modules/module_list.php | 39 ++- pandora_console/include/config.inc.php | 3 +- pandora_console/include/config.php | 115 +++---- pandora_console/include/functions.php | 12 +- .../include/languages/language_en.php | 4 + pandora_console/include/styles/pandora.css | 4 +- pandora_console/index.php | 7 +- pandora_console/install.php | 302 +++++++++--------- .../agentes/estado_generalagente.php | 2 +- .../operation/agentes/estado_grupo.php | 3 + .../agentes/estado_ultimopaquete.php | 8 +- .../operation/servers/view_server.php | 32 +- pandora_console/pandoradb.sql | 3 +- pandora_console/pandoradb_data.sql | 12 +- pandora_console/reporting/fgraph.php | 2 +- 21 files changed, 374 insertions(+), 277 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0791d13100..4be99f7d47 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,48 @@ +2007-04-10 Sancho Lerena + + * pandoradb_data.sql: Fixed some odd problems with schema data. + + * pandoradb.sql: Fixed some odd problems with schema structure and + added new table tnews for publish board updates. + + * include/styles/pandora.css: Changed color for data2 style. + + * include/config.inc.php: Deleted two last blank lines who makes + config.php unusable for graphs. FIXED. + + * include/languages/language_en.php: Added some new strings. + + * include/config.php: some problems with new config + variables. Need to recheck. + + * include/functions.php: Added function to render normal text, + replacing carriage return with HTML br tag. + + * install.php: Many small bugs fixed. Now uses dbname variable and + use default variables in form. + + * estado_grupo.php: Small bug fixed. + + * estado_ultimopaquete: Small bug fixed. + + * estado_generalagente.php: Small bug fixed. + + * view_server.php: Small bug fixed. + + * fgraph.php: Now agent with only one kind of module render module + distribution graph. + + * stat_win.php: Fixed small bug with windows ids. + + * module_manager.php: Fixed small bug. + + * modificar_agente.php: Fixed small bug. + + * module_list.php: Fixed stupid bug. + + * god_mode/menu.php: Fixed problem with menu position. + + 2007-04-03 Raul Mateos * include/languages/language_en.php, language_es_es.php: Added text diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 89f668ea17..3ce780122f 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -71,6 +71,8 @@ echo ""; echo ""; // activity + // Private messages pending to read ! + $sql='SELECT COUNT(*) FROM tmensajes WHERE id_usuario_destino="' . $nick . '" AND estado="FALSE";'; $resultado = mysql_query ($sql); $row = mysql_fetch_array ($resultado); @@ -78,26 +80,49 @@ echo '
' . $lang_label["new_message_bra"]; echo ''; - echo $row["COUNT(*)"] . ' '; - echo $lang_label["new_message_ket"] . '
'; + echo $row["COUNT(*)"] . ' '; + echo $lang_label["new_message_ket"] . ''; } + // Site news ! + echo '

' . $lang_label["site_news"] . '

'; + echo ''; + + + $sql_news = "SELECT * FROM tnews ORDER by utimestamp LIMIT 3"; + $result_news = mysql_query ($sql_news); + while ($row = mysql_fetch_array ($result_news)) { + + echo '
'; + echo $lang_label["at"]. " ". $row["utimestamp"] ." ".$lang_label["user"]. " ". $row["author"]." ".$lang_label["says"].": \"".$row["subject"]."\""; + echo '
'; + echo clean_output_breaks($row["text"]); + echo ''; + + } + echo "
"; + + // Site stats echo '

' . $lang_label["stat_title"] . '

'; + echo ''; $query1 = "SELECT COUNT(id_usuario) FROM tusuario"; $result = mysql_query ($query1); $row = mysql_fetch_array ($result); + echo "
"; echo ''; echo $lang_label["there_are"] ."". $row[0] . ' ' . $lang_label["user_defined"]; echo ''; + echo "
"; $query1 = "SELECT COUNT(id_agente) FROM tagente"; $result = mysql_query ($query1); $row = mysql_fetch_array ($result); echo ''; echo $lang_label["there_are"] . "".$row[0]." ". $lang_label["agent_defined"]; echo ''; - + + echo "
"; $query1 = "SELECT COUNT(id_agente_datos) FROM tagente_datos"; $result = mysql_query ($query1); $row = mysql_fetch_array ($result); @@ -105,6 +130,7 @@ echo $lang_label["there_are"] . "".$row[0] . ' ' . $lang_label["data_harvested"]; echo ''; + echo "
"; $query1 = "SELECT COUNT(*) FROM talerta_agente_modulo"; $result = mysql_query ($query1); $row = mysql_fetch_array ($result); @@ -112,6 +138,7 @@ echo $lang_label["there_are"] . "".$row[0] .' ' . $lang_label["alert_defined"]; echo ""; + echo "
"; echo ''; $query1 = "SELECT timestamp FROM tagente_estado ORDER BY timestamp DESC LIMIT 1"; $result = mysql_query($query1); @@ -121,6 +148,6 @@ echo 'No data received yet!'; } echo ''; - + echo "
"; echo ''; // class "jus" ?> \ No newline at end of file diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index a2d30a4310..796fdfc41c 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -117,13 +117,13 @@ if (isset($_POST["create_agent"])) { // Create a new and shining agent } // Show tabs -// ¯----------------- +// ----------------- echo ""; @@ -480,7 +480,6 @@ if ( (isset($_POST["nc"]) && ($_POST["nc"]!=-1))){ $sql1="SELECT * FROM tnetwork_component WHERE id_nc = '$id_nc'"; $result=mysql_query($sql1); $row=mysql_fetch_array($result); - $modulo_id_agente = $row["id_agente"]; $modulo_id_tipo_modulo = $row["type"]; $id_module_group = $row["id_module_group"]; $modulo_nombre = $row["name"]; @@ -488,7 +487,6 @@ if ( (isset($_POST["nc"]) && ($_POST["nc"]!=-1))){ $tcp_send = $row["tcp_send"]; $tcp_rcv = $row["tcp_rcv"]; $tcp_port = $row["tcp_port"]; - $ip_target = $row["ip_target"]; $snmp_community = $row["snmp_community"]; $snmp_oid = $row["snmp_oid"]; $id_module_group = $row["id_module_group"]; @@ -521,6 +519,7 @@ if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1)) ) && $modulo_min= "0"; } $sql_insert = "INSERT INTO tagente_modulo (id_agente,id_tipo_modulo,nombre,descripcion,max,min,snmp_oid,snmp_community,id_module_group,module_interval,ip_target,tcp_port,tcp_rcv,tcp_send) VALUES (".$id_agente.",".$id_tipo_modulo.",'".$nombre."','".$descripcion."','".$modulo_max."','".$modulo_min."', '$snmp_oid', '$snmp_community', '$id_module_group', '$module_interval', '$ip_target', '$tcp_port', '$tcp_rcv', '$tcp_send')"; + $result=mysql_query($sql_insert); $id_agente_modulo = mysql_insert_id(); diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 2955f987a8..279aa4abcf 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -194,21 +194,19 @@ if (mysql_num_rows($result)){ } echo "
"; echo ""; - echo "
"; - echo ""; - echo "
"; - echo ""; + $endline = ""; } else { + $endline = ""; // If no data... let's show a beautiful button to create agent // This is a piece of crap because we're duplicanting code above // of this, don't do again. echo "
".$lang_label["no_agent_def"]."
"; + echo "
"; + sec2=godmode/agentes/configurar_agente&create_agent=1'>"; echo ""; echo "
"; + echo $endline; } ?> diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index d883bfae59..e5b82851e0 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -168,7 +168,7 @@ $result=mysql_query($sql1); echo "

".$lang_label["agent_conf"]." > ".$lang_label["assigned_modules"]." ".$lang_label["help"].""; - echo "   ".$lang_label["module_asociation_form"].""; + echo "   ".$lang_label["module_asociation_form"].""; echo "

"; if ($row=mysql_num_rows($result)){ echo ''; diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index db03bae374..7ff5635a35 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -77,7 +77,7 @@ if (comprueba_login() == 0){ } if (isset($_GET["sec"]) && $_GET["sec"] == "gmodules"){ - if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/modules/manage_network_components") + if (isset($_GET["sec2"]) && ( $_GET["sec2"] == "godmode/modules/manage_network_components" || $_GET["sec2"] == "godmode/modules/manage_network_components_form") ) echo "
"; else echo "
"; diff --git a/pandora_console/godmode/modules/module_list.php b/pandora_console/godmode/modules/module_list.php index 5d6090844b..4c0f7ea785 100644 --- a/pandora_console/godmode/modules/module_list.php +++ b/pandora_console/godmode/modules/module_list.php @@ -76,26 +76,25 @@ if (give_acl($id_user, 0, "PM")==1) { $tdcolor = "datos2"; $color = 1; } - if ($row["id_grupo"] != 1){ - echo " -
- - - - - "; - } + echo " + + + + + + "; + } echo ""; echo ""; } -function install_step2() { - echo " -
-

Pandora FMS console instalation wizard. Step #2 of 4

-
-
"; - echo "

Checking software dependencies

"; - echo "
- - - ".$row["nombre"]." - - ".give_modulecategory_name ($row["categoria"])." - - ".$row["descripcion"]." -
+ + + ".$row["nombre"]." + + ".give_modulecategory_name ($row["categoria"])." + + ".$row["descripcion"]." +
"; diff --git a/pandora_console/include/config.inc.php b/pandora_console/include/config.inc.php index e8c569dc36..f5c7adf35f 100644 --- a/pandora_console/include/config.inc.php +++ b/pandora_console/include/config.inc.php @@ -97,5 +97,4 @@ if ($language_code == 'ast_es') { } else $help_code = substr($language_code,0,2); -?> - +?> \ No newline at end of file diff --git a/pandora_console/include/config.php b/pandora_console/include/config.php index 513aa94f5c..26f748bc3b 100644 --- a/pandora_console/include/config.php +++ b/pandora_console/include/config.php @@ -1,19 +1,24 @@ - -// Additions to Pandora FMS 1.2 graph code and new XML reporting template management -// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es -// + // 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; version 2 +// as published by the Free Software Foundation 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 @@ -24,28 +29,35 @@ // This is the base config file //Pandora Version -$build_version="PC070328"; //PCyymmdd +$build_version="PC070224"; //PCyymmdd $pandora_version="v1.3 devel"; -// Database configuration -$dbname="pandora"; // MySQL DataBase -$dbuser="pandora"; // DB User -$dbpassword="pandora"; // Password -$dbhost="localhost"; // MySQL Host -$dbtype="mysql"; // Type of Database, now only "mysql" its supported -$attachment_store="/var/www/pandora_console"; //This is directory where placed "attachment" directory, to upload files stores. This MUST be writtable by wwwserver user, and should be in pandora root. Please append "/" to the end :-) -$config_fontpath = "../reporting/FreeSans.ttf"; // Change this to your font folder, if needed. +// Database configuration (default ones) +//$dbname="pandora"; // MySQL DataBase +//$dbuser="pandora"; // DB User +//$dbpassword="pandora"; // Password +//$dbhost="localhost"; // MySQL Host + +// This is used for reporting, please add "/" character at the end +//$config_homedir = "/var/www/babel_console/"; // Do not display any ERROR -//error_reporting(E_ALL); +//error_reporting(0); + +// Display ALL errors error_reporting(E_ALL); +//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. +// Please append "/" to the end. +$attachment_store=$config_homedir; -// Uncomment next to Display all errors, warnings and notices -// error_reporting(E_ALL); +// Default font used for graphics (a Free TrueType font included with Pandora FMS) +$config_fontpath = $config_homedir."reporting/FreeSans.ttf"; -// Read rest of config from DB +// Read remaining config tokens from DB if (! mysql_connect($dbhost,$dbuser,$dbpassword)){ + //Non-persistent connection. If you want persistent conn change it to mysql_pconnect() exit ('Pandora Error @@ -65,43 +77,32 @@ if (! mysql_connect($dbhost,$dbuser,$dbpassword)){ '); } - -// Default values for config -$language_code = "en"; -$block_size = 25; -$days_purge = 30; -$days_compact = 7; -$config_graph_res = 3; -$config_step_compact = 1; -$config_bgimage = "background4.jpg"; -$config_show_unknown = 0; -$config_show_lastalerts = 0; - mysql_select_db($dbname); $result2=mysql_query("SELECT * FROM tconfig"); while ($row2=mysql_fetch_array($result2)){ switch ($row2["token"]) { - case "language_code": $language_code = $row2["value"]; - break; - case "block_size": $block_size = $row2["value"]; - break; - case "days_purge": $days_purge = $row2["value"]; - break; - case "days_compact": $days_compact = $row2["value"]; - break; - case "graph_res": $config_graph_res = $row2["value"]; - break; - case "show_unknown": $config_show_unknown = $row2["value"]; - break; - case "show_lastalerts": $config_show_lastalerts = $row2["value"]; - break; + case "language_code": $language_code=$row2["value"]; + break; + case "block_size": $block_size=$row2["value"]; + break; + case "days_purge": $days_purge=$row2["value"]; + break; + case "days_compact": $days_compact=$row2["value"]; + break; + case "graph_res": $config_graph_res=$row2["value"]; + break; + case "step_compact": $config_step_compact=$row2["value"]; + break; + case "truetype": $config_truetype=$row2["value"]; + break; + case "graph_order": $config_graph_order=$row2["value"]; + break; + case "bgimage": $config_bgimage=$row2["value"]; + break; } } - -// Adjist helpcode from language_code -if ($language_code == 'ast_es') - $help_code = 'ast'; -else - $help_code = substr($language_code,0,2); - -?> +if ($language_code == 'ast_es') { + $help_code='ast'; + } +else $help_code = substr($language_code,0,2); +?> \ No newline at end of file diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 0dd1538b1a..d740e02faa 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -65,14 +65,12 @@ function salida_limpia ($string){ // after the initial translation, _do_ map standalone '&' into '&' return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($string, $trans)); } -/* -{ - $texto_ok = htmlspecialchars($texto, ENT_QUOTES, "ISO8859-15"); // Quitamos - // Reemplazamos retornos de carro por "
" - $texto_html = str_replace(chr(13),"
",$texto_ok); - return $texto_html; + +function clean_output_breaks ($string){ + $myoutput = salida_limpia($string); + return preg_replace ('/\n/',"
", $myoutput); + } -*/ // --------------------------------------------------------------- // This function reads a string and returns it "clean" diff --git a/pandora_console/include/languages/language_en.php b/pandora_console/include/languages/language_en.php index c97aec3b13..f4adb119cd 100644 --- a/pandora_console/include/languages/language_en.php +++ b/pandora_console/include/languages/language_en.php @@ -746,6 +746,10 @@ $lang_label["no_rtask"]="There are no recon task configured"; //3 Apr 2007 $lang_label["no_netprofiles"]="There are no defined network profiles"; +//11 Apr 207 +$lang_label["site_news"]="Site news"; +$lang_label["at"]="At"; +$lang_label["says"]="says"; global $lang_label; global $help_label; ?> \ No newline at end of file diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 85bc7a9b26..4af8b52c37 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -228,8 +228,8 @@ td.datosf9i, td.datos_jus, td.w90datos, td.w135datos { td.datos2, td.datos2t, td.datos2b, td.datos2_id, td.datos2f9, td.datos2f9i, td.datos2_jus, td.w90datos2, td.w135datos2 { - /* background-color: #fafbfc; */ - background-color: #e6e9cd; + background-color: #efefef; + /* background-color: #e6e9cd; */ } td.datos3 { diff --git a/pandora_console/index.php b/pandora_console/index.php index 59d0cec902..f838a50298 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -32,10 +32,15 @@ // FreeSoftware Project coded by some of the people who makes Pandora FMS $develop_bypass = 1; + if ($develop_bypass != 1){ // If no config file, automatically try to install if (! file_exists("include/config.php")){ - include ("install.php"); + if (!file_exists("install.php")){ + include "general/error_install.php"; + exit; + } else + include ("install.php"); exit; } // Check for installer presence diff --git a/pandora_console/install.php b/pandora_console/install.php index d1946361a7..ae6ee93568 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -34,46 +34,11 @@ - - + -

Pandora FMS instalation wizard. Step #1 of 4

-
-
-

Welcome to Pandora FMS installation Wizard

-

This wizard helps you to quick install Pandora FMS console in your system.

-

In three steps checks all dependencies and make your configuration for a quick installation.

-

For more information, please refer to documentation.

- Pandora FMS Development team - "; - if (file_exists("include/config.php")){ - echo "

Warning: You already have a config.php file. Configuracion and database would be overwritten if you continue.

"; - } - echo " -
-
-
-
-
- -
-
- -
-
- - "; -} - function check_extension ( $ext, $label ){ echo "
"; echo " $label"; @@ -152,100 +117,6 @@ function check_variable ( $var, $value, $label, $mode ){ echo "
"; - $res = 0; - $res += check_variable(phpversion(),"4.3","PHP version >= 4.3.x",1); - $res += check_extension("mysql","PHP MySQL extension"); - //$res += check_extension("curl","PHP Curl extension"); - $res += check_extension("gd","PHP gd extension"); - $res += check_extension("snmp","PHP smmp extension"); - $res += check_extension("session","PHP session extension"); - $res += check_include("PEAR.php","PEAR PHP Library"); - //$res += check_exists ("/usr/bin/pdflatex","PDF Latex in /usr/bin/pdflatex"); - echo "
- -
- -
-
- -
-
"; - if ($res > 0) { - echo "

You have some uncomplete - dependencies. Please correct it or this installer - could not finish your installation. -

- Ignore it. Force install Step #3"; - } else { - echo ""; - } - echo " -
- - - "; -} - -function install_step3() { - echo " -
-

Pandora FMS console instalation wizard. Step #3 of 4

-
-
-

Environment and database setup

-

- This wizard will create your Pandora FMS database, and populate it with data needed to run for first time. - You need a privileged user to create database schema, this is usually root user. - Information about root user will not be used or stored for anymore. -

-

- Now, please, complete all details to configure your database and enviroment setup -

-
-
DB User with privileges on MySQL
- -
DB Password for this user
- -
DB Hostname of MySQL
- - -
Full path to HTTP publication directory.
- For example /srv/www/hdtocs/ -
- - -
Full local URL to Pandora FMS Console.
- For example http://localhost/pandora_console -
- - -
-
-
-
- -
-
- -
-
- -
"; -} - function parse_mysql_dump($url){ if (file_exists($url)){ $file_content = file($url); @@ -273,18 +144,156 @@ function random_name ($size){ return $temp; } +function install_step1() { + echo " +
+

Pandora FMS instalation wizard. Step #1 of 4

+
+
+

Welcome to Pandora FMS installation Wizard

+

This wizard helps you to quick install Pandora FMS console in your system.

+

In three steps checks all dependencies and make your configuration for a quick installation.

+

For more information, please refer to documentation.

+ Pandora FMS Development team + "; + if (file_exists("include/config.php")){ + echo "

Warning: You already have a config.php file. Configuracion and database would be overwritten if you continue.

"; + } + echo " +
+
+
+
+
+ +
+
+ +
+
+ +
"; +} + + + +function install_step2() { + echo " +
+

Pandora FMS console instalation wizard. Step #2 of 4

+
+
"; + echo "

Checking software dependencies

"; + echo ""; + $res = 0; + $res += check_variable(phpversion(),"4.3","PHP version >= 4.3.x",1); + $res += check_extension("mysql","PHP MySQL extension"); + //$res += check_extension("curl","PHP Curl extension"); + $res += check_extension("gd","PHP gd extension"); + $res += check_extension("snmp","PHP smmp extension"); + $res += check_extension("session","PHP session extension"); + $res += check_include("PEAR.php","PEAR PHP Library"); + //$res += check_exists ("/usr/bin/pdflatex","PDF Latex in /usr/bin/pdflatex"); + echo "
+
+
+ +
+
+ +
+
"; + if ($res > 0) { + echo "

You have some uncomplete + dependencies. Please correct it or this installer + could not finish your installation. +

+ Ignore it. Force install Step #3"; + } else { + echo ""; + } + echo " +
+
+
+ "; +} + +function install_step3() { + echo " +
+

Pandora FMS console instalation wizard. Step #3 of 4

+
+
+

Environment and database setup

+

+ This wizard will create your Pandora FMS database, and populate it with data needed to run for first time. + You need a privileged user to create database schema, this is usually root user. + Information about root user will not be used or stored for anymore. +

+

+ Now, please, complete all details to configure your database and enviroment setup. NOTICE that database will be destroyed if already exists!. +

+
+
DB User with privileges on MySQL
+ + +
DB Password for this user
+ + +
DB Hostname of MySQL
+ + +
DB Name (pandora by default)
+ + +
Full path to HTTP publication directory.
+ For example /var/www/pandora_console/ +
+ + +
Full local URL to Pandora FMS Console.
+ For example http://localhost/pandora_console +
+ + +
+
+
+
+ +
+
+ +
+
+ +
"; +} + + + function install_step4() { - $db_name = "pandora"; $pandora_config = "include/config.php"; - if ( (! isset($_POST["user"])) || (! isset($_POST["host"])) || (! isset($_POST["pass"])) ) { + if ( (! isset($_POST["user"])) || (! isset($_POST["dbname"])) || (! isset($_POST["host"])) || (! isset($_POST["pass"])) ) { $dbpassword = ""; $dbuser = ""; $dbhost = ""; + $dbname = ""; } else { $dbpassword = $_POST["pass"]; $dbuser = $_POST["user"]; $dbhost = $_POST["host"]; + $dbname = $_POST["dbname"]; if (isset($_POST["url"])) $url = $_POST["url"]; else @@ -311,11 +320,11 @@ function install_step4() { } else { check_generic ( 1, "Connection with Database"); // Create schema - $step1 = mysql_query ("CREATE DATABASE $db_name"); - check_generic ($step1, "Creating database '$db_name'"); + $step1 = mysql_query ("CREATE DATABASE $dbname"); + check_generic ($step1, "Creating database '$dbname'"); if ($step1 == 1){ - $step2 = mysql_select_db($db_name); - check_generic ($step2, "Opening database '$db_name'"); + $step2 = mysql_select_db($dbname); + check_generic ($step2, "Opening database '$dbname'"); $step3 = parse_mysql_dump("pandoradb.sql"); check_generic ($step3, "Creating schema"); @@ -324,9 +333,9 @@ function install_step4() { check_generic ($step4, "Populating database"); $random_password = random_name (8); - $step5 = mysql_query ("GRANT ALL PRIVILEGES ON $db_name.* to pandora@localhost IDENTIFIED BY '".$random_password."'"); + $step5 = mysql_query ("GRANT ALL PRIVILEGES ON $dbname.* to pandora@localhost IDENTIFIED BY '".$random_password."'"); mysql_query ("FLUSH PRIVILEGES"); - check_generic ($step5, "Established privileges for user pandora"); + check_generic ($step5, "Established privileges for user pandora
      password '$random_password'"); $step6 = is_writable("include"); check_generic ($step6, "Write permissions to save config file in './include'"); @@ -337,7 +346,7 @@ function install_step4() { $config_new = '"; } else { - echo " You get some problems. Installation is not completed. + echo " You get some problems. Installation is not completed.

Please correct failures before trying again. All database schemes created in this step have been dropped.

"; if (mysql_error() != "") - echo "

ERROR: ". mysql_error()."

"; + echo "

ERROR: ". mysql_error()."

"; - mysql_query ("DROP DATABASE $db_name"); + mysql_query ("DROP DATABASE $dbname"); } echo " @@ -394,7 +403,7 @@ function install_step5() {

Installation complete

-

You now must delete manually this installer for security, ('install.php') and rename your new config file '".$pandora_config."' to 'config.php' before trying to access to your Pandora FMS console. +

You now must delete manually this installer for security, ('install.php') before trying to access to your Pandora FMS console.

Don't forget to check http://pandora.sourceforge.net for updates.

Click here to access to your Pandora FMS console

@@ -412,6 +421,11 @@ function install_step5() {
"; } + +// --------------- +// Main page code +// --------------- + if (! isset($_GET["step"])){ install_step1(); } else { @@ -428,4 +442,4 @@ if (! isset($_GET["step"])){ } } -?> \ No newline at end of file +?> diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 8dd918be13..d1316f743b 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -101,7 +101,7 @@ if (comprueba_login() == 0) { echo ' '.salida_limpia($lang_label["group"]).' -    '.dame_grupo($id_grupo).'
'.dame_grupo($id_group).''; +    '.dame_grupo($id_grupo).'
'.dame_grupo($id_grupo).''; if ($agent_type == 0) { echo ''.$lang_label["agentversion"].' '.salida_limpia($agent_version).''; diff --git a/pandora_console/operation/agentes/estado_grupo.php b/pandora_console/operation/agentes/estado_grupo.php index b79dbb8359..48f785322f 100644 --- a/pandora_console/operation/agentes/estado_grupo.php +++ b/pandora_console/operation/agentes/estado_grupo.php @@ -24,6 +24,9 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Load global vars require("include/config.php"); + + if (! isset($config_show_lastalerts)) + $config_show_lastalerts=1; if (give_acl ($id_user, 0, "AR") != 1) { audit_db ($id_user, $REMOTE_ADDR, "ACL Violation", diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index e4dafa7181..dfcd0b9781 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -176,11 +176,11 @@ if (comprueba_login() == 0) { else echo substr($row3["datos"],0,12); - $handle = "stat".$nombre_tipo_modulo."_".$nombre_agente; - $url = 'reporting/procesos.php?agente='.$nombre_agente; - $win_handle=dechex(crc32($nombre_agente.$row3["nombre"])); + $handle = "stat".$nombre_tipo_modulo."_".$row3["id_agente_modulo"]; + $url = 'reporting/procesos.php?agente='.$row3["id_agente_modulo"]; + $win_handle=dechex(crc32($row3["id_agente_modulo"].$row3["nombre"])); echo ""; - $graph_label = entrada_limpia($row3["nombre"]." - ".$nombre_agente); + $graph_label = entrada_limpia($row3["nombre"]." - ".$row3["id_agente_modulo"]); echo " "; diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php index 04c45c6212..6516080652 100644 --- a/pandora_console/operation/servers/view_server.php +++ b/pandora_console/operation/servers/view_server.php @@ -29,8 +29,8 @@ if (comprueba_login() == 0) { $sql='SELECT * FROM tserver'; - echo "

".$lang_label["view_servers"]."

"; - echo "

".$lang_label["server_detail"]." ".$lang_label["help"]."

"; + echo "

".$lang_label["view_servers"]." -> "; + echo $lang_label["server_detail"]."  ".$lang_label["help"]."

"; // Get total modules defined (network) $sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4'; @@ -40,9 +40,11 @@ if (comprueba_login() == 0) { // Get total modules defined (data) $sql1='SELECT COUNT(processed_by_server) FROM tagente_estado WHERE processed_by_server LIKE "%_Data" '; - $result1=mysql_query($sql1); - $row1=mysql_fetch_array($result1); - $total_modules_data = $row1[0]; + if ($result1=mysql_query($sql1)){ + $row1=mysql_fetch_array($result1); + $total_modules_data = $row1[0]; + } else + $total_modules_data = 0; // Connect DataBase $result=mysql_query($sql); @@ -122,7 +124,10 @@ if (comprueba_login() == 0) { if ($network_server == 1){ if ($total_modules == 0) $percentil = 0; - $percentil = $modules_server / ($total_modules / 100); + if ($total_modules > 0) + $percentil = $modules_server / ($total_modules / 100); + else + $percentil = 0; $total_modules_temp = $total_modules; } else { if ($total_modules_data == 0) @@ -168,15 +173,16 @@ if (comprueba_login() == 0) { // Get total modules defined for this server if (($network_server == 1) OR ($data_server == 1)){ $sql1 = "SELECT utimestamp, current_interval FROM tagente_estado WHERE processed_by_server = '$name' AND estado < 100"; - $result1=mysql_query($sql1); + $nowtime = time(); $maxlag=0; - while ($row1=mysql_fetch_array($result1)){ - if (($row1["utimestamp"] + $row1["current_interval"]) < $nowtime) - $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["current_interval"]); - if ($maxlag2 > $maxlag) - $maxlag = $maxlag2; - } + if ($result1=mysql_query($sql1)) + while ($row1=mysql_fetch_array($result1)){ + if (($row1["utimestamp"] + $row1["current_interval"]) < $nowtime) + $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["current_interval"]); + if ($maxlag2 > $maxlag) + $maxlag = $maxlag2; + } if ($maxlag < 60) echo $maxlag." sec"; elseif ($maxlag < 86400) diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 358975c739..7ac3151b8c 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -241,8 +241,7 @@ CREATE TABLE `tagente_modulo` ( `flag` tinyint(3) unsigned default '1', `id_modulo` int(11) unsigned NULL default 0, PRIMARY KEY (`id_agente_modulo`, `id_agente`), - KEY `tam_agente` (`id_agente`), - FOREIGN KEY (id_modulo) REFERENCES tmodule (id_module) + KEY `tam_agente` (`id_agente`) ) ENGINE=InnoDB; -- diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index f39e60a1fd..21fdc5b329 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -39,12 +39,12 @@ LOCK TABLES `tgrupo` WRITE; INSERT INTO `tgrupo` VALUES (1,'All','world',0); INSERT INTO `tgrupo` VALUES (2,'Servers','server_database',0); INSERT INTO `tgrupo` VALUES (3,'IDS','eye',0); -INSERT INTO `tgrupo` VALUES (4,'Firewalls','firewal',0); -INSERT INTO `tgrupo` VALUES (8,'Databases','db',0); -INSERT INTO `tgrupo` VALUES (9,'Comms','comms',0); -INSERT INTO `tgrupo` VALUES (10,'Others','others',0); -INSERT INTO `tgrupo` VALUES (11,'Workstations','workstation',0); -INSERT INTO `tgrupo` VALUES (12,'Applications','apps',0); +INSERT INTO `tgrupo` VALUES (4,'Firewalls','firewall',0); +INSERT INTO `tgrupo` VALUES (8,'Databases','database_gear',0); +INSERT INTO `tgrupo` VALUES (9,'Comms','transmit',0); +INSERT INTO `tgrupo` VALUES (10,'Others','house',0); +INSERT INTO `tgrupo` VALUES (11,'Workstations','computer',0); +INSERT INTO `tgrupo` VALUES (12,'Applications','bricks',0); UNLOCK TABLES; /*!40000 ALTER TABLE `tgrupo` ENABLE KEYS */; diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index 547433ba89..49b46b1709 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -554,7 +554,7 @@ function graphic_agentmodules($id_agent, $width, $height) { } - if ($cx > 1){ + if ($cx > 0){ // create the graph $Graph =& Image_Graph::factory('graph', array($width, $height)); // add a TrueType font