mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
2009-12-14 Raul Mateos <raulofpandora@gmail.com>
* util/pandora_db.pl: Improved help. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2194 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ebcf02486d
commit
2adb523d94
@ -1,3 +1,7 @@
|
|||||||
|
2009-12-14 Raul Mateos <raulofpandora@gmail.com>
|
||||||
|
|
||||||
|
* util/pandora_db.pl: Improved help.
|
||||||
|
|
||||||
2009-12-14 Raul Mateos <raulofpandora@gmail.com>
|
2009-12-14 Raul Mateos <raulofpandora@gmail.com>
|
||||||
|
|
||||||
* lib/PandoraFMS/Core.pm: Changed spaces for tabs.
|
* lib/PandoraFMS/Core.pm: Changed spaces for tabs.
|
||||||
|
@ -25,8 +25,8 @@ use PandoraFMS::Tools;
|
|||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
|
|
||||||
# version: define la version actual del programa
|
# version: define current version
|
||||||
my $version = "3.0-dev PS090930";
|
my $version = "3.0-dev PS091214";
|
||||||
|
|
||||||
# Setup variables
|
# Setup variables
|
||||||
my $dirname="";
|
my $dirname="";
|
||||||
@ -250,13 +250,14 @@ sub pandora_compactdb {
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
sub pandora_init {
|
sub pandora_init {
|
||||||
print "\nPandora FMS DB Tool $version Copyright (c) 2004-2008 Artica ST\n";
|
print "\nPandora FMS DB Tool $version Copyright (c) 2004-2009 Artica ST\n";
|
||||||
print "This program is Free Software, licensed under the terms of GPL License v2\n";
|
print "This program is Free Software, licensed under the terms of GPL License v2\n";
|
||||||
print "You can download latest versions and documentation at http://www.pandorafms.org\n";
|
print "You can download latest versions and documentation at http://www.pandorafms.org\n";
|
||||||
|
|
||||||
# Load config file from command line
|
# Load config file from command line
|
||||||
if ($#ARGV == -1 ){
|
if ($#ARGV == -1 ){
|
||||||
print "FATAL ERROR: I Need at least one parameter: Complete path to pandora_server.conf file !!\n\n";
|
print "\n[ERROR] I Need at least one parameter: Complete path to pandora_server.conf file\n";
|
||||||
|
help_screen();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +276,7 @@ sub pandora_init {
|
|||||||
else { ($pandora_path = $parametro); }
|
else { ($pandora_path = $parametro); }
|
||||||
}
|
}
|
||||||
if ($pandora_path eq ""){
|
if ($pandora_path eq ""){
|
||||||
print "FATAL ERROR: I Need complete path to pandora_server.conf file !!\n\n";
|
print "\n[ERROR] I Need complete path to pandora_server.conf file \n\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,7 +292,7 @@ sub pandora_loadconfig {
|
|||||||
my @command_line;
|
my @command_line;
|
||||||
# Check for file
|
# Check for file
|
||||||
if ( ! -e $archivo_cfg ) {
|
if ( ! -e $archivo_cfg ) {
|
||||||
printf "[ERROR] Cannot open configuration file. Please specify a valid one in command line \n";
|
printf "\n[ERROR] Cannot open configuration file. Please specify a valid one in command line \n";
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +316,7 @@ sub pandora_loadconfig {
|
|||||||
|
|
||||||
# Has read setup file ok ?
|
# Has read setup file ok ?
|
||||||
if ( $ltotal == 0 ) {
|
if ( $ltotal == 0 ) {
|
||||||
print "[ERROR] No valid setup tokens readed in $archivo_cfg ";
|
print "\n[ERROR] No valid setup tokens readed in $archivo_cfg ";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +333,7 @@ sub pandora_loadconfig {
|
|||||||
|
|
||||||
# Check for valid token token values
|
# Check for valid token token values
|
||||||
if (( $dbuser eq "" ) || ( $log_file eq "" ) || ( $dbhost eq "") || ($dbpass eq "" ) ) {
|
if (( $dbuser eq "" ) || ( $log_file eq "" ) || ( $dbhost eq "") || ($dbpass eq "" ) ) {
|
||||||
print "[ERROR] Bad Config values. Be sure that $archivo_cfg is a valid setup file";
|
print "\n[ERROR] Bad Config values. Be sure that $archivo_cfg is a valid setup file";
|
||||||
print "\n\n";
|
print "\n\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -348,7 +349,7 @@ sub pandora_loadconfig {
|
|||||||
@data = $query_ready->fetchrow_array();
|
@data = $query_ready->fetchrow_array();
|
||||||
$config_days_purge = $data[2]; # value
|
$config_days_purge = $data[2]; # value
|
||||||
} else {
|
} else {
|
||||||
print "[ERROR] I cannot find in database a config item (DAYS_PURGE)\n";
|
print "\n[ERROR] I cannot find in database a config item (DAYS_PURGE)\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
$query_ready->finish();
|
$query_ready->finish();
|
||||||
@ -401,7 +402,7 @@ sub pandora_checkdb_consistency {
|
|||||||
my $err; # error code in datecalc function
|
my $err; # error code in datecalc function
|
||||||
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:3306",$dbuser, $dbpass,{RaiseError => 1, AutoCommit => 1 });
|
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:3306",$dbuser, $dbpass,{RaiseError => 1, AutoCommit => 1 });
|
||||||
|
|
||||||
print "[CHECKDB] Deleting non-init data... \n";
|
print "\n[CHECKDB] Deleting non-init data... \n";
|
||||||
my $query4 = "SELECT * FROM tagente_estado WHERE utimestamp = 0";
|
my $query4 = "SELECT * FROM tagente_estado WHERE utimestamp = 0";
|
||||||
my $prep4 = $dbh->prepare($query4);
|
my $prep4 = $dbh->prepare($query4);
|
||||||
$prep4 ->execute;
|
$prep4 ->execute;
|
||||||
@ -429,7 +430,7 @@ sub pandora_checkdb_consistency {
|
|||||||
}
|
}
|
||||||
$prep4->finish();
|
$prep4->finish();
|
||||||
|
|
||||||
print "[CHECKDB] Checking database consistency (Missing status)... \n";
|
print "\n[CHECKDB] Checking database consistency (Missing status)... \n";
|
||||||
|
|
||||||
my $query1 = "SELECT * FROM tagente_modulo";
|
my $query1 = "SELECT * FROM tagente_modulo";
|
||||||
my $prep1 = $dbh->prepare($query1);
|
my $prep1 = $dbh->prepare($query1);
|
||||||
@ -457,7 +458,7 @@ sub pandora_checkdb_consistency {
|
|||||||
}
|
}
|
||||||
$prep1->finish();
|
$prep1->finish();
|
||||||
|
|
||||||
print "[CHECKDB] Checking database consistency (Missing module)... \n";
|
print "\n[CHECKDB] Checking database consistency (Missing module)... \n";
|
||||||
# 2. Check for modules in tagente_estado that do not have tagente_modulo, if there is any, delete it
|
# 2. Check for modules in tagente_estado that do not have tagente_modulo, if there is any, delete it
|
||||||
|
|
||||||
my $query1 = "SELECT * FROM tagente_estado";
|
my $query1 = "SELECT * FROM tagente_estado";
|
||||||
@ -534,16 +535,19 @@ sub is_policy_module ($$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# SUB help_screen()
|
# SUB ERRORhelp_screen()
|
||||||
# Show a help screen an exits
|
# Show a help screen an exits
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
sub help_screen{
|
sub help_screen{
|
||||||
printf "\n\nSintax: \n pandora_db.pl fullpathname_to_pandora_server.conf \n\n";
|
printf "\nSyntax: \n pandora_db.pl fullpathname_to_pandora_server.conf \n\n";
|
||||||
print " -d Debug output (very verbose) \n";
|
print " -d Debug output (very verbose) \n";
|
||||||
print " -v Verbose output \n";
|
print " -v Verbose output \n";
|
||||||
print " -q Quiet output \n";
|
print " -q Quiet output \n";
|
||||||
print " -p Only purge and consistency check, skip compact \n";
|
print " -p Only purge and consistency check, skip compact \n\n";
|
||||||
|
print "If you get the Undefined subroutine &main::UnixDate error, ";
|
||||||
|
print "verify that you have the Date::Manip Perl module. ";
|
||||||
|
print "If not, install it using cpan Date::Manip \n\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user