diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e6949cce81..3b2b039dca 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,22 @@ +2008-06-10 Sancho Lerena + + * pandoradb.sql: Updated tevent structure. Added criticity and + other important and new fields. + + * pandoradb_data.sql: Added "remote_config" token for setup. + + * setup.php: Added support for token remote_config. + + * config_process.php: Added support for token remote_config. + + * incident_detail.php: Solved small problems in attachment. + + * snmp_view.php: Solved small problems in pagination. + + * fgraph.php: Added support to generate graphs on any interval + in time, not only "last XX". Need to implement user interface + controls to work with it. + 2008-04-24 Sancho Lerena * operation/reporting/reporting_viewer.php, diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index accfbff9b3..979dd05130 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -31,7 +31,9 @@ if (comprueba_login() == 0) $config["show_unknown"]=$_POST["show_unknown"]; $config["show_lastalerts"]=$_POST["show_lastalerts"]; $config["style"] = $_POST["style"]; + $config["remote_config"] = $_POST["remote_config"]; + $result2=mysql_query("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE TOKEN='remote_config'"); $result2=mysql_query("UPDATE tconfig SET VALUE='".$config["block_size"]."' WHERE TOKEN='block_size'"); $result2=mysql_query("UPDATE tconfig SET VALUE='".$config["language"]."' WHERE TOKEN='language_code'"); $result2=mysql_query("UPDATE tconfig SET VALUE='".$config["days_purge"]."' WHERE TOKEN='days_purge'"); @@ -52,7 +54,6 @@ if (comprueba_login() == 0) $sql="SELECT * FROM tlanguage"; $result=mysql_query($sql); - // This combo is dedicated to Raul... beautiful interface for dirty minds :-D $result2=mysql_query("SELECT * FROM tlanguage WHERE id_language = '".$config["language"]."'"); if ($row2=mysql_fetch_array($result2)){ echo '"; @@ -61,9 +62,9 @@ if (comprueba_login() == 0) echo ""; } echo ''; - - echo ''.$lang_label["block_size"]; - echo ''; + + echo ''.lang_string ("Remote config directory"); + echo ''; echo ''.$lang_label["days_compact"]; echo ''; @@ -115,6 +116,11 @@ if (comprueba_login() == 0) $a++; } echo ''; + + + echo ''.$lang_label["block_size"]; + echo ''; + echo ""; echo ""; echo "
"; diff --git a/pandora_console/include/config.php b/pandora_console/include/config.php index 27cef0fbd4..576b88f17f 100644 --- a/pandora_console/include/config.php +++ b/pandora_console/include/config.php @@ -4,8 +4,8 @@ $config["dbname"]="pandora"; // MySQL DataBase name $config["dbuser"]="pandora"; // DB User $config["dbpass"]="swfvnldt"; // DB Password $config["dbhost"]="localhost"; // DB Host -$config["homedir"]="/var/www/pandora/"; // Config homedir -$config["homeurl"]="http://localhost/pandora"; // Base URL +$config["homedir"]="/var/www/pandora_console/"; // Config homedir +$config["homeurl"]="http://localhost/pandora_console"; // Base URL // End of automatic config file ?> +// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation for version 2. +// 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. + function check_login() { global $config; diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index c95dc1fa7e..dcaf34cbfa 100644 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -130,7 +130,7 @@ if (isset($_GET["id"])){ $filename = $row2["filename"]; $sql2 = "DELETE FROM tattachment WHERE id_attachment = ".$file_id; $res2=mysql_query($sql2); - unlink ($attachment_store."attachment/pand".$file_id."_".$filename); + unlink ($config["attachment_store"]."attachment/pand".$file_id."_".$filename); } // Upload file @@ -151,7 +151,7 @@ if (isset($_GET["id"])){ $id_attachment=mysql_insert_id(); // Copy file to directory and change name - $nombre_archivo = $attachment_store."attachment/pand".$id_attachment."_".$filename; + $nombre_archivo = $config["attachment_store"]."attachment/pand".$id_attachment."_".$filename; if (!(copy($_FILES['userfile']['tmp_name'], $nombre_archivo ))){ echo "

".$lang_label["attach_error"]."

"; diff --git a/pandora_console/operation/messages/message.php b/pandora_console/operation/messages/message.php index 4290ad3ea9..69c719278f 100644 --- a/pandora_console/operation/messages/message.php +++ b/pandora_console/operation/messages/message.php @@ -23,7 +23,7 @@ require("include/config.php"); function create_message($usuario_origen, $usuario_destino, $subject, $mensaje){ $ahora=date("Y/m/d H:i:s"); require ("include/config.php"); - require ("include/languages/language_".$language_code.".php"); + require ("include/languages/language_".$config["language"].".php"); $sql=' INSERT INTO tmensajes (id_usuario_origen, id_usuario_destino, subject, mensaje, timestamp) VALUES ("'.$usuario_origen.'", "'.$usuario_destino.'", "'.$subject.'", "'.$mensaje.'","'.$ahora.'")'; @@ -38,7 +38,7 @@ function create_message($usuario_origen, $usuario_destino, $subject, $mensaje){ function create_message_g($usuario_origen, $usuario_destino, $subject, $mensaje){ $ahora=date("Y/m/d H:i:s"); require ("include/config.php"); - require ("include/languages/language_".$language_code.".php"); + require ("include/languages/language_".$config["language"].".php"); $sql='INSERT INTO tmensajes (id_usuario_origen, id_usuario_destino, subject, mensaje, timestamp) VALUES ("'.$usuario_origen.'", "'.$usuario_destino.'", "'.$subject.'", "'.$mensaje.'","'.$ahora.'")'; $result=mysql_query($sql); if ($result) { diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 61c80b9f4c..e200d8a8f4 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -91,7 +91,7 @@ if (comprueba_login() == 0) { if (isset($_POST["deletebt"])){ $count=0; if (give_acl($id_usuario, 0, "IW") ==1){ - while ($count <= $block_size){ + while ($count <= $config["block_size"]){ if (isset($_POST["snmptrapid".$count])){ $trap_id = $_POST["snmptrapid".$count]; mysql_query("DELETE FROM ttrap WHERE id_trap =".$trap_id); @@ -107,7 +107,7 @@ if (comprueba_login() == 0) { if (isset($_POST["updatebt"])){ $count=0; if (give_acl($id_usuario, 0, "IW") ==1){ - while ($count <= $block_size){ + while ($count <= $config["block_size"]){ if (isset($_POST["snmptrapid".$count])){ $id_trap = $_POST["snmptrapid".$count]; $sql2="UPDATE ttrap SET status=1, id_usuario = '".$id_usuario."' WHERE status = 0 and id_trap = ".$id_trap; @@ -158,12 +158,12 @@ if (comprueba_login() == 0) { $total_traps = count($trap_list); pagination($total_traps, "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view", $offset); /* - if ($total_eventos > $block_size){ + if ($total_eventos > $config["block_size"]){ // If existes more registers tha$row["id_usuario"]n i can put in a page, calculate index markers - $index_counter = ceil($total_eventos/$block_size); + $index_counter = ceil($total_eventos/$config["block_size"]); for ($i = 1; $i <= $index_counter; $i++) { - $inicio_bloque = ($i * $block_size - $block_size); - $final_bloque = $i * $block_size; + $inicio_bloque = ($i * $config["block_size"] - $config["block_size"]); + $final_bloque = $i * $config["block_size"]; if ($total_eventos < $final_bloque) $final_bloque = $total_eventos; echo ''; @@ -175,7 +175,7 @@ if (comprueba_login() == 0) { echo ' '; } echo "

