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 34528b69bd
commit 64502c45ba
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> 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. install mode.
* unix/pandora_agent.spec: Create temp directory. Fixed. * unix/pandora_agent.spec: Create temp directory. Fixed.

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
PANDORA_PATH=/etc/pandora PANDORA_PATH=/etc/pandora
DAEMON=/usr/bin/pandora_agent 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 # 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..." echo "Pandora FMS Agent is not running, cannot stop it. Aborting now..."
exit 1 exit 1
else else
echo "Stopping Pandora Agent." echo "Stopping Pandora FMS Agent."
kill $PANDORA_PID > /dev/null 2>&1 kill $PANDORA_PID > /dev/null 2>&1
fi fi
;; ;;

View File

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