2007-08-02 Sancho Lerena <slerena@gmail.com>

* Makefile.PL: Missing dep updated and .pl extensions purged.

        * All (4) startup scripts: Updated startup script.

        * lib/PandoraFMS/Config.pm: Now servers dont get "Homedir" from command line, get
        config file directly

        * bin/pandora_recon, bin/pandora_server, bin/pandora_network, bin/pandora_snmpconsole:
        Renamed (deleted .pl).



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@588 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-08-02 18:30:10 +00:00
parent baa567710c
commit 52980bd3dc
11 changed files with 48 additions and 33 deletions

View File

@ -1,5 +1,15 @@
2007-08-02 Sancho Lerena <slerena@gmail.com> 2007-08-02 Sancho Lerena <slerena@gmail.com>
* Makefile.PL: Missing dep updated and .pl extensions purged.
* All (4) startup scripts: Updated startup script.
* lib/PandoraFMS/Config.pm: Now servers dont get "Homedir" from command line, get
config file directly
* bin/pandora_recon, bin/pandora_server, bin/pandora_network, bin/pandora_snmpconsole:
Renamed (deleted .pl).
* Final changes (link is now over bin, and lib is real dir, for work * Final changes (link is now over bin, and lib is real dir, for work
with Makefile.PL). with Makefile.PL).

View File