"; - // if exists more registers than i can put in a page (defined by $block_size config parameter) + // if exists more registers than i can put in a page (defined by $config["block_size"] config parameter) // get offset for index calculation } @@ -209,7 +209,7 @@ if (comprueba_login() == 0) { else $offset_limit = $offset; // Skip offset records - for ($a=$offset_limit;$a < ($block_size + $offset + 1);$a++){ + for ($a=$offset_limit;$a < ($config["block_size"] + $offset + 1);$a++){ if (isset($trap_list[$a])){ $id_trap = $trap_list[$a]; $sql="SELECT * FROM ttrap WHERE id_trap = $id_trap"; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 5d9b0f343f..72f509c93a 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -289,6 +289,11 @@ CREATE TABLE `tevento` ( `timestamp` datetime NOT NULL default '0000-00-00 00:00:00', `evento` varchar(255) NOT NULL default '', `utimestamp` bigint(20) unsigned NOT NULL default '0', + `event_type` ENUM('unknown', 'monitor_up', 'monitor_down', 'alert_fired', 'alert_recovered', 'alert_ceased', 'alert_manual_validation', 'recon_host_detected', 'system', 'error') default 'unknown', + `id_agentmodule` bigint(20) NOT NULL default '0', + `id_alert_am` bigint(20) NOT NULL default '0', + `criticity` int(4) unsigned NOT NULL default 0, + PRIMARY KEY (`id_evento`), KEY `indice_1` (`id_agente`,`id_evento`), KEY `indice_2` (`utimestamp`,`id_evento`) diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 53fad1511c..f9a2868258 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -46,7 +46,7 @@ INSERT INTO `talerta` VALUES (10,'Synthetized Speech','flite -t _FIELD2_','Uses /*!40000 ALTER TABLE `tconfig` DISABLE KEYS */; LOCK TABLES `tconfig` WRITE; INSERT INTO `tconfig` VALUES -(1,'language_code','en'),(3,'block_size','20'),(4,'days_purge','60'),(5,'days_compact','15'),(6,'graph_res','5'),(7,'step_compact','1'),(8,'db_scheme_version','2.0'),(9,'db_scheme_build','PD80401'),(13,'show_unknown','0'),(14,'show_lastalerts','1'),(15,'style','pandora'); +(1,'language_code','en'),(3,'block_size','20'),(4,'days_purge','60'),(5,'days_compact','15'),(6,'graph_res','5'),(7,'step_compact','1'),(8,'db_scheme_version','2.0'),(9,'db_scheme_build','PD80401'),(13,'show_unknown','0'),(14,'show_lastalerts','1'),(15,'style','pandora', 16, 'remote_config', '/var/spool/pandora/data_in'); UNLOCK TABLES; /*!40000 ALTER TABLE `tconfig` ENABLE KEYS */; diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index 860665df91..af3f298deb 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -357,7 +357,7 @@ function graphic_combined_module ( $module_list, $weight_list, $periodo, } function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event, - $width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0 ) { + $width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0, $time_reference = "" ) { include ("../include/config.php"); require ("../include/languages/language_".$config['language'].".php"); @@ -365,8 +365,13 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event, $resolution = $config["graph_res"] * 50; // Number of "slices" we want in graph - //$unix_timestamp = strtotime($mysql_timestamp) // Convert MYSQL format tio utime - $fechatope = time() - $periodo; // limit date + if ($time_reference != ""){ + $unix_timestamp = strtotime($time_reference); + $fechatope = $unix_timestamp - $periodo; + } + else + $fechatope = time() - $periodo; // limit date + $horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length $nombre_agente = dame_nombre_agente_agentemodulo($id_agente_modulo); $id_agente = dame_agente_id($nombre_agente); @@ -2020,14 +2025,15 @@ else $value3 = get_parameter("value3",0); $stacked = get_parameter ("stacked", 0); - +$time_reference = get_parameter ("time_reference", ""); + // Image handler // ***************** if (isset($_GET["tipo"])){ if ($_GET["tipo"] == "sparse"){ - grafico_modulo_sparse ($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts, $avg_only, $pure); + grafico_modulo_sparse ($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts, $avg_only, $pure, $time_reference); } elseif ($_GET["tipo"] =="boolean") grafico_modulo_boolean ($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts, 1, $pure); @@ -2059,6 +2065,7 @@ if (isset($_GET["tipo"])){ graphic_agentaccess($_GET["id"], $_GET["periodo"], $width, $height); elseif ($_GET["tipo"] == "agentmodules") graphic_agentmodules($_GET["id"], $width, $height); + //elseif ($_GET["tipo"] == "gdirect") // graphic_test ($id, $period, $intervalo, $label, $width, $height); elseif ( $_GET["tipo"] =="progress"){