2010-02-10 Sancho Lerena <slerena@artica.es>

* pandoradb.sql: Changes in several tables and new tgroup_stat table.
	Added several index and dropped some fields in tagente_datos and 
	tagente_datos_string tagent_access.
	
	* godmode/setup/setup.php, 
	* include/functions_config.php: Management of new timezone settings and
	realtime stats parameters.

	* include/config_process.php: New timezone management. Updated build.

	* pandoradb_data.sql: Build update. Added new tokens realtimestats and
	stats_interval.

	* install.php: Several changes: Now display GPL licence, better SQL error
	management, and steps are shown now as text instead a progress bar. Also 
	show version and build of the installer.

	* extensions/dbmanager.php: Removed some warnings

	* extras/pandoradb_migrate_v3.0_to_v3.1.sql: Updated with latest changs.

	* godmode/agentes/module_manager_editor_network.php
	godmode/agentes/configurar_agente.php
	godmode/agentes/module_manager_editor.php: Implemented partial support for
	SNMP v3. Miguel will finish the work :-)

	* index.php: Session close function deprecated, replaced by a more standard
	method with unset.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2338 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2010-02-10 17:10:10 +00:00
parent a41e8389ce
commit 4103e04156
13 changed files with 346 additions and 77 deletions

View File

@ -1,3 +1,34 @@
2010-02-10 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: Changes in several tables and new tgroup_stat table.
Added several index and dropped some fields in tagente_datos and
tagente_datos_string tagent_access.
* godmode/setup/setup.php,
* include/functions_config.php: Management of new timezone settings and
realtime stats parameters.
* include/config_process.php: New timezone management. Updated build.
* pandoradb_data.sql: Build update. Added new tokens realtimestats and
stats_interval.
* install.php: Several changes: Now display GPL licence, better SQL error
management, and steps are shown now as text instead a progress bar. Also
show version and build of the installer.
* extensions/dbmanager.php: Removed some warnings
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: Updated with latest changs.
* godmode/agentes/module_manager_editor_network.php
godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor.php: Implemented partial support for
SNMP v3. Miguel will finish the work :-)
* index.php: Session close function deprecated, replaced by a more standard
method with unset.
2010-02-10 Miguel de Dios <miguel.dedios@artica.es> 2010-02-10 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: add in the function "getAgentMap" a new * include/functions_gis.php: add in the function "getAgentMap" a new

View File

@ -30,11 +30,6 @@ function dbmanager_query ($sql, &$error) {
} }
if ($result === true) { if ($result === true) {
if ($rettype == "insert_id") {
return mysql_insert_id ();
} elseif ($rettype == "info") {
return mysql_info ();
}
return mysql_affected_rows (); return mysql_affected_rows ();
} }

View File

@ -9,12 +9,46 @@ ALTER TABLE `tgraph_source` CHANGE `weight` `weight` float(5,3) UNSIGNED NOT NUL
ALTER TABLE `tserver_export` ADD `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'Nuber of hours of diference with the server timezone'; ALTER TABLE `tserver_export` ADD `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'Nuber of hours of diference with the server timezone';
ALTER TABLE `tserver` ADD `lag_time` int(11) NOT NULL default 0;
ALTER TABLE `tserver` ADD `lag_modules` int(11) NOT NULL default 0;
ALTER TABLE `tserver` ADD `total_modules_running` int(11) NOT NULL default 0;
ALTER TABLE `tserver` ADD `my_modules` int(11) NOT NULL default 0;
ALTER TABLE `tagente_modulo` ADD `custom_string_1` text default '';
ALTER TABLE `tagente_modulo` ADD `custom_string_2` text default '';
ALTER TABLE `tagente_modulo` ADD `custom_string_3` text default '';
ALTER TABLE `tagente_modulo` ADD `custom_integer_1` int(10) default 0;
ALTER TABLE `tagente_modulo` ADD `custom_integer_2` int(10) default 0;
ALTER TABLE tagente_datos_string DROP id_tagente_datos_string;
CREATE INDEX idx_utimestamp USING BTREE ON tagente_datos_string(utimestamp);
ALTER TABLE tagente_datos DROP id_agente_datos;
CREATE INDEX idx_utimestamp USING BTREE ON tagente_datos(utimestamp);
CREATE INDEX idx_agente USING BTREE ON tagente_estado(id_agente);
CREATE INDEX idx_template_action USING BTREE ON talert_templates(id_alert_action);
CREATE INDEX idx_template_module USING BTREE ON talert_template_modules(id_agent_module);
CREATE INDEX idx_agentmodule USING BTREE ON tevento(id_agentmodule);
DROP INDEX `status_index_2` on tagente_estado;
CREATE INDEX idx_status USING BTREE ON tagente_estado (estado);
ALTER TABLE tagent_access DROP id_ac;
CREATE INDEX idx_utimestamp USING BTREE ON tagent_access(utimestamp);
ALTER TABLE tusuario ADD `timezone` varchar(50) default '';
-- GIS extension Tables and DATA -- GIS extension Tables and DATA
-- GIS is disabled by default -- GIS is disabled by default
INSERT INTO tconfig (`token`, `value`) VALUES ('activate_gis', '0'); INSERT INTO tconfig (`token`, `value`) VALUES ('activate_gis', '0');
-- Realtime statistics on/off and interval
INSERT INTO tconfig (`token`, `value`) VALUES ('realtimestats', '1');
INSERT INTO tconfig (`token`, `value`) VALUES ('stats_interval', '300');
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tgis_data` -- Table `tgis_data`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -149,3 +183,25 @@ CREATE TABLE IF NOT EXISTS `tgis_map_layer_has_tagente` (
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'Table to define wich agents are shown in a layer'; COMMENT = 'Table to define wich agents are shown in a layer';
-- -----------------------------------------------------
-- Table `tgroup_stat`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tgroup_stat` (
`id_group` int(10) unsigned NOT NULL default '0',
`modules` int(10) unsigned NOT NULL default '0',
`normal` int(10) unsigned NOT NULL default '0',
`critical` int(10) unsigned NOT NULL default '0',
`warning` int(10) unsigned NOT NULL default '0',
`unknown` int(10) unsigned NOT NULL default '0',
`non-init` int(10) unsigned NOT NULL default '0',
`alerts` int(10) unsigned NOT NULL default '0',
`alerts_fired` int(10) unsigned NOT NULL default '0',
`agents` int(10) unsigned NOT NULL default '0',
`agents_uknown` int(10) unsigned NOT NULL default '0',
`utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id_group`)
) ENGINE=InnoDB
COMMENT = 'Table to store global system stats per group';
DEFAULT CHARSET=utf8

View File

@ -444,18 +444,40 @@ if ($update_module || $create_module) {
$tcp_send = (string) get_parameter ('tcp_send'); $tcp_send = (string) get_parameter ('tcp_send');
$tcp_rcv = (string) get_parameter ('tcp_rcv'); $tcp_rcv = (string) get_parameter ('tcp_rcv');
$tcp_port = (int) get_parameter ('tcp_port'); $tcp_port = (int) get_parameter ('tcp_port');
$custom_string_1 = "";
$custom_string_2 = "";
$custom_string_3 = "";
$custom_integer_1 = "";
$custom_integer_2 = "";
$snmp_community = (string) get_parameter ('snmp_community'); $snmp_community = (string) get_parameter ('snmp_community');
$snmp_oid = (string) get_parameter ('snmp_oid'); $snmp_oid = (string) get_parameter ('snmp_oid');
if (empty ($snmp_oid)) { if (empty ($snmp_oid)) {
/* The user did not set any OID manually but did a SNMP walk */ /* The user did not set any OID manually but did a SNMP walk */
$snmp_oid = (string) get_parameter ('select_snmp_oid'); $snmp_oid = (string) get_parameter ('select_snmp_oid');
} }
if ($id_module_type >= 15 && $id_module_type <= 18){
// New support for snmp v3
$tcp_send = (string) get_parameter ('snmp_version');
$plugin_user = (string) get_parameter ('snmp3_auth_user');
$plugin_pass = (string) get_parameter ('snmp3_auth_pass');
$plugin_parameter = (string) get_parameter ('snmp3_auth_method');
$custom_string_1 = (string) get_parameter ('snmp3_privacy_method');
$custom_string_2 = (string) get_parameter ('snmp3_privacy_pass');
$custom_string_3 = (string) get_parameter ('snmp3_security_level');
}
$ip_target = (string) get_parameter ('ip_target'); $ip_target = (string) get_parameter ('ip_target');
$plugin_user = (string) get_parameter ('plugin_user'); $plugin_user = (string) get_parameter ('plugin_user');
if (get_parameter('id_module_component_type') == 7) if (get_parameter('id_module_component_type') == 7)
$plugin_pass = (int) get_parameter ('plugin_pass'); $plugin_pass = (int) get_parameter ('plugin_pass');
else else
$plugin_pass = (string) get_parameter ('plugin_pass'); $plugin_pass = (string) get_parameter ('plugin_pass');
$plugin_parameter = (string) get_parameter ('plugin_parameter'); $plugin_parameter = (string) get_parameter ('plugin_parameter');
$custom_id = (string) get_parameter ('custom_id'); $custom_id = (string) get_parameter ('custom_id');
$history_data = (int) get_parameter('history_data'); $history_data = (int) get_parameter('history_data');
@ -499,6 +521,11 @@ if ($update_module) {
'max_warning' => $max_warning, 'max_warning' => $max_warning,
'min_critical' => $min_critical, 'min_critical' => $min_critical,
'max_critical' => $max_critical, 'max_critical' => $max_critical,
'custom_string_1' => $custom_string_1,
'custom_string_2' => $custom_string_2,
'custom_string_3' => $custom_string_3,
'custom_integer_1' => $custom_integer_1,
'custom_integer_2' => $custom_integer_2,
'min_ff_event' => $ff_event)); 'min_ff_event' => $ff_event));
if ($result === false) { if ($result === false) {
@ -556,6 +583,11 @@ if ($create_module) {
'max_warning' => $max_warning, 'max_warning' => $max_warning,
'min_critical' => $min_critical, 'min_critical' => $min_critical,
'max_critical' => $max_critical, 'max_critical' => $max_critical,
'custom_string_1' => $custom_string_1,
'custom_string_2' => $custom_string_2,
'custom_string_3' => $custom_string_3,
'custom_integer_1' => $custom_integer_1,
'custom_integer_2' => $custom_integer_2,
'min_ff_event' => $ff_event 'min_ff_event' => $ff_event
)); ));

