|
|
@ -2,19 +2,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
# **********************************************************************
|
|
|
|
# **********************************************************************
|
|
|
|
# Pandora FMS Agent Installer for Unix (generic installer)
|
|
|
|
# Pandora FMS Agent Installer for Unix (generic installer)
|
|
|
|
# (c) 2008-2009 Artica ST
|
|
|
|
# (c) 2008-2010 Artica ST
|
|
|
|
# (c) 2008-2009 Sancho Lerena <slerena@gmail.com>
|
|
|
|
# (c) 2008-2010 Sancho Lerena <slerena@gmail.com>
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This is a generic installer for all Unix-like systems.(AIX, HP-UX, SunOS, Linux)
|
|
|
|
# This is a generic installer for all Unix-like systems.(AIX, HP-UX, SunOS, Linux)
|
|
|
|
# Please see http://www.pandorafms.org
|
|
|
|
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
|
|
|
# v3.0 Build 091215
|
|
|
|
|
|
|
|
# This code is licensed under GPL 2.0 license.
|
|
|
|
|
|
|
|
# **********************************************************************
|
|
|
|
# **********************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
PI_VERSION=3.0.0RC2
|
|
|
|
PI_VERSION=3.1
|
|
|
|
PI_BUILD=091119
|
|
|
|
PI_BUILD=100515
|
|
|
|
OS_NAME=`uname -s`
|
|
|
|
OS_NAME=`uname -s`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FORCE=0
|
|
|
|
|
|
|
|
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
|
|
|
PANDORA_HOME=/usr/share/pandora_agent
|
|
|
|
PANDORA_HOME=/usr/share/pandora_agent
|
|
|
|
PANDORA_BIN=/usr/bin/pandora_agent
|
|
|
|
PANDORA_BIN=/usr/bin/pandora_agent
|
|
|
|
PANDORA_TEMP=/var/spool/pandora
|
|
|
|
PANDORA_TEMP=/var/spool/pandora
|
|
|
@ -22,24 +22,16 @@ PANDORA_CFG=/etc/pandora
|
|
|
|
PANDORA_LOG_DIR=/var/log/pandora
|
|
|
|
PANDORA_LOG_DIR=/var/log/pandora
|
|
|
|
PANDORA_LOG=pandora_agent.log
|
|
|
|
PANDORA_LOG=pandora_agent.log
|
|
|
|
TENTACLE=/usr/bin/tentacle_client
|
|
|
|
TENTACLE=/usr/bin/tentacle_client
|
|
|
|
FORCE=0
|
|
|
|
|
|
|
|
USE_LINKS=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MODE=$1
|
|
|
|
MODE=$1
|
|
|
|
|
|
|
|
PANDORA_BASE=$2
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$2" ]
|
|
|
|
# Check for Perl 5.6.x or higher available
|
|
|
|
then
|
|
|
|
PERL_VERSION=`perl -v | egrep 'v5.6|v5.7|v5.8|v5.9|v5.1[0-9]' | grep perl`
|
|
|
|
PANDORA_HOME=$2
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check for Perl 5.8.x available
|
|
|
|
|
|
|
|
PERL_VERSION=`perl -v | egrep 'v5.8|v5.9|v5.1[0-9]' | grep perl`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$PERL_VERSION" ]
|
|
|
|
if [ -z "$PERL_VERSION" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
echo "Perl 5.8.x is not detected. This is required for Pandora FMS"
|
|
|
|
echo "Perl 5.6.x or higher is not detected. This is required for Pandora FMS"
|
|
|
|
echo "Detected: $PERL_VERSION "
|
|
|
|
echo "Detected: $PERL_VERSION "
|
|
|
|
echo "Aborting install..."
|
|
|
|
echo "Aborting install..."
|
|
|
|
exit 2
|
|
|
|
exit 2
|
|
|
@ -67,48 +59,56 @@ fi
|
|
|
|
if [ ! -f "pandora_agent" ]
|
|
|
|
if [ ! -f "pandora_agent" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo "Execute installer from the directory where you have your files. For example:"
|
|
|
|
echo "Execute installer from the directory where you have your files. "
|
|
|
|
|
|
|
|
echo "Syntax":
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo " cd /tmp/pandora_install "
|
|
|
|
echo " ./pandora_agent_install < --mode > [ destination_path ]"
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
echo "Some exaples of how to use the installer:"
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
echo " cd /tmp/pandora_install "
|
|
|
|
echo " ./pandora_agent_installer --install"
|
|
|
|
echo " ./pandora_agent_installer --install"
|
|
|
|
echo " ./pandora_agent_installer --install-with-links /var/opt/PandoraFMS"
|
|
|
|
echo " ./pandora_agent_installer --install-with-links /var/opt/PandoraFMS"
|
|
|
|
|
|
|
|
echo " ./pandora_agent_installer --install /opt/pandora"
|
|
|
|
|
|
|
|
echo " ./pandora_agent_installer --uninstall /opt/pandora"
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
uninstall () {
|
|
|
|
uninstall () {
|
|
|
|
echo "Removing Pandora FMS Agent..."
|
|
|
|
echo "Removing Pandora FMS Agent..."
|
|
|
|
rm -Rf $PANDORA_BIN
|
|
|
|
rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
#Test if exist Pandora Server in this machine
|
|
|
|
#Test if exist Pandora Server in this machine
|
|
|
|
if [ -d $PANDORA_TEMP/data_in ]
|
|
|
|
if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
echo "You have a Pandora Server in this machine. Then don't delete "$PANDORA_TEMP
|
|
|
|
echo "You have a Pandora Server in this machine. Then don't delete "$PANDORA_TEMP
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -Rf $PANDORA_TEMP
|
|
|
|
rm -Rf $PANDORA_BASE$PANDORA_TEMP 2> /dev/null
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
rm -Rf $PANDORA_CFG/pandora_agent.conf
|
|
|
|
rm -Rf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2> /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
rm -Rf /etc/init.d/pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf $PANDORA_BASE/etc/init.d/pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf /sbin/init.d/pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf $PANDORA_BASE/sbin/init.d/pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf /etc/rc.pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf $PANDORA_BASE/etc/rc.pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf /etc/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf /sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
|
|
|
rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
rm -Rf $PANDORA_HOME
|
|
|
|
rm -Rf $PANDORA_BASE$PANDORA_HOME 2> /dev/null
|
|
|
|
rm -Rf $PANDORA_LOG_DIR
|
|
|
|
rm -Rf $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null
|
|
|
|
rm -Rf $TENTACLE
|
|
|
|
rm -Rf $PANDORA_BASE$TENTACLE 2> /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
# Skip delete of /etc/pandora if exists configuration of a server
|
|
|
|
# Skip delete of /etc/pandora if exists configuration of a server
|
|
|
|
if [ ! -f /etc/pandora/pandora_server.conf ]
|
|
|
|
if [ ! -f $PANDORA_BASE/etc/pandora/pandora_server.conf ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
rm -Rf /etc/pandora
|
|
|
|
rm -Rf $PANDORA_BASE/etc/pandora 2> /dev/null
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "If you install Pandora FMS agent in a custom directory, you should"
|
|
|
|
if [ ! -z "$PANDORA_BASE" ]
|
|
|
|
echo " delete it yourself with command rm -Rf <yourdir>, for example:"
|
|
|
|
then
|
|
|
|
echo " "
|
|
|
|
echo "Please delete manually $PANDORA_BASE for complete uninstall"
|
|
|
|
echo " rm -Rf /opt/software/pandora"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo "Done"
|
|
|
|
echo "Done"
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -119,99 +119,131 @@ install () {
|
|
|
|
OS_NAME=`uname -s`
|
|
|
|
OS_NAME=`uname -s`
|
|
|
|
OLDFILENAMETMP=`date +"%Y-%m-%d"`
|
|
|
|
OLDFILENAMETMP=`date +"%Y-%m-%d"`
|
|
|
|
echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION"
|
|
|
|
echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION"
|
|
|
|
if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ]
|
|
|
|
if [ -f $PANDORA_BASE$PANDORA_HOME ] && [ "$FORCE" = "0" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
echo "Seems that default dir already exists. Please use --force to"
|
|
|
|
echo "Seems that default dir already exists. Please use --force to"
|
|
|
|
echo "force installer to install on $PANDORA_HOME"
|
|
|
|
echo "force installer to install on $PANDORA_BASE$PANDORA_HOME"
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "Checking default dir $PANDORA_HOME..."
|
|
|
|
echo "Checking default dir $PANDORA_BASE$PANDORA_HOME..."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -f $PANDORA_BIN ] && [ "$FORCE" = "0" ]
|
|
|
|
if [ -f $PANDORA_BASE$PANDORA_BIN ] && [ "$FORCE" = "0" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
echo "Seems that $PANDORA_BIN already exists. Please use --force to"
|
|
|
|
echo "Seems that $PANDORA_BASE$PANDORA_BIN already exists. Please use --force to"
|
|
|
|
echo "force installer to reinstall overwriting it"
|
|
|
|
echo "force installer to reinstall overwriting it"
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "Checking Pandora FMS Agent on $PANDORA_BIN...."
|
|
|
|
echo "Checking Pandora FMS Agent on $PANDORA_BASE$PANDORA_BIN...."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "Creating Pandora FMS Agent home directory at $PANDORA_HOME ..."
|
|
|
|
echo "Creating Pandora FMS Agent home directory at $PANDORA_BASE$PANDORA_HOME"
|
|
|
|
mkdir -p $PANDORA_HOME 2> /dev/null
|
|
|
|
if [ ! -z "$PANDORA_BASE" ]
|
|
|
|
|
|
|
|
then
|
|
|
|
# IF USE_LINKS = 1 then append HOME to other paths
|
|
|
|
mkdir -p $PANDORA_BASE 2> /dev/null
|
|
|
|
if [ "$USE_LINKS" = 1 ]
|
|
|
|
mkdir -p $PANDORA_BASE/usr/bin 2> /dev/null
|
|
|
|
then
|
|
|
|
mkdir -p $PANDORA_BASE/var/log 2> /dev/null
|
|
|
|
mkdir -p $PANDORA_HOME/$PANDORA_TEMP/data_out 2> /dev/null
|
|
|
|
mkdir -p $PANDORA_BASE/usr/share/man/man1 2> /dev/null
|
|
|
|
mkdir -p $PANDORA_LOG_DIR 2> /dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
ln -s $PANDORA_HOME /etc/pandora
|
|
|
|
mkdir -p $PANDORA_BASE$PANDORA_HOME 2> /dev/null
|
|
|
|
ln -s $PANDORA_HOME/$PANDORA_TEMP /var/spool/pandora
|
|
|
|
|
|
|
|
else
|
|
|
|
# Create directories based on PANDORA_BASE
|
|
|
|
# Create directories on /
|
|
|
|
|
|
|
|
mkdir -p $PANDORA_TEMP/data_out 2> /dev/null
|
|
|
|
mkdir -p $PANDORA_BASE/tmp 2> /dev/null
|
|
|
|
mkdir -p $PANDORA_CFG 2> /dev/null
|
|
|
|
mkdir -p $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null
|
|
|
|
mkdir -p $PANDORA_LOG_DIR 2> /dev/null
|
|
|
|
mkdir -p $PANDORA_BASE$PANDORA_CFG 2> /dev/null
|
|
|
|
fi
|
|
|
|
mkdir -p $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
# Create logfile
|
|
|
|
# Create logfile
|
|
|
|
if [ ! -z "`touch $PANDORA_LOG_DIR/$PANDORA_LOG`" ]
|
|
|
|
if [ ! -z "`touch $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG`" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
echo "Seems to be a problem generating logfile ($PANDORA_LOG_DIR/$PANDORA_LOG) please check it";
|
|
|
|
echo "Seems to be a problem generating logfile ($PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG) please check it";
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "Created logfile at $PANDORA_LOG_DIR/$PANDORA_LOG..."
|
|
|
|
echo "Created logfile at $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG..."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
|
|
|
|
echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_LOG_DIR/$PANDORA_LOG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Copying agent and securing it
|
|
|
|
# Copying agent and securing it
|
|
|
|
echo "Copying Pandora FMS Agent to $PANDORA_BIN..."
|
|
|
|
echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..."
|
|
|
|
cp pandora_agent $PANDORA_BIN
|
|
|
|
cp pandora_agent $PANDORA_BASE$PANDORA_BIN
|
|
|
|
chmod 755 $PANDORA_BIN
|
|
|
|
chmod 755 $PANDORA_BASE$PANDORA_BIN
|
|
|
|
chown root:root $PANDORA_BIN
|
|
|
|
chown root:root $PANDORA_BASE$PANDORA_BIN
|
|
|
|
|
|
|
|
|
|
|
|
echo "Copying Pandora FMS Agent configuration file to $PANDORA_HOME/pandora_agent.conf..."
|
|
|
|
echo "Copying Pandora FMS Agent configuration file to $PANDORA_BASE$PANDORA_HOME/pandora_agent.conf..."
|
|
|
|
if [ -f /etc/pandora/pandora_agent.conf ]
|
|
|
|
if [ -f $PANDORA_BASE/etc/pandora/pandora_agent.conf ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
cat /etc/pandora/pandora_agent.conf > /etc/pandora/pandora_agent.conf.$OLDFILENAMETMP
|
|
|
|
cp $PANDORA_BASE/etc/pandora/pandora_agent.conf $PANDORA_BASE/etc/pandora/pandora_agent.conf.$OLDFILENAMETMP
|
|
|
|
echo "Backing up old configuration file to /etc/pandora_agent.conf.$OLDFILENAMETMP"
|
|
|
|
echo "Backing up old configuration file to $PANDORA_BASE/etc/pandora_agent.conf.$OLDFILENAMETMP"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "Copying default agent configuration to $PANDORA_HOME/pandora_agent.conf"
|
|
|
|
|
|
|
|
cp $OS_NAME/pandora_agent.conf $PANDORA_HOME/pandora_agent.conf
|
|
|
|
|
|
|
|
chmod 600 $PANDORA_HOME/pandora_agent.conf
|
|
|
|
|
|
|
|
chown root $PANDORA_HOME/pandora_agent.conf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Copying Pandora FMS Agent plugins to $PANDORA_HOME/plugins..."
|
|
|
|
echo "Copying Pandora FMS Agent plugins to $PANDORA_BASE$PANDORA_HOME/plugins..."
|
|
|
|
cp -r plugins $PANDORA_HOME
|
|
|
|
cp -r plugins $PANDORA_BASE$PANDORA_HOME
|
|
|
|
chmod -R 700 $PANDORA_HOME/plugins
|
|
|
|
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/plugins
|
|
|
|
|
|
|
|
ln -s $PANDORA_BASE$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
|
|
|
|
|
|
|
|
|
|
|
|
echo "Copying tentacle client to $TENTACLE"
|
|
|
|
echo "Copying tentacle client to $PANDORA_BASE$TENTACLE"
|
|
|
|
cp tentacle_client $TENTACLE
|
|
|
|
cp tentacle_client $PANDORA_BASE$TENTACLE
|
|
|
|
chmod 755 $TENTACLE
|
|
|
|
chmod 755 $PANDORA_BASE$TENTACLE
|
|
|
|
|
|
|
|
|
|
|
|
echo "Installing Tentacle Client manual"
|
|
|
|
echo "Installing Tentacle Client manual"
|
|
|
|
cp ../man/man1/tentacle_client.1.gz /usr/share/man/man1
|
|
|
|
if [ -e ../man/man1/tentacle_client.1.gz ]
|
|
|
|
|
|
|
|
then
|
|
|
|
if [ "$USE_LINKS" != 1 ]
|
|
|
|
cp ../man/man1/tentacle_client.1.gz $PANDORA_BASE/usr/share/man/man1
|
|
|
|
then
|
|
|
|
else
|
|
|
|
echo "Linking Pandora FMS Agent plugins directory to $PANDORA_CFG/plugins..."
|
|
|
|
cp man/man1/tentacle_client.1.gz $PANDORA_BASE/usr/share/man/man1
|
|
|
|
rm $PANDORA_CFG/plugins 2> /dev/null
|
|
|
|
fi
|
|
|
|
ln -s $PANDORA_HOME/plugins $PANDORA_CFG/plugins 2> /dev/null
|
|
|
|
chmod 644 $PANDORA_BASE/usr/share/man/man1/tentacle_client.1.gz
|
|
|
|
|
|
|
|
|
|
|
|
echo "Linking Pandora FMS Agent configuration to $PANDORA_CFG/pandora_agent.conf..."
|
|
|
|
|
|
|
|
rm $PANDORA_CFG/pandora_agent.conf 2> /dev/null
|
|
|
|
|
|
|
|
ln -s $PANDORA_HOME/pandora_agent.conf $PANDORA_CFG/pandora_agent.conf
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
|
|
|
|
echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
|
|
|
|
chown -R root $PANDORA_HOME
|
|
|
|
chown -R root $PANDORA_BASE$PANDORA_HOME
|
|
|
|
chmod -R 600 $PANDORA_TEMP
|
|
|
|
chmod -R 600 $PANDORA_BASE$PANDORA_TEMP
|
|
|
|
chown root $PANDORA_TEMP
|
|
|
|
chown root $PANDORA_BASE$PANDORA_TEMP
|
|
|
|
chmod 640 $PANDORA_LOG_DIR/$PANDORA_LOG
|
|
|
|
chmod 640 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
|
|
|
|
chown root:root $PANDORA_LOG_DIR/$PANDORA_LOG
|
|
|
|
chown root:root $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Alter dynamically the daemon launcher and setup the new path
|
|
|
|
|
|
|
|
# if PANDORA_BASE is customized.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$PANDORA_BASE" ]
|
|
|
|
|
|
|
|
then
|
|
|
|
|
|
|
|
DAEMON_SCRIPT=pandora_agent_daemon
|
|
|
|
|
|
|
|
DAEMON_TEMP=pandora_agent_daemon_temp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AGENT_CFG=$OS_NAME/pandora_agent.conf
|
|
|
|
|
|
|
|
AGENT_CFG_TEMP=$OS_NAME/pandora_agent.conf.temp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $PANDORA_BASE > PANDORA_BASE.temp
|
|
|
|
|
|
|
|
sed 's/\//\\\//g' PANDORA_BASE.temp > PANDORA_BASE.temp2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PANDORA_BASE_DECODED=`cat PANDORA_BASE.temp2`
|
|
|
|
|
|
|
|
rm PANDORA_BASE.temp PANDORA_BASE.temp2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sed -e "s/^PATH\=[.]*/PATH\=$PANDORA_BASE_DECODED\/usr\/bin\:/g" $DAEMON_SCRIPT > $DAEMON_TEMP
|
|
|
|
|
|
|
|
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sed -e "s/^PANDORA_PATH\=[.]*/PANDORA_PATH\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP
|
|
|
|
|
|
|
|
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sed -e "s/^LOGFILE\=[.]*/LOGFILE\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP
|
|
|
|
|
|
|
|
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sed -e "s/^DAEMON\=[.]*/DAEMON\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP
|
|
|
|
|
|
|
|
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sed -e "s/^temporal [.]*/temporal $PANDORA_BASE_DECODED/g" $AGENT_CFG > $AGENT_CFG_TEMP
|
|
|
|
|
|
|
|
mv $AGENT_CFG_TEMP $AGENT_CFG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sed -e "s/^logfile [.]*/logfile $PANDORA_BASE_DECODED/g" $AGENT_CFG > $AGENT_CFG_TEMP
|
|
|
|
|
|
|
|
mv $AGENT_CFG_TEMP $AGENT_CFG
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Copying default agent configuration to $PANDORA_BASE$PANDORA_HOME/pandora_agent.conf"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
|
|
|
|
|
|
|
|
chmod 600 $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
|
|
|
|
|
|
|
|
chown root $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
|
|
|
|
|
|
|
|
|
|
|
|
echo "Linking start-up daemon script 'pandora_agent_daemon' on $OS_NAME";
|
|
|
|
echo "Linking start-up daemon script 'pandora_agent_daemon' on $OS_NAME";
|
|
|
|
|
|
|
|
|
|
|
@ -224,45 +256,55 @@ install () {
|
|
|
|
|
|
|
|
|
|
|
|
if [ $OS_NAME = "HP-UX" ]
|
|
|
|
if [ $OS_NAME = "HP-UX" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
cp pandora_agent_daemon /sbin/init.d/pandora_agent_daemon
|
|
|
|
PANDORA_STARTUP=/sbin/init.d/pandora_agent_daemon
|
|
|
|
ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc3.d/S90pandora_agent_daemon
|
|
|
|
cp pandora_agent_daemon $PANDORA_STARTUP
|
|
|
|
ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc2.d/S90pandora_agent_daemon
|
|
|
|
ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc3.d/S90pandora_agent_daemon 2> /dev/null
|
|
|
|
|
|
|
|
ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc2.d/S90pandora_agent_daemon 2> /dev/null
|
|
|
|
echo "Pandora FMS agent has been included in /sbin/rcX.d/S90pandora_agent_daemon"
|
|
|
|
echo "Pandora FMS agent has been included in /sbin/rcX.d/S90pandora_agent_daemon"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ $OS_NAME = "SunOS" ]
|
|
|
|
if [ $OS_NAME = "SunOS" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
cp pandora_agent_daemon /etc/init.d/pandora_agent_daemon
|
|
|
|
PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent_daemon
|
|
|
|
cp pandora_agent_daemon $PANDORA_STARTUP
|
|
|
|
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent_daemon 2> /dev/null
|
|
|
|
echo "Pandora FMS agent has been included in /etc/rc2.d/S90pandora_agent_daemon"
|
|
|
|
echo "Pandora FMS agent has been included in /etc/rc2.d/S90pandora_agent_daemon"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ $OS_NAME = "Linux" ]
|
|
|
|
if [ $OS_NAME = "Linux" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
cp pandora_agent_daemon /etc/init.d/pandora_agent_daemon
|
|
|
|
PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon
|
|
|
|
|
|
|
|
cp pandora_agent_daemon $PANDORA_STARTUP
|
|
|
|
if [ -d /etc/rc.d/ ]
|
|
|
|
if [ -d /etc/rc.d/ ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc2.d/S90pandora_agent
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc2.d/S90pandora_agent 2> /dev/null
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc3.d/S90pandora_agent
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc3.d/S90pandora_agent 2> /dev/null
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent
|
|
|
|
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "Installing Pandora Agent manual"
|
|
|
|
echo "Installing Pandora Agent manual"
|
|
|
|
cp ../man/man1/pandora_agent.1.gz /usr/share/man/man1
|
|
|
|
if [ -e ../man/man1/pandora_agent.1.gz ]
|
|
|
|
|
|
|
|
then
|
|
|
|
|
|
|
|
cp ../man/man1/pandora_agent.1.gz $PANDORA_BASE/usr/share/man/man1
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
cp man/man1/pandora_agent.1.gz $PANDORA_BASE/usr/share/man/man1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
chmod 644 $PANDORA_BASE/usr/share/man/man1/pandora_agent.1.gz
|
|
|
|
|
|
|
|
|
|
|
|
echo "Done."
|
|
|
|
echo "Done."
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo "You have your startup script ready at $PANDORA_STARTUP"
|
|
|
|
echo "You have your startup script ready at $PANDORA_STARTUP"
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo "Tentacle is the default transfer mode since 2.0 version."
|
|
|
|
echo "Tentacle is the default transfer mode since 2.0 version."
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
echo "If you want to use SSH, firstly you need to copy your public SSH keys "
|
|
|
|
echo "If you want to use SSH, firstly you need to copy your public SSH keys "
|
|
|
|
echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys "
|
|
|
|
echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys "
|
|
|
|
echo "on your Pandora FMS Server host"
|
|
|
|
echo "on your Pandora FMS Server host"
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo "You also need to setup your $PANDORA_CFG/pandora_agent.conf config file"
|
|
|
|
echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file"
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo "Check your startup configuration to be sure Pandora FMS Agent is ready "
|
|
|
|
echo "Check your startup configuration to be sure Pandora FMS Agent is ready "
|
|
|
|
echo "to start automatically when system restarts":
|
|
|
|
echo "to start automatically when system restarts":
|
|
|
@ -270,22 +312,34 @@ install () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
help () {
|
|
|
|
help () {
|
|
|
|
|
|
|
|
echo "Syntax":
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
echo " ./pandora_agent_install < --mode > [ destination_path ]"
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
echo "Modes:"
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
echo " --force-install To force installation if already installed on system"
|
|
|
|
echo " --force-install To force installation if already installed on system"
|
|
|
|
echo " (Not compatible with --install-with-links "
|
|
|
|
echo " (Not compatible with --install-with-links "
|
|
|
|
echo " --install To install Pandora FMS Agent on this system"
|
|
|
|
echo " --install To install Pandora FMS Agent on this system"
|
|
|
|
echo " --uninstall To uninstall/remove Pandora FMS Agent on this System"
|
|
|
|
echo " --uninstall To uninstall/remove Pandora FMS Agent on this System"
|
|
|
|
echo " --install-with-links <base_dir> "
|
|
|
|
echo " "
|
|
|
|
echo " To install Pandora FMS in a defined dir <base_dir>"
|
|
|
|
echo "Some exaples of how to use the installer:"
|
|
|
|
echo " and set all Pandora FMS directories as links to this"
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
echo " cd /tmp/pandora_install "
|
|
|
|
|
|
|
|
echo " ./pandora_agent_installer --install"
|
|
|
|
|
|
|
|
echo " ./pandora_agent_installer --install /opt/pandora"
|
|
|
|
|
|
|
|
echo " ./pandora_agent_installer --uninstall /opt/pandora"
|
|
|
|
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Script banner at start
|
|
|
|
# Script banner at start
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2009 ArticaST"
|
|
|
|
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2010 ArticaST"
|
|
|
|
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
|
|
|
|
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
|
|
|
|
echo " "
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "$MODE" in
|
|
|
|
case "$MODE" in
|
|
|
|
|
|
|
|
|
|
|
|
'--force-install')
|
|
|
|
'--force-install')
|
|
|
@ -299,12 +353,6 @@ case "$MODE" in
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
|
|
'--install-with-links')
|
|
|
|
|
|
|
|
USE_LINKS=1
|
|
|
|
|
|
|
|
install
|
|
|
|
|
|
|
|
exit
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'--uninstall')
|
|
|
|
'--uninstall')
|
|
|
|
uninstall
|
|
|
|
uninstall
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|