2008-06-10 Sancho Lerena <slerena@artica.es>

* 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.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@842 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-06-09 10:48:11 +00:00
parent 7267b41682
commit dcea995ade
11 changed files with 70 additions and 33 deletions

View File

@ -1,3 +1,22 @@
2008-06-10 Sancho Lerena <slerena@artica.es>
* 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 <slerena@artica.es>
* operation/reporting/reporting_viewer.php,

View File

@ -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 '<option value="'.$row2["id_language"].'">'.$row2["name"]."</option>";
@ -61,9 +62,9 @@ if (comprueba_login() == 0)
echo "<option value=".$row["id_language"].">".$row["name"]."</option>";
}
echo '</select></td></tr>';
echo '<tr><td class="datos2">'.$lang_label["block_size"];
echo '<td class="datos2"><input type="text" name="block_size" size=5 value="'.$config["block_size"].'"></td></tr>';
echo '<tr><td class="datos2">'.lang_string ("Remote config directory");
echo '<td class="datos2"><input type="text" name="remote_config" size=30 value="'.$config["remote_config"].'"></td></tr>';
echo '<tr><td class="datos">'.$lang_label["days_compact"];
echo '<td class="datos"><input type="text" name="days_compact" size=5 value="'.$config["days_compact"].'"></td></tr>';
@ -115,6 +116,11 @@ if (comprueba_login() == 0)
$a++;
}
echo '</select>';
echo '<tr><td class="datos">'.$lang_label["block_size"];
echo '<td class="datos"><input type="text" name="block_size" size=5 value="'.$config["block_size"].'"></td></tr>';
echo "</table>";
echo "<table width=500>";
echo "<tr><td align='right'>";

View File

@ -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
?><?php
// Pandora FMS - the Free Monitoring System
@ -40,7 +40,7 @@ $config["homeurl"]="http://localhost/pandora"; // Base URL
//error_reporting(0); // Need to use active console at this moment
// Display ALL errors
error_reporting(E_ERROR);
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.

View File

@ -18,7 +18,7 @@
//Pandora Version
if (!isset($build_version))
$build_version="PC080227";
$build_version="PC080610";
if (!isset($pandora_version))
$pandora_version="v2.0-dev";
@ -66,6 +66,8 @@ if($result2=mysql_query("SELECT * FROM tconfig")){
break;
case "show_lastalerts": $config["show_lastalerts"] = $row2["value"];
break;
case "remote_config": $config["remote_config"] = $row2["value"];
break;
}
}
} else {

View File

@ -1,20 +1,18 @@
<?php
// Pandora FMS - the Free Monitoring System
// Pandora FMS - the Free monitoring system
// ========================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// Copyright (c) 2004-2008 Sancho Lerena, <slerena@gmail.com>
// 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;

View File

@ -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 "<h3 class=error>".$lang_label["attach_error"]."</h3>";

View File

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

View File

@ -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 '<a href="index.php?sec=eventos&sec2=eventos/eventos&offset='.$inicio_bloque.'">';
@ -175,7 +175,7 @@ if (comprueba_login() == 0) {
echo '</a> ';
}
echo "<br><br>";
// 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";

View File

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

View File

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

View File

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