2009-04-20 17:14:04 +02:00
# Pandora FMS 3.0 Server Installer (c) 2008-2009 Artica ST
# Please see http://www.pandorafms.org
2008-04-07 00:11:16 +02:00
# This code is licensed under GPL 2.0 license.
# **********************************************************************
#!/bin/bash
MODE=$1
2009-04-20 17:14:04 +02:00
SECOPT=$2
2008-04-07 00:11:16 +02:00
install () {
perl Makefile.PL > output 2>&1 #&& sleep 2 && cat output | grep "found" | wc -l
DEPENDENCIAS=`cat output | grep "found" | wc -l`
if [ $DEPENDENCIAS -gt 0 ]
then
echo "You are missing the following dependencies"
echo " "
cat output | awk -F ": prerequisite" '{print $2}' | awk -F " " '{print $1}'
2008-09-08 18:12:57 +02:00
echo "The complete installation guide is at: "http://www.openideas.info/wiki/index.php?title=Pandora_2.0:Documentation_en:Install_Server#Pandora_FMS_Server_installation" "
2008-04-07 00:11:16 +02:00
echo " "
echo "Debian-based distribution do:"
2008-10-20 10:03:17 +02:00
echo " $ apt-get install libdate-manip-perl snmp snmpd libsnmp-perl libtime-format-perl libxml-simple-perl libnetaddr-ip-perl libdbi-perl libxml-simple-perl libnetaddr-ip-perl libhtml-parser-perl wmi-client xprobe2 libmail-sendmail-perl"
2008-04-07 00:11:16 +02:00
echo " "
echo "RedHat-based distribution do"
echo " "
echo " $ yum perl-XML-SAX* perl-Tie* perl-XML-Simple* perl-DateManip* perl-IO-Socket* perl-Time-modules* perl-NetAddr-IP* perl-GD* perl-DateTime* perl-ExtUtils"
echo " "
2008-07-08 20:52:57 +02:00
echo "To get it from source through CPAN do"
echo " "
2008-09-03 18:54:18 +02:00
echo " $ cpan Digest::MD5 Time::Local DBI threads threads::shared IO::Socket Time::HiRes Time::Format Net::Ping NetAddr::IP Mail::Sendmail Net::Traceroute::PurePerl HTML::Entities"
2008-07-08 20:52:57 +02:00
echo " "
2008-04-07 00:11:16 +02:00
rm output
else
make
make install
mkdir /var/spool/pandora
mkdir /var/spool/pandora/data_in
2008-07-08 20:52:57 +02:00
id pandora
if [ $? -eq 0 ]; then
echo " "
echo "User pandora does exist, make sure the SSH directories are correct"
else
useradd pandora
mkdir /home/pandora
mkdir /home/pandora/.ssh
chown -R pandora /home/pandora
fi
2008-04-07 00:11:16 +02:00
mkdir /var/log/pandora
2008-07-10 23:24:37 +02:00
chown pandora:wheel /var/spool/pandora/data_in > /dev/null 2>&1 || chown pandora:root /var/spool/pandora/data_in
2008-04-07 00:11:16 +02:00
chmod 770 /var/spool/pandora/data_in
mkdir /etc/pandora
2008-07-08 20:52:57 +02:00
if [ -e /etc/pandora/pandora_server.conf ]; then
echo "Old installation detected, backing up pandora_server.conf"
mv /etc/pandora/pandora_server.conf /etc/pandora/pandora_server.conf.bak
fi
2008-04-07 00:11:16 +02:00
cp conf/pandora_server.conf /etc/pandora/
chmod 770 /etc/pandora/pandora_server.conf
2008-07-08 20:52:57 +02:00
if [ "`uname -s`" != "Linux" ]; then
echo "This is not a Linux-based distro. The installer will not create files for automatic startup."
echo "Copying the binaries into /usr/local/bin"
2009-04-20 17:14:04 +02:00
cp pandora_server /usr/local/bin
2008-07-08 20:52:57 +02:00
else
2009-04-20 17:14:04 +02:00
echo "Copying the startup scripts into /etc/init.d and linking it to /etc/rc2.d"
cp pandora_server /etc/init.d/
2008-07-08 20:52:57 +02:00
ln -s /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server
fi
2008-06-19 16:53:10 +02:00
if [ -e /usr/local/bin/pandora_server ]
then
ln -s /usr/local/bin/pandora_server /usr/bin/pandora_server
ln -s /usr/bin/pandora_server /usr/local/bin/pandora_server
fi
2009-04-18 14:37:18 +02:00
2009-04-20 17:14:04 +02:00
if [ "$SECOPT" != "--no-tentacle" ]
then
# Tentacle server install
echo "Installing tentacle server in /etc/rc2.d/S80tentacle_serverd"
cp bin/tentacle_server /usr/local/bin
cp util/tentacle_serverd /etc/init.d/tentacle_serverd
ln -s /etc/init.d/tentacle_serverd /etc/rc2.d/S80tentacle_serverd
fi
2009-04-18 14:37:18 +02:00
2008-04-07 00:11:16 +02:00
mkdir /usr/share/pandora
cp -R util /usr/share/pandora
2008-07-08 20:52:57 +02:00
if [ -d /etc/cron.daily ]
then
2008-08-26 02:31:52 +02:00
echo "#!/bin/bash" > /etc/cron.daily/pandora_purge_db
2008-09-03 18:54:18 +02:00
echo "perl /usr/share/pandora/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.daily/pandora_purge_db
2008-07-08 20:52:57 +02:00
chmod +x /etc/cron.daily/pandora_purge_db
else
echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (daily) on your master server:"
2008-09-03 18:54:18 +02:00
echo " perl /usr/share/pandora/util/pandora_db.pl /etc/pandora/pandora_server.conf"
2008-07-08 20:52:57 +02:00
fi
2008-04-07 00:11:16 +02:00
rm output
fi
}
uninstall () {
2008-09-08 18:12:57 +02:00
if [ "`uname -s`" != "Linux" ]; then
echo "This is not a Linux-based distro. Uninstaller is currently not working for your OS"
2008-07-08 20:52:57 +02:00
fi
echo "Removing Pandora Servers"
2008-09-08 18:12:57 +02:00
rm -Rf /var/spool/pandora/data_in/
2008-07-08 20:52:57 +02:00
echo "If the user Pandora is not being used for any other operations, please delete using the following commands:"
echo " userdel pandora"
echo " rm -Rf /home/pandora/"
## Just to clarify here. Some people (like me) are using the pandora user for other purposes and/or using an LDAP-based user management
## I would hate to have a script clear out this users' information without any notification
2008-08-22 20:02:23 +02:00
rm -Rf /var/log/pandora/ 2> /dev/null
2008-09-08 18:12:57 +02:00
rm -Rf /etc/pandora/pandora_server.conf 2> /dev/null
rm -Rf /etc/init.d/pandora_server 2> /dev/null
2008-08-22 20:02:23 +02:00
rm -Rf /etc/rc2.d/S90pandora_server 2> /dev/null
rm -Rf /usr/local/bin/pandora_server 2> /dev/null
2009-04-14 Ramon Novoa <rnovoa@artica.es>
* pandora_ctl, pandora_network, pandora_wmi, pandora_plugin,
pandora_prediction, bin/pandora_wmi, bin/pandora_plugin,
bin/pandora_prediction, bin/pandora_snmpconsole, bin/pandora_recon,
bin/pandora_network, pandora_recon, pandora_snmpconsole: Deleted
from repository. Old server code and startup scripts.
* Makefile.PL, pandora_server_installer, lib/PandoraFMS/Config.pm
lib/PandoraFMS/DB.pm, lib/PandoraFMS/Tools.pm, bin/pandora_server,
pandora_package_installer, pandora_server: Updated to work with the
new code, removed unneeded dependencies, fixed some bugs etc.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,
lib/PandoraFMS/ProducerConsumerServer.pm, lib/PandoraFMS/Server.pm,
lib/PandoraFMS/PredictionServer.pm, lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm, lib/PandoraFMS/DataServer.pm,
lib/PandoraFMS/NetworkServer.pm, lib/PandoraFMS/WMIServer.pm: Added
to repository. New server code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1620 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-14 21:13:16 +02:00
2008-08-22 20:02:23 +02:00
rm -Rf /usr/bin/pandora_server 2> /dev/null
2008-04-07 00:11:16 +02:00
rm -Rf /usr/share/pandora
rm -Rf /etc/cron.daily/pandora_purge_db
echo "Done"
}
help () {
echo " --install To install Pandora FMS Servers on this system (You have to be root)"
echo " --uninstall To uninstall and remove Pandora FMS Servers on this System"
2009-04-20 17:14:04 +02:00
echo " "
echo " Additional parameters (after --install) "
2008-04-07 00:11:16 +02:00
echo " "
2009-04-20 17:14:04 +02:00
echo " --no-tentacle Skip tentacle server installation (by default tentacle server installed)"
echo " "
2008-04-07 00:11:16 +02:00
}
# Script banner at start
echo " "
2009-04-20 17:14:04 +02:00
echo "Pandora FMS 3.0 Server Installer (c) 2008-2009 Artica ST"
echo "This program is licensed under GPL2 Terms. http://pandorafms.org"
2008-04-07 00:11:16 +02:00
echo " "
case "$MODE" in
'--install')
install
exit
;;
'--uninstall')
uninstall
exit
;;
*)
help
esac