2007-08-09 Sancho Lerena <slerena@artica.es>

* upgrade_from_1.2.php, pandoradbdata_12_to_13.sql,
        pandoradb_12_to_13.sql, migrate.php: Migration scripts and wizard
        (DO NOT USE YET!). Not finished.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@597 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-08-09 19:15:09 +00:00
parent d5afeab484
commit df2a3abcf4
5 changed files with 777 additions and 6 deletions

View File

@ -1,17 +1,25 @@
2007-08-09 Sancho Lerena <slerena@artica.es>
* upgrade_from_1.2.php, pandoradbdata_12_to_13.sql,
pandoradb_12_to_13.sql, migrate.php: Migration scripts and wizard
(DO NOT USE YET!). Not finished.
2007-08-08 Sancho Lerena <slerena@gmail.com>
* reporting/stat_win.php, general/noaccess.php: Fixed problem with
paths outside index.php call.
paths outside index.php call.
* index.php: Some fixes in checks for problems in startup and needed files.
* index.php: Some fixes in checks for problems in startup and
needed files.
* general/*: Better layout of problems, some minimal fixes. New file added to
warn user of missed config.php file. Better treatment of fails.
* general/*: Better layout of problems, some minimal fixes. New
file added to warn user of missed config.php file. Better
treatment of fails.
2007-08-06 Sancho Lerena <slerena@gmail.com>
* pandoradb.sql, alert_manager.php: Alert time support uses TIME format
instead numeric (changes requested by esanchezm).
* pandoradb.sql, alert_manager.php: Alert time support uses TIME
format instead numeric (changes requested by esanchezm).
2007-08-06 Sancho Lerena <slerena@artica.es>

464
pandora_console/migrate.php Normal file
View File

@ -0,0 +1,464 @@
<?php
// Pandora FMS - the Free monitoring system
// ========================================
// 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
// Copyright (c) 2006-2007 Jose Navarro jose@jnavarro.net
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// 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
// 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.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pandora FMS - Installation Wizard</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Sancho Lerena, Raul Mateos">
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and others">
<meta name="keywords" content="pandora, fms, monitoring, network, system, GPL, software">
<meta name="robots" content="index, follow">
<link rel="icon" href="images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="include/styles/pandora_minimal.css" type="text/css">
<link rel="stylesheet" href="include/styles/install.css" type="text/css">
</head>
<body>
<?php
error_reporting(0);
function check_extension ( $ext, $label ){
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if (!extension_loaded($ext)){
echo "<img src='images/dot_red.png'>";
return 1;
} else {
echo "<img src='images/dot_green.png'>";
return 0;
}
echo "</td></tr>";
}
function check_include ( $ext, $label ){
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if (!include($ext)){
echo "<img src='images/dot_red.png'>";
return 1;
} else {
echo "<img src='images/dot_green.png'>";
return 0;
}
echo "</td></tr>";
}
function check_exists ( $file, $label ){
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if (!file_exists ($file)){
echo " <img src='images/dot_red.png'>";
return 1;
} else {
echo " <img src='images/dot_green.png'>";
return 0;
}
echo "</td></tr>";
}
function check_generic ( $ok, $label ){
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if ($ok == 0 ){
echo " <img src='images/dot_red.png'>";
return 1;
} else {
echo " <img src='images/dot_green.png'>";
return 0;
}
echo "</td></tr>";
}
function check_variable ( $var, $value, $label, $mode ){
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
if ($mode == 1){
if ($var >= $value){
echo " <img src='images/dot_green.png'>";
return 0;
} else {
echo " <img src='images/dot_red.png'>";
return 1;
}
} elseif ($var == $value){
echo " <img src='images/dot_green.png'>";
return 0;
} else {
echo " <img src='images/dot_red.png'>";
return 1;
}
echo "</td></tr>";
}
function parse_mysql_dump($url){
if (file_exists($url)){
$file_content = file($url);
$query = "";
foreach($file_content as $sql_line){
if(trim($sql_line) != "" && strpos($sql_line, "--") === false){
$query .= $sql_line;
if(preg_match("/;[\040]*\$/", $sql_line)){
if (!$result = mysql_query($query))
return 0;
$query = "";
}
}
}
return 1;
} else {
return 0;
}
}
function random_name ($size){
$temp = "";
for ($a=0;$a< $size;$a++)
$temp = $temp. chr(rand(122,97));
return $temp;
}
function install_step1() {
echo "
<div id='install_container'>
<h1>Pandora FMS migration wizard. Step #1 of 4</h1>
<div id='wizard' style='height: 330px;'>
<div id='install_box'>
<h1>Welcome to Pandora FMS 1.3 migration Wizard</h1>
<p>This wizard helps you to quick migrate Pandora FMS console in your system.</p>
<p>This tool is <b>only</b> to migrate Pandora FMS 1.2 to Pandora FMS 1.3</p>
<p>For more information, please refer to documentation.</p>
<i>Pandora FMS Development Team</i>
";
if (file_exists("include/config.php")){
echo "<div class='warn'><b>Warning:</b> You already have a config.php file in this directory, please backup and move it before continue.</div>";
}
echo "<div class='warn'><b>Warning:</b> This installer will <b>overwrite and change</b> your existing Pandora FMS <b>Database</b> and cannot be used by Pandora FMS 1.2, only for 1.3 version. Before contine, please <b>be sure that you have made a SQL backup using mysqldump system tool.</b><br></div>";
echo "
</div>
<div id='logo_img'>
<img src='images/pandora_logo.png' border='0'><br>
<img src='images/step0.png' border='0'>
</div>
<div id='install_img'>
<a href='install.php?step=2'><img align='right' src='images/arrow_next.png' border=0></a>
</div>
</div>
<div id='foot_install'>
<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 id='install_container'>
<h1>Pandora FMS console migration wizard. Step #2 of 4</h1>
<div id='wizard' style='height: 300px;'>
<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 SNMP extension");
$res += check_extension("session","PHP session extension");
$res += check_include("PEAR.php","PEAR PHP Library");
$step6 = is_writable("include");
check_generic ($step6, "Write permissions to save config file in './include'");
$res += $step6;
//$res += check_exists ("/usr/bin/pdflatex","PDF Latex in /usr/bin/pdflatex");
echo "</table>
</div>
<div id='logo_img'>
<img src='images/pandora_logo.png' border='0'' alt=''><br>
<img src='images/step1.png' border='0' alt=''>
</div>
<div id='install_img'>";
if ($res > 0) {
echo "<div class='warn'>You have some uncomplete
dependencies. Please correct them or this installer
will not be able to finish your installation.
</div>
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 id='foot_install'>
<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_step3() {
echo "
<div id='install_container'>
<h1>Pandora FMS console migration wizard. Step #3 of 4 </h1>
<div id='wizard' style='height: 580px;'>
<div id='install_box'>
<h1>Environment and database setup</h1>
<p>
This wizard will transform your Pandora FMS database, and populate it with all the data needed to run for the first time, modifyng existing data to be used by the new version.
</p>
<p>
You need a user to modify and create database schema, this is usually the existant <b>pandora</b> user.
</p>
<p>
Now, please, complete all details to configure your database and enviroment setup.
</p>";
echo "<div class='warn'><b>Warning:</b> This installer will <b>overwrite and change</b> your existing Pandora FMS <b>Database</b> and cannot be used by Pandora FMS 1.2, only for 1.3 version. Before contine, please <b>be sure that you have made a SQL backup using mysqldump system tool.</b><br></div>";
echo "<form method='post' action='migrate.php?step=4'>
<div>DB User with privileges on MySQL</div>
<input class='login' type='text' name='user' value='pandora'>
<div>DB Password for this user</div>
<input class='login' type='password' 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/. Needed for graphs and attachments.</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 align='right'><input type='image' src='images/arrow_next.png' value='Step #4' id='step4'></div>
</form>
</div>
<div id='logo_img'>
<img src='images/pandora_logo.png' border='0' alt=''><br>
<img src='images/step2.png' border='0' alt=''>
</div>
</div>
<div id='foot_install'>
<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_step4() {
$pandora_config = "include/config.php";
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
$url = "http://localhost";
if (isset($_POST["path"]))
$path = $_POST["path"];
else
$path = "/var/www";
}
$everything_ok = 0;
$step1=0;
$step2=0;
$step3=0;
$step4=0; $step5=0; $step6=0; $step7=0;
echo "
<div id='install_container'>
<h1>Pandora FMS Console migration wizard. Step #4 of 4</h1>
<div id='wizard' style='height: 350px;'>
<div id='install_box'>
<h1>Modifing database schema structure and converting data (this could be a long time...)</h1>
<table>";
if (! mysql_connect ($dbhost,$dbuser,$dbpassword)) {
check_generic ( 0, "Connection with Database");
} else {
check_generic ( 1, "Connection with Database");
// Create schema
$step1 = mysql_query ("connect $dbname");
check_generic ($step1, "Connecting database '$dbname'");
if ($step1 == 1){
$step2 = mysql_select_db($dbname);
check_generic ($step2, "Opening database '$dbname'");
flush();
$step3 = parse_mysql_dump("pandoradb_12_to_13.sql");
check_generic ($step3, "Schema manipulation");
flush();
$step4 = parse_mysql_dump("pandoradb_data_12_to_13.sql");
check_generic ($step4, "Populating new schema and converting data");
flush();
$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="'.$dbuser.'"; // DB User
$dbpassword="'.$dbpassword.'"; // DB Password
$dbhost="'.$dbhost.'"; // DB Host
$config_homedir="'.$path.'"; // Config homedir
$BASE_URL="'.$url.'"; // Base URL
// End of automatic config file
?>';
$step7 = fputs ($cfgout, $config_new);
$step7 = $step7 + fputs ($cfgout, $config_contents);
if ($step7 > 0)
$step7 = 1;
fclose ($cfgin);
fclose ($cfgout);
chmod ($pandora_config, 0600);
check_generic ($step7, "Created new config file at '".$pandora_config."'");
}
}
if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) {
$everything_ok = 1;
}
echo "</table></div>
<div id='logo_img'>
<img src='images/pandora_logo.png' border='0' alt=''><br>
<img src='images/step3.png' border='0' alt=''>
</div>
<div id='install_img'>";
if ($everything_ok == 1) {
echo "<br><br><a href='install.php?step=5'><img align='right' src='images/arrow_next.png' border=0 class=''></a>";
} else {
echo "<div class='warn'><b>There was some problems. Installation is not completed.</b>
<p>Please correct failures before trying again.
All database schemes created in this step have been dropped.</p></div>";
if (mysql_error() != "")
echo "<div class='warn'> <b>ERROR:</b> ". mysql_error().".</div>";
mysql_query ("DROP DATABASE $dbname");
}
echo "
</div>
</div>
<div id='foot_install'>
<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_step5() {
echo "
<div id='install_container'>
<h1>Pandora FMS console migration wizard. Finished</h1>
<div id='wizard' style='height: 300px;'>
<div id='install_box'>
<h1>Data conversion</h1>
<p>This step could be very long in time, so please be patieng</p>
</div>";
// PROCESAR upgrade_from_1.2.php
echo "<div id='logo_img'>
<img src='images/pandora_logo.png' border='0'><br>
<img src='images/step4.png' border='0'><br>
</div>
</div>
<div id='foot_install'>
<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_step6() {
echo "
<div id='install_container'>
<h1>Pandora FMS console installation wizard. Finished</h1>
<div id='wizard' style='height: 300px;'>
<div id='install_box'>
<h1>Installation complete</h1>
<p>You now must delete manually this installer ('<i>install.php</i>') file for security 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>
<div id='logo_img'>
<img src='images/pandora_logo.png' border='0'><br>
<img src='images/step4.png' border='0'><br>
</div>
</div>
<div id='foot_install'>
<i>Pandora FMS is a Free Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
</div>
</div>";
}
// ---------------
// Main page code
// ---------------
if (! isset($_GET["step"])){
install_step1();
} else {
$step = $_GET["step"];
switch ($step) {
case 2: install_step2();
break;
case 3: install_step3();
break;
case 4: install_step4();
break;
case 5: install_step5();
break;
}
}
?>
</body>
</html>

View File

@ -0,0 +1,203 @@
ALTER TABLE tagent_access ADD column `utimestamp` bigint(20) NOT NULL default '0';
ALTER TABLE tagente_datos MODIFY COLUMN `id_agente` mediumint(8) unsigned NOT NULL default '0';
ALTER TABLE tagente_datos ADD column `utimestamp` int(10) unsigned default '0';
ALTER TABLE tagente_datos DROP key data_index_2;
ALTER TABLE tagente_datos DROP key data_index_3;
ALTER TABLE tagente_datos DROP key data_index_1;
ALTER TABLE tagente_datos ADD KEY `data_index2` (`id_agente`,`id_agente_modulo`);
ALTER TABLE tagente_datos_inc ADD column `utimestamp` int(10) unsigned default '0';
ALTER TABLE tagente_datos_string ADD column `utimestamp` int(10) unsigned default '0';
ALTER TABLE tagente_datos_string DROP KEY `data_string_index_3`;
ALTER TABLE tagente_estado ADD column `utimestamp` bigint(20) NOT NULL default '0';
ALTER TABLE tagente_estado ADD column `current_interval` int(10) unsigned NOT NULL default '0';
ALTER TABLE tagente_estado ADD column `running_by` int(10) unsigned NULL default 0;
ALTER TABLE tagente_estado ADD column `last_execution_try` bigint(20) NOT NULL default '0';
ALTER TABLE tagente_modulo MODIFY COLUMN `flag` tinyint(3) unsigned default '1';
ALTER TABLE tagente_modulo ADD COLUMN `id_modulo` int(11) unsigned NULL default 0;
ALTER TABLE tagente_modulo ADD KEY `tam_agente` (`id_agente`);
ALTER TABLE talerta_agente_modulo ADD COLUMN `alert_text` varchar(255) default '';
ALTER TABLE talerta_agente_modulo ADD COLUMN `disable` int(4) default '0';
ALTER TABLE talerta_agente_modulo ADD COLUMN `time_from` TIME default '00:00:00';
ALTER TABLE talerta_agente_modulo ADD COLUMN `time_to` TIME default '00:00:00';
ALTER TABLE talerta_agente_modulo MODIFY COLUMN `dis_max` double(18,2) default NULL;
ALTER TABLE talerta_agente_modulo MODIFY COLUMN `dis_min` double(18,2) default NULL;
ALTER TABLE tagente_modulo ADD COLUMN `alert_text` varchar(255) default '';
ALTER TABLE tagente_modulo ADD COLUMN `disable` int(4) default '0';
ALTER TABLE tagente_modulo ADD COLUMN `time_from` int(8) default '0';
ALTER TABLE tagente_modulo ADD COLUMN `time_to` int(8) default '0';
ALTER TABLE `tagente_modulo` DROP PRIMARY KEY ,
ADD PRIMARY KEY ( `id_agente_modulo` , `id_agente` )
ALTER TABLE tevento ADD COLUMN `utimestamp` bigint(20) unsigned NOT NULL default '0';
ALTER TABLE tgrupo ADD COLUMN `parent` tinyint(4) NOT NULL default '-1';
ALTER TABLE tgrupo ADD COLUMN `disabled` tinyint(4) NOT NULL default '0';
ALTER TABLE tincidencia ADD COLUMN `notify_email` TINYINT UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE tlanguage MODIFY COLUMN `name` varchar(100) NOT NULL default '';
ALTER TABLE tserver ADD COLUMN `recon_server` tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE tserver ADD COLUMN `version` varchar(20) NOT NULL default '';
ALTER TABLE tsesion ADD COLUMN `utimestamp` bigint(20) unsigned NOT NULL default '0';
CREATE TABLE `taddress` (
`id_a` bigint(20) unsigned NOT NULL auto_increment,
`ip` varchar(15) NOT NULL default '',
`ip_pack` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id_a`)
) ENGINE=InnoDB;
CREATE TABLE `taddress_agent` (
`id_ag` bigint(20) unsigned NOT NULL auto_increment,
`id_a` bigint(20) unsigned NOT NULL default '0',
`id_agent` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`id_ag`)
) ENGINE=InnoDB;
CREATE TABLE `tmodule` (
`id_module` int(11) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id_module`)
) ENGINE=InnoDB;
CREATE TABLE `tnetwork_component` (
`id_nc` mediumint(12) unsigned NOT NULL auto_increment,
`name` varchar(50) NOT NULL,
`description` varchar(250) default NULL,
`id_group` mediumint(9) NOT NULL default '1',
`type` smallint(6) NOT NULL default '6',
`max` bigint(20) NOT NULL default '0',
`min` bigint(20) NOT NULL default '0',
`module_interval` mediumint(8) unsigned NOT NULL default '0',
`tcp_port` int(10) unsigned NOT NULL default '0',
`tcp_send` varchar(250) NOT NULL,
`tcp_rcv` varchar(250) NOT NULL default 'NULL',
`snmp_community` varchar(250) NOT NULL default 'NULL',
`snmp_oid` blob NOT NULL,
`id_module_group` tinyint(4) NOT NULL default '0',
PRIMARY KEY (`id_nc`)
) ENGINE=InnoDB;
CREATE TABLE `tnetwork_component_group` (
`id_sg` mediumint(8) unsigned NOT NULL auto_increment,
`name` varchar(200) NOT NULL default '',
`parent` mediumint(9) NOT NULL default '0',
PRIMARY KEY (`id_sg`)
) ENGINE=InnoDB;
CREATE TABLE `tnetwork_profile` (
`id_np` mediumint(8) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`description` varchar(250) default '',
PRIMARY KEY (`id_np`)
) ENGINE=InnoDB;
CREATE TABLE `tnetwork_profile_component` (
`id_npc` mediumint(8) unsigned NOT NULL auto_increment,
`id_nc` mediumint(8) unsigned NOT NULL default '0',
`id_np` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`id_npc`)
) ENGINE=InnoDB;
CREATE TABLE `trecon_task` (
`id_rt` int(10) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`description` varchar(250) NOT NULL default '',
`type` tinyint(3) unsigned NOT NULL default '0',
`subnet` varchar(64) NOT NULL default '',
`id_network_server` int(10) unsigned NOT NULL default '0',
`id_network_profile` int(10) unsigned NOT NULL default '0',
`create_incident` tinyint(3) unsigned NOT NULL default '0',
`id_group` int(10) unsigned NOT NULL default '1',
`utimestamp` bigint(20) unsigned NOT NULL default '0',
`status` tinyint(4) NOT NULL default '0',
`interval_sweep` int(10) unsigned NOT NULL default '0',
`id_network_server_assigned` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id_rt`)
) ENGINE=InnoDB;
CREATE TABLE `tnews` (
`id_news` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`author` varchar(255) NOT NULL DEFAULT '',
`subject` varchar(255) NOT NULL DEFAULT '',
`text` TEXT NOT NULL,
`timestamp` DATETIME NOT NULL DEFAULT 0,
PRIMARY KEY(`id_news`)
) ENGINE = InnoDB;
CREATE TABLE `tgraph` (
`id_graph` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_user` varchar(100) NOT NULL default '',
`name` varchar(150) NOT NULL default '',
`description` TEXT NOT NULL,
`period` int(11) NOT NULL default '0',
`width` smallint(5) UNSIGNED NOT NULL DEFAULT 0,
`height` smallint(5) UNSIGNED NOT NULL DEFAULT 0,
`private` tinyint(1) UNSIGNED NOT NULL default 0,
`events` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_graph`)
) ENGINE = InnoDB;
CREATE TABLE `tgraph_source` (
`id_gs` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_graph` int(11) NOT NULL default 0,
`id_agent_module` int(11) NOT NULL default 0,
`weight` smallint(5) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(`id_gs`)
) ENGINE = InnoDB;
CREATE TABLE `treport` (
`id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_user` varchar(100) NOT NULL default '',
`name` varchar(150) NOT NULL default '',
`description` TEXT NOT NULL,
`private` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_report`)
) ENGINE = InnoDB;
CREATE TABLE `treport_content` (
`id_rc` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_report` INTEGER UNSIGNED NOT NULL default 0,
`id_gs` INTEGER UNSIGNED NOT NULL default 0,
`id_agent_module` int(11) NOT NULL default 0,
`type` tinyint(1) UNSIGNED NOT NULL default 0,
`period` int(11) NOT NULL default 0,
`sla_max` int(11) NOT NULL default 0,
`sla_min` int(11) NOT NULL default 0,
`sla_limit` int(11) NOT NULL default 0,
PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB;
CREATE TABLE `tlayout` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL,
`fullscreen` tinyint(1) UNSIGNED NOT NULL default 0,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB;
CREATE TABLE `tlayout_data` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_layout` INTEGER UNSIGNED NOT NULL default 0,
`pos_x` INTEGER UNSIGNED NOT NULL default 0,
`pos_y` INTEGER UNSIGNED NOT NULL default 0,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
`label` varchar(200) DEFAULT "",
`image` varchar(200) DEFAULT "",
`type` tinyint(1) UNSIGNED NOT NULL default 0,
`period` INTEGER UNSIGNED NOT NULL default 3600,
`id_agente_modulo` mediumint(8) unsigned NOT NULL default '0',
`id_layout_linked` INTEGER unsigned NOT NULL default '0',
`parent_item` INTEGER UNSIGNED NOT NULL default 0,
`label_color` varchar(20) DEFAULT "",
`no_link_color` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB;

View File

@ -0,0 +1,51 @@
UPDATE tconfig SET value = '1.3' WHERE token = 'db_scheme_version';
UPDATE tconfig SET value = '1.3' WHERE token = 'db_scheme_build';
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora');
UPDATE tconfig_os SET icon_name = 'so_aix.png' WHERE icon_name = 'so_aix.gif';
UPDATE tconfig_os SET icon_name = 'so_linux.png' WHERE icon_name = 'so_linux.gif';
UPDATE tconfig_os SET icon_name = 'so_solaris.png' WHERE icon_name = 'so_solaris.gif';
UPDATE tconfig_os SET icon_name = 'so_hpux.png' WHERE icon_name = 'so_hpux.gif';
UPDATE tconfig_os SET icon_name = 'so_beos.png' WHERE icon_name = 'so_beos.gif';
UPDATE tconfig_os SET icon_name = 'so_cisco.png' WHERE icon_name = 'so_cisco.gif';
UPDATE tconfig_os SET icon_name = 'so_mac.png' WHERE icon_name = 'so_mac.gif';
UPDATE tconfig_os SET icon_name = 'so_win.png' WHERE icon_name = 'so_win.gif';
UPDATE tconfig_os SET icon_name = 'so_other.png' WHERE icon_name = 'so_other.gif';
UPDATE tconfig_os SET icon_name = 'network.png' WHERE icon_name = 'network.gif';
UPDATE tgrupo SET icon = 'world', parent = 0, disabled = 0 WHERE id_grupo = 1;
UPDATE tgrupo SET icon = 'server_database', parent = 0, disabled = 0 WHERE id_grupo = 2;
UPDATE tgrupo SET icon = 'eye', parent = 0, disabled = 0 WHERE id_grupo = 3;
UPDATE tgrupo SET icon = 'firewall', parent = 0, disabled = 0 WHERE id_grupo = 4;
UPDATE tgrupo SET icon = 'database_gear', parent = 0, disabled = 0 WHERE id_grupo = 8;
UPDATE tgrupo SET icon = 'transmit', parent = 0, disabled = 0 WHERE id_grupo = 9;
UPDATE tgrupo SET icon = 'house', parent = 0, disabled = 0 WHERE id_grupo = 10;
UPDATE tgrupo SET icon = 'computer', parent = 0, disabled = 0 WHERE id_grupo = 11;
UPDATE tgrupo SET icon = 'applications', parent = 0, disabled = 0 WHERE id_grupo = 12;
INSERT INTO `tnetwork_component` VALUES (1,'OS Total process','Total process in Operating System (UNIX MIB)',5,8,0,0,0,0,'','NULL','NULL','',0),(2,'OS CPU Load','CPU Load in Operating System (UNIX MIB)',5,9,0,0,0,0,'','NULL','NULL','',0),(3,'Sysname','Get name of system using SNMP standard MIB',1,17,0,0,900,0,'','','public','.1.3.6.1.2.1.1.1.0',1),(4,'OS Users','Active users in Operating System (UNIX MIB)',5,6,0,0,0,0,'','NULL','NULL','',0),(5,'CiscoAP Wifi traffic','Cisco AP AP120',9,6,0,0,0,0,'','NULL','NULL','',0),(6,'CiscoAP Wifi errors','Get errors con WiFi for Cisco AP AP120',9,16,0,0,300,0,'','','public','',2),(7,'CiscoAP RAM','Get RAM available on device',9,15,0,0,300,0,'','','public','',4),(8,'CiscoAP Ethernet OUT','Cisco AP AP120',9,6,0,0,0,0,'','NULL','NULL','',0),(9,'CiscoAP Ethernet IN','Cisco AP AP120',9,6,0,0,0,0,'','NULL','NULL','',0),(10,'CiscoAP CPU Usage','Cisco AP AP120',9,6,0,0,0,0,'','NULL','NULL','',0),(11,'Cisco Catalyst CPU Usage','Cisco Catalyst 3750',8,6,0,0,0,0,'','NULL','NULL','',0),(12,'FlashFree ','Cisco Catalyst 3750',8,6,0,0,0,0,'','NULL','NULL','',0),(13,'RAM_Usage','Cisco Catalyst 3750',8,6,0,0,0,0,'','NULL','NULL','',0),(16,'CPU Usage','',7,6,0,0,0,0,'','NULL','NULL','',0),(17,'Memory available','',7,6,0,0,0,0,'','NULL','NULL','',0),(18,'Configuration changes','',7,6,0,0,0,0,'','NULL','NULL','',0),(19,'Power #1','',6,18,0,0,180,0,'','','public',' .1.3.6.1.4.1.2334.2.1.5.8.0',4),(20,'Power #2','',6,18,0,0,180,0,'','','public',' .1.3.6.1.4.1.2334.2.1.5.10.0',4),(21,'User concurrence','',6,6,0,0,0,0,'','NULL','NULL','',0),(22,'HSRP Status','Get status of HSRP',2,18,0,0,180,0,'','','public','1.3.6.1.4.1.9.9.106.1.2.1.1.15.12.106',2),(23,'Num. of classes','',6,6,0,0,0,0,'','NULL','NULL','',0),(24,'NIC #1 status','Status of NIC#1',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.1',2),(25,'NIC #2 status','Status of NIC #2',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.2',2),(26,'NIC #3 status','Status of NIC #3',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.3',2),(27,'NIC #1 outOctects','Output throughtput on Interface #1',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.16.1',2),(28,'NIC #2 outOctects','Output troughtput on interface #2',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.16.2',1),(29,'NIC #3 outOctects','Output troughtput on Interface #3',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.16.3',2),(30,'NIC #1 inOctects','Input troughtput on Interface #1',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.10.1',2),(31,'NIC #2 inOctects','Input throughtput for interface #2',10,16,0,0,180,0,'','NULL','public','.1.3.6.1.2.1.2.2.1.10.2',2),(32,'NIC #3 inOctects','Input throught on interface #3',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.10.3',2),(34,'Host Alive','Check if host is alive using ICMP ping check.',10,6,0,0,120,0,'','','','',2),(36,'Host Latency','Get host network latency in miliseconds, using ICMP.',10,7,0,0,180,0,'','','','',2),(37,'Check HTTP Server','Test APACHE2 HTTP service remotely (Protocol response, not only openport)',10,9,0,0,300,80,'GET / HTTP/1.0^M^M','HTTP/1.1 200 OK','','',3),(38,'Check FTP Server','Check FTP protocol, not only check port.',10,9,0,0,300,21,'QUIT','221','','',3),(39,'Check SSH Server','Checks port 22 is opened',10,9,0,0,300,22,'','','','',2),(40,'Check Telnet server','Check telnet port',10,9,0,0,300,23,'','','','',2),(41,'Check SMTP server','Check if SMTP port it&#039;s open',10,9,0,0,300,25,'','','','',2),(42,'Check POP3 server','Check POP3 port.',10,9,0,0,300,110,'','','','',2),(43,'NIC #7 outOctects','Get outcoming octects from NIC #7',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.16.7',2),(44,'NIC #7 inOctects','Get incoming octects from NIC #7',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.10.7',2),(45,'NIC #4 Status','Get status of NIC #4',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.4',2),(46,'NIC #5 Status','Get status of NIC #5',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.5',2),(47,'NIC #6 Status','Get status of NIC #6',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.6',2),(48,'NIC #7 Status','Get status of NIC #7',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.7',2);
INSERT INTO `tnetwork_component_group` VALUES (1,'General group',0),(2,'Cisco MIBs',10),(3,'Nortel MIBS',10),(4,'3COM MIBs',10),(5,'UNIX MIBs',12),(6,'Packetshaper MIBs',10),(7,'Nortel BPS 2000 MIBs',3),(8,'Cisco Catalyst3750 MIBs',2),(9,'Cisco AP120+',2),(10,'Network Management',0),(11,'Microsoft Windows MIB',12),(12,'Operating Systems',0);
UPDATE ttipo_modulo SET icon = 'mod_data.png' WHERE icon = 'mod_data.gif';
UPDATE ttipo_modulo SET icon = 'mod_proc.png' WHERE icon = 'mod_proc.gif';
UPDATE ttipo_modulo SET icon = 'mod_string.png' WHERE icon = 'mod_string.gif';
UPDATE ttipo_modulo SET icon = 'mod_data_inc.png' WHERE icon = 'mod_data_inc.gif';
UPDATE ttipo_modulo SET icon = 'mod_icmp_proc.png' WHERE icon = 'mod_icmp_proc.gif';
UPDATE ttipo_modulo SET icon = 'mod_icmp_data.png' WHERE icon = 'mod_icmp_data.gif';
UPDATE ttipo_modulo SET icon = 'mod_tcp_data.png' WHERE icon = 'mod_tcp_data.gif';
UPDATE ttipo_modulo SET icon = 'mod_tcp_proc.png' WHERE icon = 'mod_tcp_proc.gif';
UPDATE ttipo_modulo SET icon = 'mod_tcp_string.png' WHERE icon = 'mod_tcp_string.gif';
UPDATE ttipo_modulo SET icon = 'mod_tcp_inc.png' WHERE icon = 'mod_tcp_inc.gif';
UPDATE ttipo_modulo SET icon = 'mod_udp_proc.png' WHERE icon = 'mod_udp_proc.gif';
UPDATE ttipo_modulo SET icon = 'mod_snmp_data.png' WHERE icon = 'mod_snmp_data.gif';
UPDATE ttipo_modulo SET icon = 'mod_snmp_inc.png' WHERE icon = 'mod_snmp_inc.gif';
UPDATE ttipo_modulo SET icon = 'mod_snmp_string.png' WHERE icon = 'mod_snmp_string.gif';
UPDATE ttipo_modulo SET icon = 'mod_snmp_proc.png' WHERE icon = 'mod_snmp_proc.gif';
INSERT INTO `tnews` VALUES (1,'admin','Welcome to Pandora FMS 1.3 !','This is our new console, a lot of new features has been added from last version. Please read documentation about it and be free to test any option.\r\n\r\nPandora FMS team.','2007-06-22 13:03:20');

View File

@ -0,0 +1,45 @@
<?PHP
if (! file_exists("include/config.php")){
echo "<h1>Cannot find config.php!!!. FATAL ERROR UPGRADING</h1>";
exit;
}
include "include/config.php";
// tagente_datos upgrade
echo "<h1>Updating tagente_datos table...</h1>";
$sql1="SELECT * FROM tagente_datos WHERE utimestamp =0 ";
$result1=mysql_query($sql1);
while ($row1=mysql_fetch_array($result1)){
$id = $row1["id_agente_datos"];
$timestamp = $row1["timestamp"];
$utimestamp = strtotime($timestamp);
$sql2="UPDATE tagente_datos SET utimestamp = '$utimestamp' WHERE id_agente_datos = $id";
mysql_query($sql2);
}
echo "<h1>Updating tagente_datos_string table...</h1>";
$sql1="SELECT * FROM tagente_datos_string WHERE utimestamp =0 ";
$result1=mysql_query($sql1);
while ($row1=mysql_fetch_array($result1)){
$id = $row1["id_tagente_datos_string"];
$timestamp = $row1["timestamp"];
$utimestamp = strtotime($timestamp);
$sql2="UPDATE tagente_datos SET utimestamp = '$utimestamp' WHERE id_tagente_datos_string = $id";
mysql_query($sql2);
}
echo "<h1>Updating tagente_estado table...</h1>";
$sql1="SELECT * FROM tagente_estado WHERE utimestamp =0 ";
$result1=mysql_query($sql1);
while ($row1=mysql_fetch_array($result1)){
$id = $row1["id_agente_estado"];
$timestamp = $row1["timestamp"];
$utimestamp = strtotime($timestamp);
$sql2="UPDATE tagente_estado SET utimestamp = '$utimestamp', last_execution_try = '$utimestamp' WHERE id_agente_estado = $id";
mysql_query($sql2);
}
?>