2007-04-10 Sancho Lerena <slerena@gmail.com>

* 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
This commit is contained in:
slerena 2007-04-11 03:12:48 +00:00
parent 52965464c8
commit 70e2f9d797
21 changed files with 374 additions and 277 deletions

View File

@ -1,3 +1,48 @@
2007-04-10 Sancho Lerena <slerena@gmail.com>
* 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 <raulofpandora@gmail.com>
* include/languages/language_en.php, language_es_es.php: Added text

View File

@ -71,6 +71,8 @@
echo "</td></tr></table>";
echo "</div>"; // 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,19 +80,41 @@
echo '<div style="margin-left: 8px">' . $lang_label["new_message_bra"];
echo '<b><a href="index.php?sec=messages&sec2=operation/messages/message">';
echo $row["COUNT(*)"] . '</b> <img src="images/mail.gif" border="0"></a>';
echo $lang_label["new_message_ket"] . '</div>';
echo $row["COUNT(*)"] . '</b> <img src="images/mail.gif" border="0">';
echo $lang_label["new_message_ket"] . '</a></div>';
}
// Site news !
echo '<h2>' . $lang_label["site_news"] . '</h2>';
echo '<table cellpadding="3" cellspacing="3" width="720"><tr>';
$sql_news = "SELECT * FROM tnews ORDER by utimestamp LIMIT 3";
$result_news = mysql_query ($sql_news);
while ($row = mysql_fetch_array ($result_news)) {
echo '<tr><th align="left">';
echo $lang_label["at"]. " <i>". $row["utimestamp"] ."</i> ".$lang_label["user"]. " <b>". $row["author"]."</b> ".$lang_label["says"].": \"<b>".$row["subject"]."\"</b>";
echo '<tr><td class=datos>';
echo clean_output_breaks($row["text"]);
echo '<td><td class=datos3">';
}
echo "</table>";
// Site stats
echo '<h2 class="mgb25">' . $lang_label["stat_title"] . '</h2>';
echo '<table cellpadding="3" cellspacing="3" width="500"><tr>';
$query1 = "SELECT COUNT(id_usuario) FROM tusuario";
$result = mysql_query ($query1);
$row = mysql_fetch_array ($result);
echo "<tr><td class=datos>";
echo '<span class="users">';
echo $lang_label["there_are"] ."<b>". $row[0] . '</b> ' . $lang_label["user_defined"];
echo '</span>';
echo "<tr><td class=datos>";
$query1 = "SELECT COUNT(id_agente) FROM tagente";
$result = mysql_query ($query1);
$row = mysql_fetch_array ($result);
@ -98,6 +122,7 @@
echo $lang_label["there_are"] . "<b>".$row[0]."</b> ". $lang_label["agent_defined"];
echo '</span>';
echo "<tr><td class=datos>";
$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"] . "<b>".$row[0] . '</b> ' . $lang_label["data_harvested"];
echo '</span>';
echo "<tr><td class=datos>";
$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"] . "<b>".$row[0] .'</b> ' . $lang_label["alert_defined"];
echo "</span>";
echo "<tr><td class=datos>";
echo '<span class="time">';
$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 '</span>';
echo "</table>";
echo '</div>'; // class "jus"
?>

View File

@ -117,13 +117,13 @@ if (isset($_POST["create_agent"])) { // Create a new and shining agent
}
// Show tabs
// ¯-----------------
// -----------------
echo "<div id='menu_tab_left'>
<ul class='mn'>
<li class='nomn'>";
echo "<li class='nomn'>";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'><img src='../images/bricks.png' class='top' border=0>&nbsp; ".dame_nombre_agente($id_agente)." - ".$lang_label["setup_mode"]."</A>";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'><img src='images/bricks.png' class='top' border=0>&nbsp; ".dame_nombre_agente($id_agente)." - ".$lang_label["setup_mode"]."</A>";
echo "</li>";
echo "</ul></div>";
@ -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();

View File

@ -194,21 +194,19 @@ if (mysql_num_rows($result)){
}
echo "<tr><td colspan='5'><div class='raya'></div></td></tr>";
echo "<tr><td align='right' colspan='5'>";
echo "<form method='post' action='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&create_agent=1'>";
echo "<input type='submit' class='sub next' name='crt'
value='".$lang_label["create_agent"]."'>";
echo "</form></td></tr>";
echo "</table>";
$endline = "</td></tr></table>";
} 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 "<div class='nf'>".$lang_label["no_agent_def"]."</div>";
echo "<form method='post' action='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&creacion=1'>";
sec2=godmode/agentes/configurar_agente&create_agent=1'>";
echo "<input type='submit' class='sub next' name='crt'
value='".$lang_label["create_agent"]."'>";
echo "</form>";
echo $endline;
}
?>