View File

@ -115,6 +115,22 @@ if ($id_agent_module) {
$tcp_rcv = $module['tcp_rcv']; $tcp_rcv = $module['tcp_rcv'];
$snmp_community = $module['snmp_community']; $snmp_community = $module['snmp_community'];
$snmp_oid = $module['snmp_oid']; $snmp_oid = $module['snmp_oid'];
// New support for snmp v3
$snmp_version = $module['tcp_send'];
$snmp3_auth_user = $module["plugin_user"];
$snmp3_auth_pass = $module["plugin_pass"];
// Auth method could be MD5 or SHA
$snmp3_auth_method = $module["plugin_parameter"];
// Privacy method could be DES or AES
$snmp3_privacy_method = $module["custom_string_1"];
$snmp3_privacy_pass = $module["custom_string_2"];
// Security level Could be noAuthNoPriv | authNoPriv | authPriv
$snmp3_security_level = $module["custom_string_3"];
$ip_target = $module['ip_target']; $ip_target = $module['ip_target'];
if (empty ($ip_target)) { if (empty ($ip_target)) {
$ip_target = get_agent_address ($id_agente); $ip_target = get_agent_address ($id_agente);
@ -173,6 +189,15 @@ if ($id_agent_module) {
$min_critical = 0; $min_critical = 0;
$max_critical = 0; $max_critical = 0;
$ff_event = 0; $ff_event = 0;
// New support for snmp v3
$snmp_version = 1;
$snmp3_auth_user = "";
$snmp3_auth_pass = "";
$snmp3_auth_method = "";
$snmp3_privacy_method = "";
$snmp3_privacy_pass = "";
$snmp3_security_level = "";
} }
} }
@ -253,6 +278,7 @@ if ($id_agent_module) {
print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
print_input_hidden ('update_module', 1); print_input_hidden ('update_module', 1);
print_input_hidden ('id_agent_module', $id_agent_module); print_input_hidden ('id_agent_module', $id_agent_module);
print_input_hidden ('id_module_type', $id_module_type);
} else { } else {
print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"'); print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
print_input_hidden ('id_module', $moduletype); print_input_hidden ('id_module', $moduletype);

View File

@ -49,12 +49,14 @@ push_table_simple ($data, 'target_ip');
$snmp_versions['1'] = 'v. 1'; $snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c'; $snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';
$data = array (); $data = array ();
$data[0] = __('SNMP community'); $data[0] = __('SNMP community');
$data[1] = print_input_text ('snmp_community', $snmp_community, '', 15, 60, true, $disabledBecauseInPolicy); $data[1] = print_input_text ('snmp_community', $snmp_community, '', 15, 60, true, $disabledBecauseInPolicy);
$data[2] = _('SNMP version'); $data[2] = _('SNMP version');
$snmp_version = 1;
if ($id_module_type >= 15 && $id_module_type <= 18) { if ($id_module_type >= 15 && $id_module_type <= 18) {
$data[3] = print_select ($snmp_versions, 'snmp_version', $snmp_version, $data[3] = print_select ($snmp_versions, 'snmp_version', $snmp_version,
'', '', '', true, false, false, '', $disabledBecauseInPolicy); '', '', '', true, false, false, '', $disabledBecauseInPolicy);

View File

@ -123,6 +123,16 @@ $table->data[16][0] = __('Enable GIS features in Pandora Console');
$table->data[16][1] = __('Yes').'&nbsp;'.print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'&nbsp;&nbsp;'; $table->data[16][1] = __('Yes').'&nbsp;'.print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'&nbsp;&nbsp;';
$table->data[16][1] .= __('No').'&nbsp;'.print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true); $table->data[16][1] .= __('No').'&nbsp;'.print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true);
$table->data[17][0] = __('Use realtime statistics');
$table->data[17][1] = __('Yes').'&nbsp;'.print_radio_button ('realtimestats', 1, '', $config["realtimestats"], true).'&nbsp;&nbsp;';
$table->data[17][1] .= __('No').'&nbsp;'.print_radio_button ('realtimestats', 0, '', $config["realtimestats"], true);
$table->data[18][0] = __('Batch statistics period (secs)');
$table->data[18][1] = print_input_text ('stats_interval', $config["stats_interval"], '', 5, 5, true);
$table->data[19][0] = __('Timezone setup');
$table->data[19][1] = print_input_text ('timezone', $config["timezone"], '', 15, 15, true);
enterprise_hook ('setup'); enterprise_hook ('setup');
echo '<form id="form_setup" method="post">'; echo '<form id="form_setup" method="post">';

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC100202'; $build_version = 'PC100209';
$pandora_version = 'v3.1-dev'; $pandora_version = 'v3.1-dev';
/* Help to debug problems. Override global PHP configuration */ /* Help to debug problems. Override global PHP configuration */
@ -49,13 +49,6 @@ else {
ini_set("error_log", $config["homedir"]."/pandora_console.log"); ini_set("error_log", $config["homedir"]."/pandora_console.log");
} }
// Set a default timezone default if not configured
// to avoid warnings and bad timestamp calculation in PHP > 5.1
if (ini_get('date.timezone') == ""){
date_default_timezone_set("Europe/Berlin");
}
$config['start_time'] = microtime (true); $config['start_time'] = microtime (true);
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems // Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
@ -82,12 +75,21 @@ global $REMOTE_ADDR;
$config["remote_addr"] = $_SERVER['REMOTE_ADDR']; $config["remote_addr"] = $_SERVER['REMOTE_ADDR'];
$config['user_language'] = $config["language"]; $config['user_language'] = $config["language"];
// Set a the system timezone default
date_default_timezone_set($config["timezone"]);
// Set user language if provided, overriding System language // Set user language if provided, overriding System language
if (isset ($config['id_user'])){ if (isset ($config['id_user'])){
$userinfo = get_user_info ($config['id_user']); $userinfo = get_user_info ($config['id_user']);
if ($userinfo["language"] != ""){ if ($userinfo["language"] != ""){
$config['user_language'] = $userinfo["language"]; $config['user_language'] = $userinfo["language"];
} }
// Each user could have it's own timezone)
if ($userinfo["timezone"] != ""){
date_default_timezone_set($userinfo["timezone"]);
}
} }
$l10n = NULL; $l10n = NULL;
@ -107,6 +109,15 @@ require_once ('functions_extensions.php');
$config['extensions'] = get_extensions (); $config['extensions'] = get_extensions ();
// Detect if enterprise extension is installed
// NOTICE: This variable (config[enterprise_installed] is used in several
// sections. Faking or forcing to 1 will make pandora fails.
if (file_exists ($config["homedir"].'/'.ENTERPRISE_DIR.'/index.php'))
$config['enterprise_installed'] = 1;
else
$config['enterprise_installed'] = 0;
// Connect to the history DB // Connect to the history DB
if (isset($config['history_db_enabled'])) { if (isset($config['history_db_enabled'])) {
if ($config['history_db_enabled']) { if ($config['history_db_enabled']) {

View File

@ -169,8 +169,14 @@ function update_config () {
update_config_value ('history_db_step', (string) get_parameter ('history_db_step', $config['history_db_step'])); update_config_value ('history_db_step', (string) get_parameter ('history_db_step', $config['history_db_step']));
update_config_value ('history_db_delay', (string) get_parameter ('history_db_delay', $config['history_db_delay'])); update_config_value ('history_db_delay', (string) get_parameter ('history_db_delay', $config['history_db_delay']));
update_config_value ('timezone', (string) get_parameter ('timezone', $config['timezone']));
update_config_value ('activate_gis', (bool) get_parameter ('activate_gis', $config['activate_gis'])); update_config_value ('activate_gis', (bool) get_parameter ('activate_gis', $config['activate_gis']));
update_config_value ('stats_interval', get_parameter ('stats_interval', $config['stats_interval']));
update_config_value ('realtimestats', get_parameter ('realtimestats', $config['realtimestats']));
} }
/** /**
@ -261,6 +267,18 @@ function process_config () {
update_config_value ('agentaccess', true); update_config_value ('agentaccess', true);
} }
if (!isset ($config["timezone"])){
update_config_value ('timezone', "Europe/Berlin");
}
if (!isset ($config["stats_interval"])){
update_config_value ('stats_interval', 300);
}
if (!isset ($config["realtimestats"])){
update_config_value ('realtimestats', 1);
}
/* /*
*Parse the ACL IP list for access API that it's save in chunks as *Parse the ACL IP list for access API that it's save in chunks as
*list_ACL_IPs_for_API_<num>, because the value has a limit of 100 *list_ACL_IPs_for_API_<num>, because the value has a limit of 100

View File

@ -197,7 +197,9 @@ if (isset ($_GET["bye"])) {
include ("general/logoff.php"); include ("general/logoff.php");
$iduser = $_SESSION["id_usuario"]; $iduser = $_SESSION["id_usuario"];
logoff_db ($iduser, $REMOTE_ADDR); logoff_db ($iduser, $REMOTE_ADDR);
session_unregister ("id_usuario"); // Unregister Session (compatible with 5.2 and 6.x, old code was deprecated
unset($_SESSION['id_usuario']);
unset($iduser);
while (@ob_end_flush ()); while (@ob_end_flush ());
exit ("</html>"); exit ("</html>");
} }

View File

@ -34,6 +34,10 @@
<?php <?php
$version = "3.1-dev";
$build = "100209";
$banner = "v$version Build $build";
error_reporting(0); error_reporting(0);
function check_extension ( $ext, $label ){ function check_extension ( $ext, $label ){
@ -152,9 +156,9 @@ function parse_mysql_dump($url){
if(trim($sql_line) != "" && strpos($sql_line, "--") === false){ if(trim($sql_line) != "" && strpos($sql_line, "--") === false){
$query .= $sql_line; $query .= $sql_line;
if(preg_match("/;[\040]*\$/", $sql_line)){ if(preg_match("/;[\040]*\$/", $sql_line)){
// echo "DEBUG $query <br>"; //Uncomment for debug
if (!$result = mysql_query($query)) { if (!$result = mysql_query($query)) {
// echo mysql_errno() . ": " . mysql_error(); //Uncomment for debug echo mysql_error(); //Uncomment for debug
echo "<i><br>$query<br></i>";
return 0; return 0;
} }
$query = ""; $query = "";
@ -175,13 +179,28 @@ function random_name ($size){
return $temp; return $temp;
} }
function print_logo_status ($step, $step_total){
global $banner;
echo "
<div id='logo_img'>
<img src='images/pandora_logo.png' border='0'><br>
<span style='font-size: 8px;'>$banner</span>
<br><br>
<b>Install step $step of $step_total</b>
</div>";
}
function install_step1() { function install_step1() {
global $banner;
echo " echo "
<div id='install_container'> <div id='install_container'>
<h1>Pandora FMS installation wizard. Step #1 of 4</h1> <h1>Pandora FMS installation wizard. Step #1 of 5</h1>
<div id='wizard' style='height: 490px;'> <div id='wizard' style='height: 490px;'>
<div id='install_box'> <div id='install_box'>
<h2>Welcome to Pandora FMS 3.0 installation Wizard</h2> <h2>Welcome to Pandora FMS installation Wizard</h2>
<p>This wizard helps you to quick install Pandora FMS console in your system.</p> <p>This wizard helps you to quick install Pandora FMS console in your system.</p>
<p>In four steps checks all dependencies and make your configuration <p>In four steps checks all dependencies and make your configuration
for a quick installation.</p> for a quick installation.</p>
@ -208,16 +227,15 @@ function install_step1() {
please download the migration tool from our website at please download the migration tool from our website at
<a href='http://www.pandorafms.com'>PandoraFMS.com web site</a>.</div>"; <a href='http://www.pandorafms.com'>PandoraFMS.com web site</a>.</div>";
echo " echo "</div>";
</div>
<div id='logo_img'> print_logo_status (1, 5);
<img src='images/pandora_logo.png' border='0'><br>
<img src='images/step0.png' border='0'> echo "<div id='install_img'>";
</div>
<div id='install_img'>";
if ($writable == 0) { if ($writable == 0) {
echo " echo "
<a href='install.php?step=2'><img align='right' src='images/arrow_next.png' border='0'></a>"; <br><br>
<a href='install.php?step=11'><img align='right' src='images/arrow_next.png' border='0'></a>";
} }
else else
echo "<div class='warn'><b>ERROR:</b>You need to setup permissions to be able to write in ./include directory</div>"; echo "<div class='warn'><b>ERROR:</b>You need to setup permissions to be able to write in ./include directory</div>";
@ -231,11 +249,49 @@ function install_step1() {
</div>"; </div>";
} }
function install_step1_licence() {
function install_step2() {
echo " echo "
<div id='install_container'> <div id='install_container'>
<h1>Pandora FMS console installation wizard. Step #2 of 4</h1> <h1>Pandora FMS installation wizard. Step #2 of 5</h1>
<div id='wizard' style='height: 520px;'>
<div id='install_box'>
<h2>GPL2 Licence terms agreement</h2>
<p>Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, <i>you must accept the licence terms.</i>.
<p>For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS</p>
<p>If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.</p>
";
if (!file_exists("COPYING")){
echo "<div class='warn'><b>Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file.";
echo "</div>";
} else {
echo "<form method=post action='install.php?step=2'>";
echo "<textarea name='gpl2' cols=50 rows=20>";
echo file_get_contents ("COPYING");
echo "</textarea>";
echo "<p>";
echo "<input type=submit value='I understand and accept the licence terms'>";
}
echo "</div>";
print_logo_status (2, 5);
echo "</div>
<div style='clear: both;height: 1px;'><!-- --></div>
<div id='foot_install'>
<i>Pandora FMS is an OpenSource 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 installation wizard. Step #3 of 5</h1>
<div id='wizard' style='min-height: 390px;'> <div id='wizard' style='min-height: 390px;'>
<div id='install_box'>"; <div id='install_box'>";
echo "<h2>Checking software dependencies</h2>"; echo "<h2>Checking software dependencies</h2>";
@ -253,23 +309,21 @@ function install_step2() {
$res += check_include("XML/RPC.php","PEAR::XML_RPC PHP Library"); $res += check_include("XML/RPC.php","PEAR::XML_RPC PHP Library");
$res += check_exists ("/usr/bin/twopi","Graphviz Binary"); $res += check_exists ("/usr/bin/twopi","Graphviz Binary");
echo "</table> echo "</table>";
</div> echo "</div>";
<div id='logo_img'> print_logo_status (3,5);
<img src='images/pandora_logo.png' border='0'' alt=''><br>
<img src='images/step1.png' border='0' alt=''> echo "<div id='install_img'>";
</div>
<div id='install_img'>";
if ($res > 0) { if ($res > 0) {
echo " echo "
<div class='warn'>You have some incomplete <div class='warn'>You have some incomplete
dependencies. Please correct them or this installer dependencies. Please correct them or this installer
will not be able to finish your installation. will not be able to finish your installation.
</div> </div>
Ignore it. <a href='install.php?step=3' style='font-weight: bolder;'>Force install Step #3</a>"; Ignore it. <a href='install.php?step=3' style='font-weight: bolder;'>Force install Step #4</a>";
} }
else { else {
echo "<a href='install.php?step=3'> echo "<a href='install.php?step=3'><br>
<img align='right' src='images/arrow_next.png' border='0' alt=''></a>"; <img align='right' src='images/arrow_next.png' border='0' alt=''></a>";
} }
echo " echo "
@ -287,7 +341,7 @@ function install_step2() {
function install_step3() { function install_step3() {
echo " echo "
<div id='install_container'> <div id='install_container'>
<h1>Pandora FMS console installation wizard. Step #3 of 4 </h1> <h1>Pandora FMS console installation wizard. Step #4 of 5 </h1>
<div id='wizard' style='height: 640px;'> <div id='wizard' style='height: 640px;'>
<div id='install_box'> <div id='install_box'>
<h2>Environment and database setup</h2> <h2>Environment and database setup</h2>
@ -338,16 +392,15 @@ function install_step3() {
<input class='login' type='text' name='url' style='width: 250px;' <input class='login' type='text' name='url' style='width: 250px;'
value='".dirname ($_SERVER["SCRIPT_NAME"])."'> value='".dirname ($_SERVER["SCRIPT_NAME"])."'>
<div align='right'> <div align='right'><br>
<input type='image' src='images/arrow_next.png' value='Step #4' id='step4'> <input type='image' src='images/arrow_next.png' value='Step #4' id='step4'>
</div> </div>
</form> </form>
</div> </div>";
<div id='logo_img'>
<img src='images/pandora_logo.png' border='0' alt=''><br> print_logo_status (4,5);
<img src='images/step2.png' border='0' alt=''>
</div> echo "</div>
</div>
<div id='foot_install'> <div id='foot_install'>
<i>Pandora FMS is an OpenSource Software project registered at <i>Pandora FMS is an OpenSource Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i> <a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
@ -392,8 +445,8 @@ function install_step4() {
echo " echo "
<div id='install_container'> <div id='install_container'>
<h1>Pandora FMS Console installation wizard. Step #4 of 4</h1> <h1>Pandora FMS Console installation wizard. Step #5 of 5</h1>
<div id='wizard' style='height: 400px;'> <div id='wizard' style='height: 480px;'>
<div id='install_box'> <div id='install_box'>
<h2>Creating database and default configuration file</h2> <h2>Creating database and default configuration file</h2>
<table>"; <table>";
@ -458,13 +511,11 @@ function install_step4() {
if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) { if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) {
$everything_ok = 1; $everything_ok = 1;
} }
echo "</table></div> echo "</table></div>";
<div id='logo_img'>
<img src='images/pandora_logo.png' border='0' alt=''><br> print_logo_status (4,5);
<img src='images/step3.png' border='0' alt=''>
</div>
<div id='install_img'>"; echo "<div id='install_img'>";
if ($everything_ok == 1) { if ($everything_ok == 1) {
echo "<br><br><a href='install.php?step=5'> echo "<br><br><a href='install.php?step=5'>
<img align='right' src='images/arrow_next.png' border='0' alt=''></a>"; <img align='right' src='images/arrow_next.png' border='0' alt=''></a>";
@ -473,8 +524,7 @@ function install_step4() {
echo "<div class='warn'><b>There were some problems. echo "<div class='warn'><b>There were some problems.
Installation was not completed.</b> Installation was not completed.</b>
<p>Please correct failures before trying again. <p>Please correct failures before trying again.
All database schemes created in this step have been dropped. All database schemes created in this step have been dropped. </p>
Try to reload this page if you have a present Pandora FMS configuration.</p>
</div>"; </div>";
if (mysql_error() != "") if (mysql_error() != "")
@ -509,12 +559,9 @@ function install_step5() {
for updates. for updates.
<p><br><b><a href='index.php'>Click here to access to your Pandora FMS console</a>.</b> <p><br><b><a href='index.php'>Click here to access to your Pandora FMS console</a>.</b>
</p> </p>
</div> </div>";
<div id='logo_img'> print_logo_status (5,5);
<img src='images/pandora_logo.png' border='0'><br> echo "</div>
<img src='images/step4.png' border='0'><br>
</div>
</div>
<div id='foot_install'> <div id='foot_install'>
<i>Pandora FMS is an OpenSource Software project registered at <i>Pandora FMS is an OpenSource Software project registered at
<a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i> <a target='_new' href='http://pandora.sourceforge.net'>SourceForge</a></i>
@ -532,6 +579,8 @@ if (! isset($_GET["step"])){
} else { } else {
$step = $_GET["step"]; $step = $_GET["step"];
switch ($step) { switch ($step) {
case 11: install_step1_licence();
break;
case 2: install_step2(); case 2: install_step2();
break; break;
case 3: install_step3(); case 3: install_step3();

View File

@ -70,12 +70,11 @@ CREATE TABLE IF NOT EXISTS `tagente` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
CREATE TABLE IF NOT EXISTS `tagente_datos` ( CREATE TABLE IF NOT EXISTS `tagente_datos` (
`id_agente_datos` bigint(20) unsigned NOT NULL auto_increment,
`id_agente_modulo` int(10) unsigned NOT NULL default '0', `id_agente_modulo` int(10) unsigned NOT NULL default '0',
`datos` double(18,2) default NULL, `datos` double(18,2) default NULL,
`utimestamp` bigint(20) default '0', `utimestamp` bigint(20) default '0',
PRIMARY KEY (`id_agente_datos`), KEY `data_index1` (`id_agente_modulo`),
KEY `data_index1` (`id_agente_modulo`) KEY `idx_utimestamp` (`utimestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
CREATE TABLE IF NOT EXISTS `tagente_datos_inc` ( CREATE TABLE IF NOT EXISTS `tagente_datos_inc` (
@ -89,12 +88,11 @@ CREATE TABLE IF NOT EXISTS `tagente_datos_inc` (
CREATE TABLE IF NOT EXISTS `tagente_datos_string` ( CREATE TABLE IF NOT EXISTS `tagente_datos_string` (
`id_tagente_datos_string` bigint(20) unsigned NOT NULL auto_increment,
`id_agente_modulo` int(10) unsigned NOT NULL default '0', `id_agente_modulo` int(10) unsigned NOT NULL default '0',
`datos` text NOT NULL, `datos` text NOT NULL,
`utimestamp` int(20) unsigned NOT NULL default 0, `utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id_tagente_datos_string`), KEY `data_string_index_1` (`id_agente_modulo`),
KEY `data_string_index_1` (`id_agente_modulo`) KEY `idx_utimestamp` (`utimestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- delete "cambio" not used anymore -- delete "cambio" not used anymore
@ -114,7 +112,8 @@ CREATE TABLE `tagente_estado` (
`last_status` tinyint(4) default 0, `last_status` tinyint(4) default 0,
PRIMARY KEY (`id_agente_estado`), PRIMARY KEY (`id_agente_estado`),
KEY `status_index_1` (`id_agente_modulo`), KEY `status_index_1` (`id_agente_modulo`),
KEY `status_index_2` (`id_agente_modulo`,`estado`), KEY `idx_agente` (`id_agente`),
KEY `idx_status` (`estado`),
KEY `current_interval` (`current_interval`), KEY `current_interval` (`current_interval`),
KEY `running_by` (`running_by`), KEY `running_by` (`running_by`),
KEY `last_execution_try` (`last_execution_try`) KEY `last_execution_try` (`last_execution_try`)
@ -166,6 +165,11 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
`max_critical` double(18,2) default 0, `max_critical` double(18,2) default 0,
`min_ff_event` int(4) unsigned default '0', `min_ff_event` int(4) unsigned default '0',
`delete_pending` int(1) unsigned default 0, `delete_pending` int(1) unsigned default 0,
`custom_string_1` text default '',
`custom_string_2` text default '',
`custom_string_3` text default '',
`custom_integer_1` int(10) default 0,
`custom_integer_2` int(10) default 0,
PRIMARY KEY (`id_agente_modulo`), PRIMARY KEY (`id_agente_modulo`),
KEY `main_idx` (`id_agente_modulo`,`id_agente`), KEY `main_idx` (`id_agente_modulo`,`id_agente`),
KEY `tam_agente` (`id_agente`), KEY `tam_agente` (`id_agente`),
@ -176,11 +180,10 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
-- snmp_oid is also used for WMI query -- snmp_oid is also used for WMI query
CREATE TABLE IF NOT EXISTS `tagent_access` ( CREATE TABLE IF NOT EXISTS `tagent_access` (
`id_ac` bigint(20) unsigned NOT NULL auto_increment,
`id_agent` int(10) unsigned NOT NULL default '0', `id_agent` int(10) unsigned NOT NULL default '0',
`utimestamp` bigint(20) NOT NULL default '0', `utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id_ac`), KEY `agent_index` (`id_agent`),
KEY `agent_index` (`id_agent`) KEY `idx_utimestamp` (`utimestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `talert_snmp` ( CREATE TABLE IF NOT EXISTS `talert_snmp` (
@ -257,6 +260,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
`priority` tinyint(4) default '0', `priority` tinyint(4) default '0',
`id_group` mediumint(8) unsigned NULL default 0, `id_group` mediumint(8) unsigned NULL default 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_template_action` (`id_alert_action`),
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`) FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
ON DELETE SET NULL ON UPDATE CASCADE ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -273,6 +277,7 @@ CREATE TABLE IF NOT EXISTS `talert_template_modules` (
`priority` tinyint(4) default '0', `priority` tinyint(4) default '0',
`force_execution` tinyint(1) default '0', `force_execution` tinyint(1) default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_template_module` (`id_agent_module`),
FOREIGN KEY (`id_agent_module`) REFERENCES tagente_modulo(`id_agente_modulo`) FOREIGN KEY (`id_agent_module`) REFERENCES tagente_modulo(`id_agente_modulo`)
ON DELETE CASCADE ON UPDATE CASCADE, ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`) FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`)
@ -398,7 +403,8 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`user_comment` varchar(255) NOT NULL default '', `user_comment` varchar(255) NOT NULL default '',
PRIMARY KEY (`id_evento`), PRIMARY KEY (`id_evento`),
KEY `indice_1` (`id_agente`,`id_evento`), KEY `indice_1` (`id_agente`,`id_evento`),
KEY `indice_2` (`utimestamp`,`id_evento`) KEY `indice_2` (`utimestamp`,`id_evento`),
KEY `idx_agentmodule` (`id_agentmodule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Criticity: 0 - Maintance (grey) -- Criticity: 0 - Maintance (grey)
@ -598,6 +604,10 @@ CREATE TABLE IF NOT EXISTS `tserver` (
`server_type` tinyint(3) unsigned NOT NULL default '0', `server_type` tinyint(3) unsigned NOT NULL default '0',
`queued_modules` int(5) unsigned NOT NULL default '0', `queued_modules` int(5) unsigned NOT NULL default '0',
`threads` int(5) unsigned NOT NULL default '0', `threads` int(5) unsigned NOT NULL default '0',
`lag_time` int(11) NOT NULL default 0,
`lag_modules` int(11) NOT NULL default 0,
`total_modules_running` int(11) NOT NULL default 0,
`my_modules` int(11) NOT NULL default 0,
PRIMARY KEY (`id_server`), PRIMARY KEY (`id_server`),
KEY `name` (`name`), KEY `name` (`name`),
KEY `keepalive` (`keepalive`), KEY `keepalive` (`keepalive`),
@ -670,6 +680,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
`phone` varchar(100) default NULL, `phone` varchar(100) default NULL,
`is_admin` tinyint(1) unsigned NOT NULL default '0', `is_admin` tinyint(1) unsigned NOT NULL default '0',
`language` varchar(10) default NULL, `language` varchar(10) default NULL,
`timezone` varchar(50) default '',
UNIQUE KEY `id_user` (`id_user`) UNIQUE KEY `id_user` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -994,3 +1005,26 @@ CREATE TABLE IF NOT EXISTS `tgis_map_layer_has_tagente` (
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'Table to define wich agents are shown in a layer'; COMMENT = 'Table to define wich agents are shown in a layer';
-- -----------------------------------------------------
-- Table `tgroup_stat`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tgroup_stat` (
`id_group` int(10) unsigned NOT NULL default '0',
`modules` int(10) unsigned NOT NULL default '0',
`normal` int(10) unsigned NOT NULL default '0',
`critical` int(10) unsigned NOT NULL default '0',
`warning` int(10) unsigned NOT NULL default '0',
`unknown` int(10) unsigned NOT NULL default '0',
`non-init` int(10) unsigned NOT NULL default '0',
`alerts` int(10) unsigned NOT NULL default '0',
`alerts_fired` int(10) unsigned NOT NULL default '0',
`agents` int(10) unsigned NOT NULL default '0',
`agents_uknown` int(10) unsigned NOT NULL default '0',
`utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id_group`)
) ENGINE=InnoDB
COMMENT = 'Table to store global system stats per group'
DEFAULT CHARSET=utf8;

View File

@ -46,8 +46,8 @@ INSERT INTO `tconfig` VALUES
(5,'days_compact','15'), (5,'days_compact','15'),
(6,'graph_res','5'), (6,'graph_res','5'),
(7,'step_compact','1'), (7,'step_compact','1'),
(8,'db_scheme_version','3.0'), (8,'db_scheme_version','3.1-dev'),
(9,'db_scheme_build','PD91218'), (9,'db_scheme_build','PD100209'),
(13,'show_unknown','0'), (13,'show_unknown','0'),
(14,'show_lastalerts','1'), (14,'show_lastalerts','1'),
(15,'style','pandora'), (15,'style','pandora'),
@ -62,7 +62,10 @@ INSERT INTO `tconfig` VALUES
(24, 'loginhash_pwd', ''), (24, 'loginhash_pwd', ''),
(25, 'trap2agent', 0), (25, 'trap2agent', 0),
(26, 'prominent_time', 0), (26, 'prominent_time', 0),
(27, 'timesource', 'system'); (27, 'timesource', 'system'),
(28, 'realtimestats', '1'),
(29, 'stats_interval', '300');
INSERT INTO tconfig (`token`, `value`) VALUES ('activate_gis', '0'); INSERT INTO tconfig (`token`, `value`) VALUES ('activate_gis', '0');
UNLOCK TABLES; UNLOCK TABLES;