From d58c51c7d4edb49b78a9c5e1a8f6e10c78ff08de Mon Sep 17 00:00:00 2001 From: slerena Date: Thu, 6 Jul 2006 17:14:19 +0000 Subject: [PATCH] * Fixed minor issues for finish Pandora 1.2 Beta 2. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@103 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/bin/pandora_DBI_test.pl | 18 ++++++++------ pandora_server/bin/pandora_server.pl | 32 ++++++++++++------------- pandora_server/conf/pandora_server.conf | 6 ++--- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/pandora_server/bin/pandora_DBI_test.pl b/pandora_server/bin/pandora_DBI_test.pl index 8361a5bfb4..11b1fb2534 100644 --- a/pandora_server/bin/pandora_DBI_test.pl +++ b/pandora_server/bin/pandora_DBI_test.pl @@ -17,16 +17,14 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################## -#use strict; -use warnings; use DBI(); # DB interface with MySQL -my $dbh = DBI->connect("DBI:mysql:pandora:localhost:3306","pandora","pandora",{ RaiseError => 1 }); +#$dbh = DBI->connect("DBI:mysql:pandora:localhost:3306","pandora","pandora",{ RaiseError => 1 }); while (1){ - # dbd_open_test(); - dbd_select_test($dbh); + dbd_open_test(); + #dbd_select_test($dbh); } sub dbd_select_test { @@ -34,9 +32,15 @@ sub dbd_select_test { my $query = "select * from tagente"; my $result = $dbh->prepare($query); $result ->execute; + $result = ""; + $query = ""; + $dbh = ""; + undef $dbh; + undef $query; + undef $result; } sub dbd_open_test { - my $dbh = DBI->connect("DBI:mysql:pandora:localhost:3306","pandora","pandora",{ RaiseError => 1 }); + $dbh = DBI->connect("DBI:mysql:pandora:localhost:3306","pandora","pandora",{ RaiseError => 1 }); $dbh->disconnect; -} \ No newline at end of file +} diff --git a/pandora_server/bin/pandora_server.pl b/pandora_server/bin/pandora_server.pl index c622605c67..1f27f7c627 100755 --- a/pandora_server/bin/pandora_server.pl +++ b/pandora_server/bin/pandora_server.pl @@ -3,19 +3,19 @@ # Pandora Data Server ################################################################################## # Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com -# Copyright (c) 2005-2006 Artica Soluciones Tecnol�icas S.L +# Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L # -#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; either version 2 -#of the License, or (at your option) any later version. -#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. +# 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; either version 2 +# of the License, or (at your option) any later version. +# 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. ################################################################################## # Includes list @@ -95,7 +95,7 @@ sub pandora_dataserver { threads->yield; $file_data = "$pa_config->{'incomingdir'}/$onefile"; next if $onefile =~ /^\.\.?$/; # Skip . and .. directory - if ( $onefile =~ /([\-\:\;\.\,\_\s\a\*\=\(\)\/a-zA-Z0-9]*).data/ ) { # First filter any file that doesnt like ".data" + if ( $onefile =~ /([\-\:\;\.\,\_\s\a\*\=\(\)a-zA-Z0-9]*).data\z/ ) { # First filter any file that doesnt like ".data" $agent_filename = $1; $file_md5 = "$pa_config->{'incomingdir'}/$agent_filename.checksum"; if (( -e $file_md5 ) or ($pa_config->{'pandora_check'} == 0)){ # If check is disabled, ignore if file_md5 exists @@ -118,15 +118,15 @@ sub pandora_dataserver { eval { # XML Processing error catching procedure. Critical due XML was no validated logger ($pa_config, "Ready to parse $file_data",4); $config = XMLin($file_data, forcearray=>'module'); - procesa_datos($pa_config, $config, $dbh); }; if ($@) { logger ($pa_config, "[ERROR] Error processing XML contents in $file_data",0); - copy ($file_data,$file_data."_BAD"); + copy ($file_data,$file_data."_BADXML"); if (($pa_config->{'pandora_check'} == 1) && ( -e $file_md5 )) { - copy ($file_md5,$file_md5."_BAD"); + copy ($file_md5,$file_md5."_BADCHECKUM"); } } + procesa_datos($pa_config, $config, $dbh); undef $config; # If _everything_ its ok.. # delete files diff --git a/pandora_server/conf/pandora_server.conf b/pandora_server/conf/pandora_server.conf index ce004d291a..664a176dc7 100755 --- a/pandora_server/conf/pandora_server.conf +++ b/pandora_server/conf/pandora_server.conf @@ -23,7 +23,7 @@ dbuser pandora # daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground # this could be setup on command line with -D option # NEW in pandora 1.2, default is 0 -# daemon 0 +# daemon 1 # dbpass: Database password dbpass pandora @@ -36,7 +36,7 @@ dbhost localhost verbosity 10 # Server Threshold: defines number of seconds of main loop (in sec) -server_threshold 30 +server_threshold 10 # Alert threshold alert_threshold 60 @@ -45,7 +45,7 @@ alert_threshold 60 master 1 # Check datafiles using a MD5 hash, 1 to check (default), 0 to ignore .checksum -checksum 1 +checksum 0 # Activate Pandora SNMP console (depending on snmptrapd) # only available on Pandora Network server