@ -6,6 +6,7 @@ WriteMakefile(
VERSION_FROM => 'bin/PandoraFMS/Config.pm', VERSION_FROM => 'bin/PandoraFMS/Config.pm',
AUTHOR => 'Sancho Lerena <slerena@gmail.com>', AUTHOR => 'Sancho Lerena <slerena@gmail.com>',
PREREQ_PM => { PREREQ_PM => {
NetAddr::IP => 0,
DBI => 0, DBI => 0,
threads::shared => 0, threads::shared => 0,
IO::Socket => 0, IO::Socket => 0,
@ -19,7 +20,7 @@ WriteMakefile(
SNMP => 0 SNMP => 0
}, },
EXE_FILES => EXE_FILES =>
[ 'bin/pandora_server.pl', 'bin/pandora_network.pl', 'bin/pandora_recon.pl', 'bin/pandora_snmpconsole.pl'], [ 'bin/pandora_server', 'bin/pandora_network', 'bin/pandora_recon', 'bin/pandora_snmpconsole'],
PMLIBDIRS => [ 'lib' ], PMLIBDIRS => [ 'lib' ],
'dist' => { 'TAR' => 'tar', 'TARFLAGS' => 'cvfz', 'SUFFIX' 'dist' => { 'TAR' => 'tar', 'TARFLAGS' => 'cvfz', 'SUFFIX'
=> '.gz', 'COMPRESS' => 'gzip'} => '.gz', 'COMPRESS' => 'gzip'}

View File

@ -48,7 +48,7 @@ my %pa_config;
########################################################################## ##########################################################################
sub help_screen { sub help_screen {
printf "\n\nSyntax: \n pandora_xxxxxxx.pl <fullpathname to PANDORA HOME directory> [ options ] \n\n"; printf "\n\nSyntax: \n pandora_server < fullpathname to pandora server configuration file > [ options ] \n\n";
printf "Following options are optional : \n"; printf "Following options are optional : \n";
printf " -v : Verbose mode activated, give more information in logfile \n"; printf " -v : Verbose mode activated, give more information in logfile \n";
printf " -d : Debug mode activated, give extensive information in logfile \n"; printf " -d : Debug mode activated, give extensive information in logfile \n";
@ -75,7 +75,7 @@ sub pandora_init {
# Load config file from command line # Load config file from command line
if ($#ARGV == -1 ){ if ($#ARGV == -1 ){
print "I Need at least one parameter: Complete path to Pandora FMS Server HOME Directory. \n"; print "I Need at least one parameter: Complete path to Pandora FMS Server configuration file. \n";
help_screen; help_screen;
exit; exit;
} }
@ -96,7 +96,7 @@ sub pandora_init {
else { ($pa_config->{"pandora_path"} = $parametro); } else { ($pa_config->{"pandora_path"} = $parametro); }
} }
if ($pa_config->{"pandora_path"} eq ""){ if ($pa_config->{"pandora_path"} eq ""){
print "I Need at least one parameter: Complete path to Pandora FMS HOME Directory. \n"; print "I Need at least one parameter: Complete path to Pandora FMS configuration file. \n";
exit; exit;
} }
} }
@ -108,7 +108,7 @@ sub pandora_init {
sub pandora_loadconfig { sub pandora_loadconfig {
my $pa_config = $_[0]; my $pa_config = $_[0];
my $opmode = $_[1]; # 0 dataserver, 1 network server, 2 snmp console, 3 recon server my $opmode = $_[1]; # 0 dataserver, 1 network server, 2 snmp console, 3 recon server
my $archivo_cfg = $pa_config->{'pandora_path'}."/conf/pandora_server.conf"; my $archivo_cfg = $pa_config->{'pandora_path'};
my $buffer_line; my $buffer_line;
my @command_line; my @command_line;
my $tbuf; my $tbuf;
@ -121,14 +121,14 @@ sub pandora_loadconfig {
$pa_config->{"dbhost"} = "localhost"; $pa_config->{"dbhost"} = "localhost";
$pa_config->{"dbname"} = "pandora"; $pa_config->{"dbname"} = "pandora";
$pa_config->{"basepath"}=$pa_config->{'pandora_path'}; # Compatibility with Pandora 1.1 $pa_config->{"basepath"}=$pa_config->{'pandora_path'}; # Compatibility with Pandora 1.1
$pa_config->{"incomingdir"}=$pa_config->{'pandora_path'}."/data_in"; $pa_config->{"incomingdir"}="/var/spool/pandor/data_in";
$pa_config->{"server_threshold"}=30; $pa_config->{"server_threshold"}=30;
$pa_config->{"alert_threshold"}=60; $pa_config->{"alert_threshold"}=60;
$pa_config->{"logfile"}=$pa_config->{'pandora_path'}."/log/pandora_server.log"; $pa_config->{"logfile"}="/var/log/pandora_server.log";
$pa_config->{"errorlogfile"}=$pa_config->{'pandora_path'}."/log/pandora_server.error"; $pa_config->{"errorlogfile"}="/var/log/pandora_server.error";
$pa_config->{"networktimeout"}=15; # By default, not in config file yet $pa_config->{"networktimeout"}=15; # By default, not in config file yet
$pa_config->{"pandora_master"}=1; # on by default $pa_config->{"pandora_master"}=1; # on by default
$pa_config->{"pandora_check"}=1; # on by default $pa_config->{"pandora_check"}=0; # on by default
$pa_config->{"snmpconsole"}=0; # off by default $pa_config->{"snmpconsole"}=0; # off by default
$pa_config->{"version"}=$pandora_version; $pa_config->{"version"}=$pandora_version;
$pa_config->{"build"}=$pandora_build; $pa_config->{"build"}=$pandora_build;
@ -138,7 +138,7 @@ sub pandora_loadconfig {
$pa_config->{"dataserver"}=0; $pa_config->{"dataserver"}=0;
$pa_config->{"reconserver"}=0; $pa_config->{"reconserver"}=0;
$pa_config->{"servermode"}=""; $pa_config->{"servermode"}="";
$pa_config->{'pandora_snmp_logfile'}="/var/log/pandora/pandora_snmptrap.log"; $pa_config->{'pandora_snmp_logfile'}="/var/log/pandora_snmptrap.log";
$pa_config->{"network_threads"}=5; # Fixed default $pa_config->{"network_threads"}=5; # Fixed default
$pa_config->{"keepalive"}=60; # 60 Seconds initially for server keepalive $pa_config->{"keepalive"}=60; # 60 Seconds initially for server keepalive
$pa_config->{"keepalive_orig"} = $pa_config->{"keepalive"}; $pa_config->{"keepalive_orig"} = $pa_config->{"keepalive"};

View File

@ -6,9 +6,10 @@
# v1.3 Build 070731 # v1.3 Build 070731
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/usr/share/pandora_server" PANDORA_HOME="/etc/pandora"
PANDORA_PID_PATH="/var/run/pandora" PANDORA_PID_PATH="/var/run/pandora"
PANDORA_PID=$PANDORA_PID_PATH/pandora_network.pid PANDORA_PID=$PANDORA_PID_PATH/pandora_network.pid
PANDORA_DAEMON=/usr/bin/pandora_network.pl
# Main script # Main script
@ -18,7 +19,7 @@ then
exit exit
fi fi
if [ ! -f $PANDORA_HOME/bin/pandora_network.pl ] if [ ! -f $PANDORA_DAEMON ]
then then
echo "Pandora FMS Network Server not found, please check setup and read manual" echo "Pandora FMS Network Server not found, please check setup and read manual"
exit exit
@ -38,10 +39,10 @@ case "$1" in
fi fi
fi fi
cd $PANDORA_HOME/bin $PANDORA_DAEMON $PANDORA_HOME -D
./pandora_network.pl $PANDORA_HOME -D sleep 1
MYPID=`ps aux | grep 'pandora_network.pl' | grep -v grep | tail -1 | awk '{print $2}'` MYPID=`ps aux | grep 'pandora_network' | grep -v grep | tail -1 | awk '{print $2}'`
if [ ! -z "$MYPID" ] if [ ! -z "$MYPID" ]
then then
echo $MYPID > $PANDORA_PID echo $MYPID > $PANDORA_PID

View File

@ -6,9 +6,10 @@
# v1.3 Build 070731 # v1.3 Build 070731
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/usr/share/pandora_server" PANDORA_HOME="/etc/pandora"
PANDORA_PID_PATH="/var/run/pandora" PANDORA_PID_PATH="/var/run/pandora"
PANDORA_PID=$PANDORA_PID_PATH/pandora_recon.pid PANDORA_PID=$PANDORA_PID_PATH/pandora_recon.pid
PANDORA_DAEMON=/usr/bin/pandora_recon
# Main script # Main script
@ -18,7 +19,7 @@ then
exit exit
fi fi
if [ ! -f $PANDORA_HOME/bin/pandora_recon.pl ] if [ ! -f $PANDORA_DAEMON ]
then then
echo "Pandora FMS Recon Server not found, please check setup and read manual" echo "Pandora FMS Recon Server not found, please check setup and read manual"
exit exit
@ -38,10 +39,10 @@ case "$1" in
fi fi
fi fi
cd $PANDORA_HOME/bin $PANDORA_DAEMON $PANDORA_HOME -D
./pandora_recon.pl $PANDORA_HOME -D sleep 1
MYPID=`ps aux | grep 'pandora_recon.pl' | grep -v grep | tail -1 | awk '{print $2}'` MYPID=`ps aux | grep 'pandora_recon' | grep -v grep | tail -1 | awk '{print $2}'`
if [ ! -z "$MYPID" ] if [ ! -z "$MYPID" ]
then then
echo $MYPID > $PANDORA_PID echo $MYPID > $PANDORA_PID

View File

@ -3,12 +3,13 @@
# Pandora Data Server, startup script # Pandora Data Server, startup script
# Sancho Lerena, <slerena@gmail.com> # Sancho Lerena, <slerena@gmail.com>
# Linux Version (generico) # Linux Version (generico)
# v1.3 Build 070731 # v1.3 Build 070802
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/usr/share/pandora_server" PANDORA_HOME="/etc/pandora"
PANDORA_PID_PATH="/var/run/pandora" PANDORA_PID_PATH="/var/run/pandora"
PANDORA_PID=$PANDORA_PID_PATH/pandora_dataserver.pid PANDORA_PID=$PANDORA_PID_PATH/pandora_dataserver.pid
PANDORA_DAEMON=/usr/bin/pandora_server
# Main script # Main script
@ -18,7 +19,7 @@ then
exit exit
fi fi
if [ ! -f $PANDORA_HOME/bin/pandora_server.pl ] if [ ! -f $PANDORA_DAEMON ]
then then
echo "Pandora FMS Data Server not found, please check setup and read manual" echo "Pandora FMS Data Server not found, please check setup and read manual"
exit exit
@ -30,7 +31,7 @@ case "$1" in
if [ -f $PANDORA_PID ] if [ -f $PANDORA_PID ]
then then
CHECK_PID=`cat $PANDORA_PID` CHECK_PID=`cat $PANDORA_PID`
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_server.pl" | wc -l` CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_server" | wc -l`
if [ $CHECK_PID_RESULT == 1 ] if [ $CHECK_PID_RESULT == 1 ]
then then
echo "Pandora FMS Data Server is currently running on this machine with PID ($CHECK_PID). Aborting now..." echo "Pandora FMS Data Server is currently running on this machine with PID ($CHECK_PID). Aborting now..."
@ -38,10 +39,10 @@ case "$1" in
fi fi
fi fi
cd $PANDORA_HOME/bin $PANDORA_DAEMON $PANDORA_HOME -D
./pandora_server.pl $PANDORA_HOME -D sleep 1
MYPID=`ps aux | grep 'pandora_server.pl' | grep -v grep | tail -1 | awk '{print $2}'` MYPID=`ps aux | grep 'pandora_server' | grep -v grep | tail -1 | awk '{print $2}'`
if [ ! -z "$MYPID" ] if [ ! -z "$MYPID" ]
then then
echo $MYPID > $PANDORA_PID echo $MYPID > $PANDORA_PID

View File

@ -3,15 +3,16 @@
# Startup script for Pandora SNMP Console # Startup script for Pandora SNMP Console
# Sancho Lerena, <slerena@gmail.com> # Sancho Lerena, <slerena@gmail.com>
# Linux Version (generic) # Linux Version (generic)
# v1.3 BUILD 070731 # v1.3 BUILD 070802
# Compatible with NetSNMP 5.1 or higher # Compatible with NetSNMP 5.1 or higher
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/usr/share/pandora_server" PANDORA_HOME="/etc/pandora"
PANDORA_PID_PATH="/var/run/pandora" PANDORA_PID_PATH="/var/run/pandora"
PANDORA_PID=$PANDORA_PID_PATH/pandora_snmp.pid PANDORA_PID=$PANDORA_PID_PATH/pandora_snmp.pid
PANDORA_DAEMON=/usr/bin/pandora_snmpconsole
DAEMON_LOG="/var/log/pandora/pandora_snmptrap.log" DAEMON_LOG="/var/log/pandora/pandora_snmptrap.log"
DAEMON_PID="$PANDORA_PID_PATH/pandora_snmptrapd.pid" DAEMON_PID="$PANDORA_PID_PATH/pandora_snmptrapd.pid"
@ -90,7 +91,7 @@ case "$1" in
if [ -f $PANDORA_PID ] if [ -f $PANDORA_PID ]
then then
CHECK_PID=`cat $PANDORA_PID` CHECK_PID=`cat $PANDORA_PID`
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_snmpconsole.pl" | wc -l` CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_snmpconsole" | wc -l`
if [ $CHECK_PID_RESULT == 1 ] if [ $CHECK_PID_RESULT == 1 ]
then then
echo "Pandora FMS SNMP Server is currently running on this machine with PID ($CHECK_PID). Aborting now..." echo "Pandora FMS SNMP Server is currently running on this machine with PID ($CHECK_PID). Aborting now..."
@ -98,10 +99,10 @@ case "$1" in
fi fi
fi fi
cd $PANDORA_HOME/bin $PANDORA_DAEMON $PANDORA_HOME -D
./pandora_snmpconsole.pl $PANDORA_HOME -D sleep 1
MYPID=`ps aux | grep 'pandora_snmpconsole.pl' | grep -v grep | tail -1 | awk '{print $2}'` MYPID=`ps aux | grep 'pandora_snmpconsole' | grep -v grep | tail -1 | awk '{print $2}'`
if [ ! -z "$MYPID" ] if [ ! -z "$MYPID" ]
then then
echo $MYPID > $PANDORA_PID echo $MYPID > $PANDORA_PID