2009-11-29 Raul Mateos <raulofpandora@gmail.com>

* linux/pandora_agent_installer: Added Ubuntu specific stop scripts.
	Added link removing with update-rc.d. Changed temp directory (it
	added duplicated data_out directories). Use tabs instead spaces.

	* linux/pandora_agent_daemon: Use log file in /var/log/pandora/ directory.

	* linux/pandora_agent.conf: Changed temp directory to the one created
	by installer.

	* linux/DEBIAN/control, DEBIAN/make_deb_package.sh: Changed string from rc2
	to RC3.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2141 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
raulmateos 2009-11-29 13:35:16 +00:00
parent 957b7b4e88
commit 5458231989
6 changed files with 133 additions and 110 deletions

View File

@ -1,6 +1,20 @@
2009-11-29 Raul Mateos <raulofpandora@gmail.com>
* linux/pandora_agent_installer: Added Ubuntu specific stop scripts.
Added link removing with update-rc.d. Changed temp directory (it
added duplicated data_out directories). Use tabs instead spaces.
* linux/pandora_agent_daemon: Use log file in /var/log/pandora/ directory.
* linux/pandora_agent.conf: Changed temp directory to the one created
by installer.
* linux/DEBIAN/control, DEBIAN/make_deb_package.sh: Changed string from rc2
to RC3.
2009-11-19 Sancho Lerena <slerena@artica.es>
* unix/pandora_agent_installer: Updated help to avoid confussion about force
* unix/pandora_agent_installer: Updated help to avoid confussion about force
install mode.
* unix/pandora_agent.spec: Create temp directory. Fixed.

View File

@ -1,5 +1,5 @@
package: PandoraFMS-Agent
Version: 3.0.0.rc2
Version: 3.0.0.RC3
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_agent_version="3.0.0.rc2"
pandora_agent_version="3.0.0.RC3"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -9,7 +9,7 @@
server_ip localhost
server_path /var/spool/pandora/data_in
temporal /tmp
temporal /var/spool/pandora/data_out
logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default

View File

@ -19,7 +19,7 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
PANDORA_PATH=/etc/pandora
DAEMON=/usr/bin/pandora_agent
LOGFILE=/var/log/pandora_agent.log
LOGFILE=/var/log/pandora/pandora_agent.log
# This function replace pidof, not working in the same way in different linux distros
@ -57,7 +57,7 @@ case "$1" in
echo "Pandora FMS Agent is not running, cannot stop it. Aborting now..."
exit 1
else
echo "Stopping Pandora Agent."
echo "Stopping Pandora FMS Agent."
kill $PANDORA_PID > /dev/null 2>&1
fi
;;

View File