View File

@ -168,7 +168,7 @@ $result=mysql_query($sql1);
echo "<h2>".$lang_label["agent_conf"]." &gt; ".$lang_label["assigned_modules"]."
<a href='help/".$help_code."/chap3.php#321' target='_help' class='help'>
<span>".$lang_label["help"]."</span></a>";
echo "&nbsp;&nbsp;<a class='info' href='#module_assignment'> <span>".$lang_label["module_asociation_form"]."</span><img src='../images/wand.png'></a>";
echo "&nbsp;&nbsp;<a class='info' href='#module_assignment'> <span>".$lang_label["module_asociation_form"]."</span><img src='images/wand.png'></a>";
echo "</h2>";
if ($row=mysql_num_rows($result)){
echo '<table width="700" cellpadding="3" cellspacing="3" class="fon">';

View File

@ -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 "<div class='arrowgs'>";
else
echo "<div class='arrowg'>";

View File

@ -76,26 +76,25 @@ if (give_acl($id_user, 0, "PM")==1) {
$tdcolor = "datos2";
$color = 1;
}
if ($row["id_grupo"] != 1){
echo "
<tr>
<td class='$tdcolor' align='center'>
<img src='images/".$row["icon"]."'
border='0'>
</td>
<td class='$tdcolor'>
<b><a href='index.php?sec=gmodules&
sec2=godmode/modules/manage_modules&
id_module=".$row["id_tipo"]."'>".$row["nombre"]."</a>
</b></td>
<td class='$tdcolor'>
".give_modulecategory_name ($row["categoria"])."
</td>
<td class='$tdcolor'>
".$row["descripcion"]."
</td>
</tr>";
}
echo "
<tr>
<td class='$tdcolor' align='center'>
<img src='images/".$row["icon"]."'
border='0'>
</td>
<td class='$tdcolor'>
<b><a href='index.php?sec=gmodules&
sec2=godmode/modules/manage_modules&
id_module=".$row["id_tipo"]."'>".$row["nombre"]."</a>
</b></td>
<td class='$tdcolor'>
".give_modulecategory_name ($row["categoria"])."
</td>
<td class='$tdcolor'>
".$row["descripcion"]."
</td>
</tr>";
}
echo "<tr><td colspan='4'><div class='raya'></div></td></tr>";
echo "<tr><td colspan='4' align='right'>";

View File

@ -98,4 +98,3 @@ if ($language_code == 'ast_es') {
else $help_code = substr($language_code,0,2);
?>

View File

@ -1,19 +1,24 @@
<?php
<?PHP
// Begin of automatic config file
$dbname="pandora"; // MySQL DataBase name
$dbuser="pandora"; // DB User
$dbpassword="xviyvunu"; // DB Password
$dbhost="localhost"; // DB Host
$config_homedir="/var/www/pandora_console/"; // Config homedir
$BASE_URL="http://localhost/pandora_console"; // Base URL
// End of automatic config file
?><?php
// Pandora FMS - the Free monitoring system
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-2007 Sancho Lerena, slerena@openideas.info
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP additions
// Copyright (c) 2006-2007 Jose Navarro jose@jnavarro.net
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// Javascript Active Console code.
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// 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 ('<html><head><title>Pandora Error</title>
<link rel="stylesheet" href="./include/styles/pandora.css" type="text/css">
@ -65,43 +77,32 @@ if (! mysql_connect($dbhost,$dbuser,$dbpassword)){
</div>
</div></body></html>');
}
// 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);
?>

View File

@ -65,14 +65,12 @@ function salida_limpia ($string){
// after the initial translation, _do_ map standalone '&' into '&#38;'
return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&#38;" , strtr($string, $trans));
}
/*
{
$texto_ok = htmlspecialchars($texto, ENT_QUOTES, "ISO8859-15"); // Quitamos
// Reemplazamos retornos de carro por "<br>"
$texto_html = str_replace(chr(13),"<br>",$texto_ok);
return $texto_html;
function clean_output_breaks ($string){
$myoutput = salida_limpia($string);
return preg_replace ('/\n/',"<br>", $myoutput);
}
*/
// ---------------------------------------------------------------
// This function reads a string and returns it "clean"

View File

@ -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;
?>

View File

@ -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 {

View File

@ -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

View File

@ -34,46 +34,11 @@
<meta name="robots" content="index, follow">
<link rel="icon" href="images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="include/styles/pandora.css" type="text/css">
</head>
<body background='images/backgrounds/background11.jpg'>
</head><body background='images/backgrounds/background11.jpg'>
<?PHP
error_reporting(0);
function install_step1() {
echo "
<div align='center' class='mt35'>
<h1>Pandora FMS instalation wizard. Step #1 of 4</h1>
<div id='wizard' style='height: 300px;'>
<div id='install_box'>
<h1>Welcome to Pandora FMS installation Wizard</h1>
<p>This wizard helps you to quick install Pandora FMS console in your system.</p>
<p>In three steps checks all dependencies and make your configuration for a quick installation.</p>
<p>For more information, please refer to documentation.</p>
<i>Pandora FMS Development team</i>
";
if (file_exists("include/config.php")){
echo "<p><img src='images/info.gif'> Warning: You already have a config.php file. Configuracion and database would be overwritten if you continue.</p>";
}
echo "
</div>
<div class='box'>
<img src='images/logo_login.gif' border='0'><br>
</div>
<div class='box'>
<img src='images/step0.png' border='0'>
</div>
<div id='install_box' style='margin-bottom: 25px;margin-left: 25px;'>
<a href='install.php?step=2'><img align='right' src='images/arrow_next.png' border=0></a>
</div>
</div>
<div id='foot'>
<i>Pandora FMS is a Free Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
function check_extension ( $ext, $label ){
echo "<tr><td>";
echo "<img src='images/arrow.gif'> $label";
@ -152,100 +117,6 @@ function check_variable ( $var, $value, $label, $mode ){
echo "</td></tr>";
}
function install_step2() {
echo "
<div align='center' class='mt35'>
<h1>Pandora FMS console instalation wizard. Step #2 of 4</h1>
<div id='wizard' style='height: 250px;'>
<div id='install_box'>";
echo "<h1>Checking software dependencies</h1>";
echo "<table border=0 width=230>";
$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 "</table>
</div>
<div class='box'>
<img src='images/logo_login.gif' border='0'' alt=''>
</div>
<div class='box'>
<img src='images/step1.png' border='0' alt=''>
</div>
<div id='install_box' style='margin-bottom: 25px;margin-left: 25px;'>";
if ($res > 0) {
echo "<p><img src='images/info.gif'> You have some uncomplete
dependencies. Please correct it or this installer
could not finish your installation.
</p>
Ignore it. <a href='install.php?step=3'>Force install Step #3</a>";
} else {
echo "<a href='install.php?step=3'><img align='right' src='images/arrow_next.png' border=0 alt=''></a>";
}
echo "
</div>
</div>
</div>
<div id='foot'>";
echo '<i>Pandora FMS is a Free Software project registered at <a target="_new" href="http://pandora.sourceforge.net">SourceForge</a></i>';
echo "</div></div>";
}
function install_step3() {
echo "
<div align='center' class='mt35'>
<h1>Pandora FMS console instalation wizard. Step #3 of 4 </h1>
<div id='wizard' style='height: 500px;'>
<div id='install_box'>
<h1>Environment and database setup</h1>
<p>
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 <i>root</i> user will not be used or stored for anymore.
</p>
<p>
Now, please, complete all details to configure your database and enviroment setup
</p>
<form method='post' action='install.php?step=4'>
<div>DB User with privileges on MySQL</div>
<input class='login' type='text' name='user' value=''>
<div>DB Password for this user</div>
<input class='login' type='passwordzx' name='pass' value=''>
<div>DB Hostname of MySQL</div>
<input class='login' type='text' name='host' value=''>
<div>Full path to HTTP publication directory.<br>
<span class='f9b'>For example /srv/www/hdtocs/</span>
</div>
<input class='login' type='text' name='path' style='width: 190px;' value=''>
<div>Full local URL to Pandora FMS Console. <br>
<span class='f9b'>For example http://localhost/pandora_console</span>
</div>
<input class='login' type='text' name='url' style='width: 250px;' value=''>
<div><input align='right' style='align: right; width:70px; height: 16px;' type='image' src='images/arrow_next.png' value='Step #4'></div>
</form>
</div>
<div class='box'>
<img src='images/logo_login.gif' border='0' alt=''>
</div>
<div class='box'>
<img src='images/step2.png' border='0' alt=''>
</div>
</div>
<div id='foot'>
<i>Pandora FMS is a Free Software project registered at
<a target='_ne' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
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 "
<div align='center' class='mt35'>
<h1>Pandora FMS instalation wizard. Step #1 of 4</h1>
<div id='wizard' style='height: 310px;'>
<div id='install_box'>
<h1>Welcome to Pandora FMS installation Wizard</h1>
<p>This wizard helps you to quick install Pandora FMS console in your system.</p>
<p>In three steps checks all dependencies and make your configuration for a quick installation.</p>
<p>For more information, please refer to documentation.</p>
<i>Pandora FMS Development team</i>
";
if (file_exists("include/config.php")){
echo "<p><img src='images/info.png' valign='bottom'><b> Warning: You already have a config.php file. Configuracion and database would be overwritten if you continue.</b></p>";
}
echo "
</div>
<div class='box'>
<img src='images/logo_login.gif' border='0'><br>
</div>
<div class='box'>
<img src='images/step0.png' border='0'>
</div>
<div id='install_box' style='margin-bottom: 25px;margin-left: 25px;'>
<a href='install.php?step=2'><img align='right' src='images/arrow_next.png' border=0></a>
</div>
</div>
<div id='foot'>
<i>Pandora FMS is a Free Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
function install_step2() {
echo "
<div align='center' class='mt35'>
<h1>Pandora FMS console instalation wizard. Step #2 of 4</h1>
<div id='wizard' style='height: 250px;'>
<div id='install_box'>";
echo "<h1>Checking software dependencies</h1>";
echo "<table border=0 width=230>";
$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 "</table>
</div>
<div class='box'>
<img src='images/logo_login.gif' border='0'' alt=''>
</div>
<div class='box'>
<img src='images/step1.png' border='0' alt=''>
</div>
<div id='install_box' style='margin-bottom: 25px;margin-left: 25px;'>";
if ($res > 0) {
echo "<p><img src='images/info.png'> You have some uncomplete
dependencies. Please correct it or this installer
could not finish your installation.
</p>
Ignore it. <a href='install.php?step=3'>Force install Step #3</a>";
} else {
echo "<a href='install.php?step=3'><img align='right' src='images/arrow_next.png' border=0 alt=''></a>";
}
echo "
</div>
</div>
</div>
<div id='foot'>";
echo '<i>Pandora FMS is a Free Software project registered at <a target="_new" href="http://pandora.sourceforge.net">SourceForge</a></i>';
echo "</div></div>";
}
function install_step3() {
echo "
<div align='center' class='mt35'>
<h1>Pandora FMS console instalation wizard. Step #3 of 4 </h1>
<div id='wizard' style='height: 540px;'>
<div id='install_box'>
<h1>Environment and database setup</h1>
<p>
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 <i>root</i> user will not be used or stored for anymore.
</p>
<p>
Now, please, complete all details to configure your database and enviroment setup. <b>NOTICE</b> that database will be destroyed if already exists!.
</p>
<form method='post' action='install.php?step=4'>
<div>DB User with privileges on MySQL</div>
<input class='login' type='text' name='user' value='root'>
<div>DB Password for this user</div>
<input class='login' type='passwordzx' name='pass' value=''>
<div>DB Hostname of MySQL</div>
<input class='login' type='text' name='host' value='localhost'>
<div>DB Name (pandora by default)</div>
<input class='login' type='text' name='dbname' value='pandora'>
<div>Full path to HTTP publication directory.<br>
<span class='f9b'>For example /var/www/pandora_console/</span>
</div>
<input class='login' type='text' name='path' style='width: 190px;' value='/var/www/pandora_console/'>
<div>Full local URL to Pandora FMS Console. <br>
<span class='f9b'>For example http://localhost/pandora_console</span>
</div>
<input class='login' type='text' name='url' style='width: 250px;' value='http://localhost/pandora_console'>
<div><input align='right' style='align: right; width:70px; height: 16px;' type='image' src='images/arrow_next.png' value='Step #4'></div>
</form>
</div>
<div class='box'>
<img src='images/logo_login.gif' border='0' alt=''>
</div>
<div class='box'>
<img src='images/step2.png' border='0' alt=''>
</div>
</div>
<div id='foot'>
<i>Pandora FMS is a Free Software project registered at
<a target='_ne' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
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 <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;password <i>'$random_password'</i>");
$step6 = is_writable("include");
check_generic ($step6, "Write permissions to save config file in './include'");
@ -337,7 +346,7 @@ function install_step4() {
$config_new = '<?PHP
// Begin of automatic config file
$dbname="'.$db_name.'"; // MySQL DataBase name
$dbname="'.$dbname.'"; // MySQL DataBase name
$dbuser="pandora"; // DB User
$dbpassword="'.$random_password.'"; // DB Password
$dbhost="'.$dbhost.'"; // DB Host
@ -369,13 +378,13 @@ $BASE_URL="'.$url.'"; // Base URL
if ($everything_ok == 1) {
echo "<a href='install.php?step=5'><img align='right' src='images/arrow_next.png' border=0 class=''></a>";
} else {
echo "<img src='images/info.gif'> You get some problems. Installation is not completed.
echo "<img src='images/info.png'> You get some problems. Installation is not completed.
<p>Please correct failures before trying again. All database schemes created in this step have been dropped.</p>";
if (mysql_error() != "")
echo "<p><img src='images/info.gif'> <b>ERROR:</b> ". mysql_error()."</p>";
echo "<p><img src='images/info.png'> <b>ERROR:</b> ". mysql_error()."</p>";
mysql_query ("DROP DATABASE $db_name");
mysql_query ("DROP DATABASE $dbname");
}
echo "
</div>
@ -394,7 +403,7 @@ function install_step5() {
<div id='wizard' style='height: 300px;'>
<div id='install_box'>
<h1>Installation complete</h1>
<p>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.
<p>You now must delete manually this installer for security, ('install.php') before trying to access to your Pandora FMS console.
<p>Don't forget to check <a href='http://pandora.sourceforge.net'>http://pandora.sourceforge.net</a> for updates.
<p><a href='index.php'>Click here to access to your Pandora FMS console</A></p>
</div>
@ -412,6 +421,11 @@ function install_step5() {
</div>";
}
// ---------------
// Main page code
// ---------------
if (! isset($_GET["step"])){
install_step1();
} else {

View File

@ -101,7 +101,7 @@ if (comprueba_login() == 0) {
echo '<tr>
<td class="datos2"><b>'.salida_limpia($lang_label["group"]).'</b></td>
<td class="datos2" colspan="2">
<img class="bot" src="images/groups_small/'.show_icon_group($row["id_grupo"]).'.png" >&nbsp;&nbsp; '.dame_grupo($id_grupo).'<br>'.dame_grupo($id_group).'</td></tr>';
<img class="bot" src="images/groups_small/'.show_icon_group($row["id_grupo"]).'.png" >&nbsp;&nbsp; '.dame_grupo($id_grupo).'<br>'.dame_grupo($id_grupo).'</td></tr>';
if ($agent_type == 0) {
echo '<tr><td class="datos"><b>'.$lang_label["agentversion"].'</b>
<td class="datos" colspan=2>'.salida_limpia($agent_version).'</td>';

View File

@ -25,6 +25,9 @@
// 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",
"Trying to access Agent view (Grouped)");

View File

@ -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 "<td class=".$tdcolor." width='78'>";
$graph_label = entrada_limpia($row3["nombre"]." - ".$nombre_agente);
$graph_label = entrada_limpia($row3["nombre"]." - ".$row3["id_agente_modulo"]);
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?period=2419200&id=".$row3["id_agente_modulo"]."&label=".$graph_label."refresh=180000\", \"month_".$win_handle."\")'><img src='images/grafica_m.gif' border=0></a>&nbsp;";

View File

@ -29,8 +29,8 @@ if (comprueba_login() == 0) {
$sql='SELECT * FROM tserver';
echo "<h2>".$lang_label["view_servers"]."</h2>";
echo "<h3>".$lang_label["server_detail"]."<a href='help/".$help_code."/chap7.php#7' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h3>";
echo "<h2>".$lang_label["view_servers"]." -&gt; ";
echo $lang_label["server_detail"]." <a href='help/".$help_code."/chap7.php#7' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h2>";
// 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)

View File

@ -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;
--

View File

@ -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 */;

View File

@ -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