2009-09-25 Sancho Lerena <slerena@artica.es>
* pandora_server.spec: Some fixes to SUSE RPM. * conf/pandora_server.conf: Added some missing default values * lib/PandoraFMS/Config.pm: Added some missing default values. * util/tentacle_serverd, util/pandora_server: SUSE rc.status addon. Need working, SUSE continues giving erratic problems inn startup :( git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1972 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
39d1e16888
commit
8e5fd3281a
|
@ -1,3 +1,15 @@
|
|||
2009-09-25 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* pandora_server.spec: Some fixes to SUSE RPM.
|
||||
|
||||
* conf/pandora_server.conf: Added some missing default values
|
||||
|
||||
* lib/PandoraFMS/Config.pm: Added some missing default values.
|
||||
|
||||
* util/tentacle_serverd, util/pandora_server: SUSE rc.status
|
||||
addon. Need working, SUSE continues giving erratic problems inn
|
||||
startup :(
|
||||
|
||||
2009-09-22 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* pandora_server_installer: Fixes some problems detecting Linux
|
||||
|
|
|
@ -85,6 +85,10 @@ reconserver 1
|
|||
|
||||
pluginserver 1
|
||||
|
||||
# Pandora FMS Plugin exec tool filepath (by default at /usr/local/bin)
|
||||
|
||||
plugin_exec /usr/local/bin/pandora_exec
|
||||
|
||||
# predictionserver : 1 or 0. Set to 1 to activate prediction server with this setup
|
||||
|
||||
predictionserver 1
|
||||
|
|
|
@ -172,7 +172,7 @@ sub pandora_load_config {
|
|||
$pa_config->{"tcp_timeout"} = 20; # Introduced on 1.3.1
|
||||
$pa_config->{"snmp_proc_deadresponse"} = 1; # Introduced on 1.3.1 10 Feb08
|
||||
$pa_config->{"plugin_threads"} = 2; # Introduced on 2.0
|
||||
$pa_config->{"plugin_exec"} = 'pandora_exec'; # 3.0
|
||||
$pa_config->{"plugin_exec"} = '/usr/local/bin/pandora_exec'; # 3.0
|
||||
$pa_config->{"recon_threads"} = 2; # Introduced on 2.0
|
||||
$pa_config->{"prediction_threads"} = 1; # Introduced on 2.0
|
||||
$pa_config->{"plugin_timeout"} = 5; # Introduced on 2.0
|
||||
|
@ -199,7 +199,7 @@ sub pandora_load_config {
|
|||
$pa_config->{"nmap"} = "/usr/bin/nmap";
|
||||
|
||||
# Xprobe2 for recon OS fingerprinting and tcpscan (optional)
|
||||
$pa_config->{"xprobe2"} = "/usr/bin/xprobe";
|
||||
$pa_config->{"xprobe2"} = "/usr/bin/xprobe2";
|
||||
|
||||
|
||||
# Snmpget for snmpget system command (optional)
|
||||
|
|
|
@ -80,7 +80,7 @@ exit 0
|
|||
%post
|
||||
chkconfig -s pandora_server on
|
||||
chkconfig -s tentacle_serverd on
|
||||
echo "/usr/share/pandora_server/util/pandora_db /etc/pandora/pandora_server.conf" > /etc/cron.daily/pandora_db
|
||||
echo "/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" > /etc/cron.daily/pandora_db
|
||||
chmod 750 /etc/cron.daily/pandora_db
|
||||
cp -aRf /usr/share/pandora_server/util/pandora_logrotate /etc/logrotate.d/pandora
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: pandora_server
|
||||
# Required-Start: $syslog mysql
|
||||
# Should-Start: $network
|
||||
# Required-Start: $syslog mysql cron
|
||||
# Should-Start: $network cron
|
||||
# Required-Stop: $syslog mysql
|
||||
# Should-Stop: $network mysql
|
||||
# Default-Start: 2 3 5
|
||||
|
@ -20,31 +20,36 @@
|
|||
### END INIT INFO
|
||||
|
||||
|
||||
PANDORA_HOME="/etc/pandora/pandora_server.conf"
|
||||
PANDORA_PID_PATH="/var/run"
|
||||
PANDORA_PID=$PANDORA_PID_PATH/pandora_server.pid
|
||||
PANDORA_DAEMON=/usr/local/bin/pandora_server
|
||||
export PANDORA_HOME="/etc/pandora/pandora_server.conf"
|
||||
export PANDORA_DAEMON=/usr/local/bin/pandora_server
|
||||
|
||||
# Check for SUSE status scripts
|
||||
if [ -f /etc/rc.status ]
|
||||
then
|
||||
. /etc/rc.status
|
||||
rc_reset
|
||||
else
|
||||
# Define rc functions for non-suse systems, "void" functions.
|
||||
function rc_status () (VOID=1;)
|
||||
function rc_exit () (exit;)
|
||||
function rc_failed () (VOID=1;)
|
||||
|
||||
fi
|
||||
|
||||
# This function replace pidof, not working in the same way in different linux distros
|
||||
|
||||
function pidof_pandora () (
|
||||
PANDORA_PID=`ps aux | grep "$PANDORA_DAEMON $PANDORA_HOME" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
PANDORA_PID=`ps -Af | grep "$PANDORA_DAEMON $PANDORA_HOME" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
echo $PANDORA_PID
|
||||
)
|
||||
|
||||
# Main script
|
||||
|
||||
if [ ! -d "$PANDORA_PID_PATH" ]
|
||||
then
|
||||
echo "Pandora FMS cannot write it's PID file in $PANDORA_PID_PATH. Please create that directory"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -f $PANDORA_DAEMON ]
|
||||
then
|
||||
echo "Pandora FMS Server not found, please check setup and read manual"
|
||||
exit
|
||||
rc_status -s
|
||||
rc_exit
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
|
@ -53,19 +58,23 @@ case "$1" in
|
|||
if [ ! -z "$PANDORA_PID" ]
|
||||
then
|
||||
echo "Pandora FMS Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..."
|
||||
exit 1
|
||||
rc_failed 1
|
||||
rc_exit
|
||||
fi
|
||||
|
||||
$PANDORA_DAEMON $PANDORA_HOME -D
|
||||
sleep 4
|
||||
sleep 1
|
||||
|
||||
PANDORA_PID=`pidof_pandora`
|
||||
|
||||
if [ ! -z "$PANDORA_PID" ]
|
||||
then
|
||||
echo "Pandora Server is now running with PID $PANDORA_PID"
|
||||
rc_status -v
|
||||
else
|
||||
echo "Cannot start Pandora FMS Server. Aborted."
|
||||
echo "Check Pandora FMS log files at '/var/log/pandora/pandora_server.log'"
|
||||
rc_status -s
|
||||
fi
|
||||
;;
|
||||
|
||||
|
@ -74,10 +83,24 @@ case "$1" in
|
|||
if [ -z "$PANDORA_PID" ]
|
||||
then
|
||||
echo "Pandora FMS Server is not running, cannot stop it."
|
||||
exit 1
|
||||
rc_failed
|
||||
else
|
||||
echo "Stopping Pandora FMS Server"
|
||||
kill $PANDORA_PID > /dev/null 2>&1
|
||||
COUNTER=0
|
||||
|
||||
while [ $COUNTER -lt 10 ]
|
||||
do
|
||||
PANDORA_PID=`pidof_pandora`
|
||||
if [ -z "$PANDORA_PID" ]
|
||||
then
|
||||
COUNTER=10
|
||||
fi
|
||||
COUNTER=`expr $COUNTER + 1`
|
||||
sleep 1
|
||||
done
|
||||
|
||||
rc_status -v
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
|
@ -85,10 +108,11 @@ case "$1" in
|
|||
if [ -z "$PANDORA_PID" ]
|
||||
then
|
||||
echo "Pandora FMS Server is not running."
|
||||
rc_status
|
||||
else
|
||||
echo "Pandora FMS Server is running with PID $PANDORA_PID."
|
||||
rc_status
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
force-reload|restart)
|
||||
$0 stop
|
||||
|
@ -99,4 +123,4 @@ case "$1" in
|
|||
echo "Usage: pandora_server { start | stop | restart | status }"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
rc_exit
|
||||
|
|
|
@ -19,6 +19,24 @@
|
|||
# Description: Tentacle Server startup script
|
||||
### END INIT INFO
|
||||
|
||||
# Check for SUSE status scripts
|
||||
if [ -f /etc/rc.status ]
|
||||
then
|
||||
. /etc/rc.status
|
||||
rc_reset
|
||||
else
|
||||
# Define rc functions for non-suse systems, "void" functions.
|
||||
function rc_status () (VOID=1;)
|
||||
function rc_exit () (exit;)
|
||||
function rc_failed () (VOID=1;)
|
||||
|
||||
fi
|
||||
|
||||
function get_pid {
|
||||
TENTACLE_PID=`ps -Af | grep "$TENTACLE_PATH$TENTACLE_DAEMON" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
echo $TENTACLE_PID
|
||||
}
|
||||
|
||||
# Pandora server settings
|
||||
PANDORA_SERVER_PATH="/var/spool/pandora/data_in"
|
||||
|
||||
|
@ -36,14 +54,6 @@ TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5"
|
|||
|
||||
umask 0007
|
||||
|
||||
# Sets the shell variable TENTACLE_PID to the PID of the Tentacle server (empty
|
||||
# if not running). Can be a list of PIDs if multiple instances are running.
|
||||
|
||||
function get_pid {
|
||||
TENTACLE_PID=`ps aux | grep "$TENTACLE_PATH$TENTACLE_DAEMON" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
echo $TENTACLE_PID
|
||||
}
|
||||
|
||||
# Main script
|
||||
TENTACLE_OPTS="-a $TENTACLE_ADDR -p $TENTACLE_PORT -s $PANDORA_SERVER_PATH $TENTACLE_EXT_OPTS -d"
|
||||
|
||||
|
@ -58,7 +68,8 @@ esac
|
|||
|
||||
if [ ! -f "${TENTACLE_PATH}$TENTACLE_DAEMON" ]; then
|
||||
echo "Tentacle server not found in ${TENTACLE_PATH}$TENTACLE_DAEMON."
|
||||
exit 1
|
||||
rc_failed 1
|
||||
rc_exit
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
|
@ -66,57 +77,62 @@ case "$1" in
|
|||
TENTACLE_PID=`get_pid`
|
||||
if [ ! -z "$TENTACLE_PID" ]; then
|
||||
echo "Tentacle server is already running with PID $TENTACLE_PID."
|
||||
exit 1
|
||||
rc_failed 2
|
||||
rc_exit
|
||||
fi
|
||||
|
||||
sudo -u $TENTACLE_USER ${TENTACLE_PATH}$TENTACLE_DAEMON $TENTACLE_OPTS
|
||||
sleep 4
|
||||
sleep 1
|
||||
|
||||
TENTACLE_PID=`get_pid`
|
||||
if [ ! -z "$TENTACLE_PID" ]; then
|
||||
echo "Tentacle server is now running with PID $TENTACLE_PID."
|
||||
rc_status -v
|
||||
else
|
||||
echo "Tentacle server could not be started."
|
||||
exit 1
|
||||
rc_status -v
|
||||
fi
|
||||
|
||||
exit 0
|
||||
;;
|
||||
|
||||
stop)
|
||||
TENTACLE_PID=`get_pid`
|
||||
if [ -z "$TENTACLE_PID" ]; then
|
||||
echo "Tentacle server does not seem to be running."
|
||||
exit 1;
|
||||
rc_failed 2
|
||||
else
|
||||
kill $TENTACLE_PID > /dev/null 2>&1
|
||||
kill $TENTACLE_PID
|
||||
sleep 1
|
||||
TENTACLE_PID=`get_pid`
|
||||
|
||||
get_pid
|
||||
if [ ! -z "$TENTACLE_PID" ]; then
|
||||
echo "Tentacle server could not be stopped."
|
||||
exit 1
|
||||
rc_status -s
|
||||
fi
|
||||
|
||||
echo "Tentacle server stopped."
|
||||
rc_status -v
|
||||
fi
|
||||
|
||||
exit 0
|
||||
;;
|
||||
|
||||
force-reload|restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
|
||||
status)
|
||||
TENTACLE_PID=`get_pid`
|
||||
if [ -z "$TENTACLE_PID" ]; then
|
||||
echo "Tentacle server is not running."
|
||||
rc_status
|
||||
else
|
||||
echo "Tentacle server is running with PID $TENTACLE_PID."
|
||||
rc_status
|
||||
fi
|
||||
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -125,3 +141,4 @@ case "$1" in
|
|||
;;
|
||||
esac
|
||||
|
||||
rc_exit
|
||||
|
|
Loading…
Reference in New Issue