@ -4,7 +4,7 @@
# Linux Version (generic), for SuSe and Debian/Ubuntu only
# other Linux distros could not work properly without modifications
# Please see http://www.pandorafms.org
# v3.0 Build 090810
# v3.0.1 Build 091129
# This code is licensed under GPL 2.0 license.
# **********************************************************************
@ -67,6 +67,7 @@ get_distro () {
}
uninstall () {
DISTRO=`get_distro`
echo "Removing Pandora FMS Agent..."
rm -Rf $PANDORA_BIN
rm -Rf $PANDORA_TEMP
@ -75,124 +76,132 @@ uninstall () {
rm -Rf $PANDORA_HOME
rm -Rf $PANDORA_LOG
rm -Rf $TENTACLE
if [ "$DISTRO" == "UBUNTU" ]
then
# Removing linking daemon scripts
update-rc.d -f pandora_agent_daemon remove
fi
echo "Done"
}
install () {
DISTRO=`get_distro`
OLDFILENAMETMP=`date +"%Y-%m-%d"`
DISTRO=`get_distro`
OLDFILENAMETMP=`date +"%Y-%m-%d"`
echo "Detecting Linux distribution: $DISTRO"
echo "Detecting Linux distribution: $DISTRO"
if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ]
then
echo "Seems that default dir already exists. Please use --force to"
echo "force installer to install on $PANDORA_HOME"
exit
else
echo "Checking default dir $PANDORA_HOME..."
fi
if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ]
then
echo "Seems that default dir already exists. Please use --force-install to"
echo "force installer to install on $PANDORA_HOME"
exit
else
echo "Checking default dir $PANDORA_HOME..."
fi
if [ -f $PANDORA_BIN ] && [ "$FORCE" = "0" ]
then
echo "Seems that $PANDORA_BIN already exists. Please use --force to"
echo "force installer to reinstall overwriting it"
echo " "
exit
else
echo "Checking Pandora FMS Agent on $PANDORA_BIN...."
fi
if [ -f $PANDORA_BIN ] && [ "$FORCE" = "0" ]
then
echo "Seems that $PANDORA_BIN already exists. Please use --force-install to"
echo "force installer to reinstall overwriting it"
echo " "
exit
else
echo "Checking Pandora FMS Agent on $PANDORA_BIN...."
fi
# Create directories
echo "Creating Pandora FMS Agent home directory at $PANDORA_HOME ..."
mkdir $PANDORA_HOME 2> /dev/null
mkdir -p $PANDORA_TEMP/data_out 2> /dev/null
mkdir $PANDORA_CFG 2> /dev/null
mkdir /var/log/pandora 2> /dev/null
# Create directories
echo "Creating Pandora FMS Agent home directory at $PANDORA_HOME ..."
mkdir $PANDORA_HOME 2> /dev/null
mkdir -p $PANDORA_TEMP 2> /dev/null
mkdir $PANDORA_CFG 2> /dev/null
mkdir /var/log/pandora 2> /dev/null
# Create logfile
if [ ! -z "`touch $PANDORA_LOG`" ]
then
echo "Seems to be a problem generating logfile ($PANDORA_LOG) please check it";
else
echo "Creating logfile at $PANDORA_LOG..."
fi
# Create logfile
if [ ! -z "`touch $PANDORA_LOG`" ]
then
echo "Seems to be a problem generating logfile ($PANDORA_LOG) please check it";
else
echo "Creating logfile at $PANDORA_LOG..."
fi
echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_LOG
echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_LOG
# Copying agent and securing it
echo "Copying Pandora FMS Agent to $PANDORA_BIN..."
cp pandora_agent $PANDORA_BIN
chmod 700 $PANDORA_BIN
echo "Copying Pandora FMS Agent contrib dir to $PANDORA_HOME/..."
cp pandora_agent_daemon $PANDORA_HOME
# Copying agent and securing it
echo "Copying Pandora FMS Agent to $PANDORA_BIN..."
cp pandora_agent $PANDORA_BIN
chmod 700 $PANDORA_BIN
echo "Copying Pandora FMS Agent configuration file to $PANDORA_HOME/pandora_agent.conf..."
if [ -e /etc/pandora/pandora_agent.conf ]
then
cat /etc/pandora/pandora_agent.conf > /etc/pandora/pandora_agent.conf.$OLDFILENAMETMP
echo "Backing up old configuration file to /etc/pandora_agent.conf.$OLDFILENAMETMP"
fi
echo "Copying Pandora FMS Agent contrib dir to $PANDORA_HOME/..."
cp pandora_agent_daemon $PANDORA_HOME
echo "Copying Pandora FMS Agent configuration file to $PANDORA_HOME/pandora_agent.conf..."
if [ -e /etc/pandora/pandora_agent.conf ]
then
cat /etc/pandora/pandora_agent.conf > /etc/pandora/pandora_agent.conf.$OLDFILENAMETMP
echo "Backing up old configuration file to /etc/pandora_agent.conf.$OLDFILENAMETMP"
fi
echo "Copying default agent configuration to $PANDORA_HOME/pandora_agent.conf"
cp pandora_agent.conf $PANDORA_HOME/pandora_agent.conf
chmod 600 $PANDORA_HOME/pandora_agent.conf
echo "Copying default agent configuration to $PANDORA_HOME/pandora_agent.conf"
cp pandora_agent.conf $PANDORA_HOME/pandora_agent.conf
chmod 600 $PANDORA_HOME/pandora_agent.conf
echo "Copying Pandora FMS Agent plugins to $PANDORA_HOME/plugins..."
cp -r plugins $PANDORA_HOME
chmod -R 700 $PANDORA_HOME/plugins
echo "Copying Pandora FMS Agent plugins to $PANDORA_HOME/plugins..."
cp -r plugins $PANDORA_HOME
chmod -R 700 $PANDORA_HOME/plugins
echo "Copying tentacle client to $TENTACLE"
cp tentacle_client $TENTACLE
echo "Copying tentacle client to $TENTACLE"
cp tentacle_client $TENTACLE
echo "Linking Pandora FMS Agent plugins directory to $PANDORA_CFG/plugins..."
rm $PANDORA_CFG/plugins 2> /dev/null
ln -s $PANDORA_HOME/plugins $PANDORA_CFG 2> /dev/null
echo "Linking Pandora FMS Agent plugins directory to $PANDORA_CFG/plugins..."
rm $PANDORA_CFG/plugins 2> /dev/null
ln -s $PANDORA_HOME/plugins $PANDORA_CFG 2> /dev/null
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
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
echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
chown -R root $PANDORA_HOME
chmod -R 600 $PANDORA_TEMP/data_out
chmod 640 $PANDORA_LOG
chgrp root $PANDORA_LOG
echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
chown -R root $PANDORA_HOME
chmod -R 600 $PANDORA_TEMP
chmod 640 $PANDORA_LOG
chgrp root $PANDORA_LOG
echo "Linking start-up daemon script at $PANDORA_STARTUP";
cp pandora_agent_daemon $PANDORA_STARTUP
echo "Linking start-up daemon script at $PANDORA_STARTUP";
cp pandora_agent_daemon $PANDORA_STARTUP
if [ "$DISTRO" == "UBUNTU" ]
if [ "$DISTRO" == "UBUNTU" ]
then
echo "Linking start-up daemon script to /etc/rc2.d";
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent
else
INITLV=`cat /etc/inittab | grep "[0-9]\:initdefault" | cut -f 2 -d ":"`
echo "Linking start-up daemon script to /etc/rc.d/rc$INITLV.d";
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc$INITLV.d/S90pandora_agent
fi
chown -R root:root $PANDORA_BIN
echo "Done."
echo " "
echo "You have your startup script ready at $PANDORA_STARTUP"
echo " "
echo "Tentacle is the default transfer mode since 2.0 version."
echo "If you want to use SSH, firstly you need to copy your public SSH keys ($HOME/.ssh/id_dsa)"
echo "under /home/pandora/.ssh/authorized_keys on your Pandora FMS Server host"
echo "You also need to setup your $PANDORA_CFG/pandora_agent.conf config file"
echo " "
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent_daemon
echo "Linking stop daemon script";
ln -s /etc/init.d/pandora_agent_daemon /etc/rc0.d/K90pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc1.d/K90pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc6.d/K90pandora_agent_daemon
else
INITLV=`cat /etc/inittab | grep "[0-9]\:initdefault" | cut -f 2 -d ":"`
echo "Linking start-up daemon script to /etc/rc.d/rc$INITLV.d";
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc$INITLV.d/S90pandora_agent_daemon
fi
chown -R root:root $PANDORA_BIN
echo "Done."
echo " "
echo "You have your startup script ready at $PANDORA_STARTUP"
echo " "
echo "Tentacle is the default transfer mode since 2.0 version."
echo "If you want to use SSH, firstly you need to copy your public SSH keys ($HOME/.ssh/id_dsa)"
echo "under /home/pandora/.ssh/authorized_keys on your Pandora FMS Server host"
echo "You also need to setup your $PANDORA_CFG/pandora_agent.conf config file"
echo " "
}
help () {
echo " --force-install To force installation if already installed on system "
echo " --install To install Pandora FMS Agent on this system"
echo " --uninstall To uninstall and remove Pandora FMS Agent on this System"
echo " "
echo " --force-install To force installation if already installed on system "
echo " --install To install Pandora FMS Agent on this system"
echo " --uninstall To uninstall and remove Pandora FMS Agent on this System"
echo " "
}
# Script banner at start
@ -204,22 +213,22 @@ echo " "
case "$MODE" in
'--force-install')
FORCE=1
install
exit
;;
FORCE=1
install
exit
;;
'--install')
install
exit
;;
install
exit
;;
'--uninstall')
uninstall
exit
;;
uninstall
exit
;;
*)
help
help
esac