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
21fcdbe7c8
commit
af83debc73
|
@ -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>
|
||||
|
||||
* lib/PandoraFMS/Core.pm: Changed spaces for tabs.
|
||||
|
|
|
@ -25,8 +25,8 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
# version: define la version actual del programa
|
||||
my $version = "3.0-dev PS090930";
|
||||
# version: define current version
|
||||
my $version = "3.0-dev PS091214";
|
||||
|
||||
# Setup variables
|
||||
my $dirname="";
|
||||
|
@ -250,13 +250,14 @@ sub pandora_compactdb {
|
|||
##############################################################################
|
||||
|
||||
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 "You can download latest versions and documentation at http://www.pandorafms.org\n";
|
||||
|
||||
# Load config file from command line
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -275,7 +276,7 @@ sub pandora_init {
|
|||
else { ($pandora_path = $parametro); }
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +292,7 @@ sub pandora_loadconfig {
|
|||
my @command_line;
|
||||
# Check for file
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -315,7 +316,7 @@ sub pandora_loadconfig {
|
|||
|
||||
# Has read setup file ok ?
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -332,7 +333,7 @@ sub pandora_loadconfig {
|
|||
|
||||
# Check for valid token token values
|
||||
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";
|
||||
exit;
|
||||
}
|
||||
|
@ -348,7 +349,7 @@ sub pandora_loadconfig {
|
|||
@data = $query_ready->fetchrow_array();
|
||||
$config_days_purge = $data[2]; # value
|
||||
} 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);
|
||||
}
|
||||
$query_ready->finish();
|
||||
|
@ -401,7 +402,7 @@ sub pandora_checkdb_consistency {
|
|||
my $err; # error code in datecalc function
|
||||
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 $prep4 = $dbh->prepare($query4);
|
||||
$prep4 ->execute;
|
||||
|
@ -429,7 +430,7 @@ sub pandora_checkdb_consistency {
|
|||
}
|
||||
$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 $prep1 = $dbh->prepare($query1);
|
||||
|
@ -457,7 +458,7 @@ sub pandora_checkdb_consistency {
|
|||
}
|
||||
$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
|
||||
|
||||
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
|
||||
##############################################################################
|
||||
|
||||
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 " -v Verbose 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue