2010-07-05 Junichi Satoh <junichi@rworks.jp>

* pandora_server_installer: Added support for FreeBSD.

	* FreeBSD/pandora_server, FreeBSD/tentacle_server: Added startup
	script for FreeBSD.

	* FreeBSD/pandora_server.conf: Added configuration file for FreeBSD.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2959 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2010-07-05 03:20:42 +00:00
parent 3e4130c0f8
commit 79cb9d5e35
5 changed files with 549 additions and 34 deletions

View File

@ -1,3 +1,12 @@
2010-07-05 Junichi Satoh <junichi@rworks.jp>
* pandora_server_installer: Added support for FreeBSD.
* FreeBSD/pandora_server, FreeBSD/tentacle_server: Added startup
script for FreeBSD.
* FreeBSD/pandora_server.conf: Added configuration file for FreeBSD.
2010-06-10 Sancho Lerena <slerena@artica.es> 2010-06-10 Sancho Lerena <slerena@artica.es>
* lib/PandoraFMS/Core.pm: Redefine downtime name and description if * lib/PandoraFMS/Core.pm: Redefine downtime name and description if

View File

@ -0,0 +1,50 @@
#!/bin/sh
# **********************************************************************
# Pandora FMS Server Daemon launcher for FreeBSD
# (c) 2010 Junichi Satoh <junichi@rworks.jp>
#
# **********************************************************************
# PROVIDE: pandora_server
# REQUIRE: LOGIN mysql
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable `pandora_server':
#
# pandora_server_enable="YES"
#
. "/etc/rc.subr"
name="pandora_server"
rcvar=`set_rcvar`
# read configuration and set defaults
pandora_server_enable=${pandora_server_enable:-"NO"}
load_rc_config $name
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
command=/usr/local/bin/${name}
command_args="-D /usr/local/etc/pandora/pandora_server.conf"
pidfile=/var/run/$name.pid
required_files="/usr/local/etc/pandora/pandora_server.conf"
start_postcmd=start_postcmd
stop_postcmd=stop_postcmd
procname="/usr/local/bin/perl"
start_postcmd()
{
PANDORA_PID=`ps auxww | grep $command | grep -v grep | head -1 | awk '{ print $2 }'`
echo $PANDORA_PID > $pidfile
}
stop_postcmd()
{
rm -f $pidfile
}
run_rc_command "$1"

View File

@ -0,0 +1,283 @@
#############################################################################
# Pandora FMS Server Parameters
# Pandora FMS, the Flexible Monitoring System.
# Version 3.1
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
# Please change it for your setup needs
#############################################################################
# Servername: Name of this server
# if not given, it takes hostname. It's preferable to setup one
# because machine name could change by some reason.
#servername adama
# incomingdir: Defines directory where incoming data packets are stored
# You could set directory relative to base path or absolute, starting with /
incomingdir /var/spool/pandora/data_in
# log_file: Main logfile for pandora_server
# You could set file relative to base path or absolute, starting with /
log_file /var/log/pandora/pandora_server.log
# Log file for Pandora FMS SNMP console. Its generated by NetSNMP Trap daemon
snmp_logfile /var/log/pandora/pandora_snmptrap.log
# Error logfile: aux logfile for pandora_server errors (in Daemon mode)
# You could set file relative to base path or absolute, starting with /
errorlog_file /var/log/pandora/pandora_server.error
# daemon: Runs in daemon mode (background) if 1, if 0 runs in foreground
# this could be also configured on commandline with -D option
# daemon 1
# Database credentials. A VERY important configuration.
# This must be the same credentials used by your Pandora FMS Console
# but could be different if your console is not running in the same
# host than the server. Check your console setup in /include/config.php
# dbname: Database name (pandora by default
dbname pandora
# dbuser: Database user name (pandora by default)
dbuser pandora
# dbpass: Database password
dbpass pandora
# dbhost: Database hostname or IP address
dbhost localhost
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 0 or 1 on production enviroments.
verbosity 1
# Master Server, 1 if master server (normal mode), 0 for slave mode (slave in multi-server setup)
master 1
# Check datafiles using a MD5 hash, 1 to check (default), 0 to ignore .checksum
checksum 0
# Activate Pandora SNMP console (depending on snmptrapd)
# only available on Pandora Network server
snmpconsole 1
# Activate (1) Pandora Network Server
networkserver 1
# Activate (1) Pandora Data Server
dataserver 1
# Activate (1) Pandora FMS Recon server
reconserver 1
# pluginserver : 1 or 0. Set to 1 to activate plugin server with this setup
# DISABLED BY DEFAULT
pluginserver 0
# 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
# DISABLED BY DEFAULT
predictionserver 0
# wmiserver : 1 or 0. Set to 1 to activate WMI server with this setup
# DISABLED BY DEFAULT
wmiserver 0
# Network timeout (in seconds) for timeout in network connections for Network agents
network_timeout 5
# Server keepalive (in seconds)
server_keepalive 45
# Server Threshold: defines number of seconds of main loop (in sec)
server_threshold 5
# Network threads: Do not set too high (~40). Each threads make a network module check.
network_threads 5
# icmp_checks x : defines number of pings for each icmp_proc module type. at least one of
# that ping should be 1 to report 1
icmp_checks 1
# tcp specific options :
# tcp_checks: number of tcp retries if first attempt fails.
# tcp_timeout: specific timeout for tcp connections
tcp_checks 1
tcp_timeout 30
# snmp specific options :
# snmp_checks: number of snmp request retries if first attempt fails.
# snmp_timeout: specific timeout for snmp request.
snmp_checks 1
snmp_timeout 5
# snmp_proc_deadresponse 1 (default): Return DOWN if cannot contact
# or receive NULL from a SNMP PROC module.
snmp_proc_deadresponse 1
# plugin_threads: Specify number of plugin server threads for processing plugin calls
plugin_threads 2
# plugin_timeout: Specify number of seconds calling plugin exec waiting for response
# after this time, call is aborted and result is "unknown".
plugin_timeout 15
# wmi_timeout : specific timeout for wmi request.
wmi_timeout 10
# wmi_threads: Specify number of WMI server threads for processing WMI remote calls
wmi_threads 2
# recon_threads. Each thread will scan a different scantask.
recon_threads 2
# dataserver_threads: Number of threads for data server (XML processing threads)
dataserver_threads 2
# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities
#mta_address 192.168.50.1
mta_address localhost
# mta_port: MTA port (default 25)
#mta_port 25
# mta_user MTA User (if needed for auth, FQD or simple user, depending on your server)
#mta_user myuser@mydomain.com
# mta_pass MTA Pass (if needed for auth)
#mta_pass mypassword
# mta_auth MTA Auth system (if needed, support: LOGIN, PLAIN, CRAM-MD5, DIGEST-MD)
#mta_auth LOGIN
# mta_from Email address that sends the mail, by default is pandora@localhost
# probably you need to change it to avoid problems with your antispam
#mta_from pandora@sampledomain.com
# xprobe2: Optional package to detect OS types using advanced TCP/IP
# fingerprinting tecniques, much more accurates than stadard nmap.
# If not provided, nmap is used insted xprobe2
xprobe2 /usr/local/bin/xprobe2
# nmap: If provided, is used to detect OS type with recon server using
# advanded OS fingerprint technique. Xprobe2 gives more accurate results
# Nmap is also used to do TCP port scanning in detected host.
nmap /usr/local/bin/nmap
# snmpget: Needed to do SNMP checks. By default is on /usr/local/bin/snmpget
snmpget /usr/local/bin/snmpget
# Default group id for new agents created with Pandora FMS Data Server
autocreate_group 2
# Set to 1 if want to autocreate agents with Pandora FMS Data Server,
# set to 0 to disable
autocreate 1
# max_log_size: Specify max size of Pandora FMS server log file (1MB by default). If
# log file grows above this limit, is renamed to "pandora_server.log.old".
max_log_size 65536
# Send XML over Multicast channels async uptades on events and sync full tree
# info of tagged items (With custom ID) (only enterprise).
# mcast_status_port 22222
# mcast_status_group 224.1.1.1
# mcast_change_port 11111
# mcast_change_group 224.1.1.1
# max_queue_files (250 by default)
# When server have more than max_queue_files in incoming directory, skips the read
# the directory to avoid filesystem overhead.
max_queue_files 250
# Use the XML file last modification time as timestamp.
# use_xml_timestamp 1
# Pandora FMS will autorestart itself each XXX seconds, use this if you experience problems with
# shutting down threads, or other stability problems.
# auto_restart 86400
# Pandora FMS will restart after restart_delay seconds on critical errors.
# restart 0
# restart_delay 60
# More information about GIS Setup in /usr/share/pandora_server/util/gis.README
# Flag to activate GIS (positional information for agents and maps)
# by default it is desactivated
#activate_gis 0
# Radius of error in meters to consider two gis locations as the same location.
#location_error 50
# Recon reverse geolocation mode [disabled, sql, file]
# disabled The recon task doesn't try to geolocate the ip discovered.
# sql The recon task trys to query the SQL database to geolocate the
# ip discovered
# file The recon task trys to find the geolocation information of the
# ip discovered in the file indicated in the
# recon_reverse_geolocation_file parameter
# recon_reverse_geolocation_mode disabled
# Recon reverse geolocation file. This is the database with the reverse
# geolocation information using MaxMind GPL GeoLiteCity.dat format).
#recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoIPCity.dat
# Radius (in meters) of the circle in where the agents will be place randomly
# when finded by a recon task. Center of the circle is guessed
# by geolocating the IP.
#recon_location_scatter_radius 1000
# Pandora Server self-monitoring (embedded agent) (by default disabled)
#self_monitoring 1
# Update parent from the agent xml
#update_parent 1

View File

@ -0,0 +1,50 @@
#!/bin/sh
# **********************************************************************
# Tentacle Server Daemon launcher for FreeBSD
# (c) 2010 Junichi Satoh <junichi@rworks.jp>
#
# **********************************************************************
# PROVIDE: tentacle_server
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable `tentacle_server':
#
# tentacle_server_enable="YES"
#
. "/etc/rc.subr"
name="tentacle_server"
rcvar=`set_rcvar`
# read configuration and set defaults
tentacle_server_enable=${tentacle_server_enable:-"NO"}
tentacle_server_flags=${tentacle_server_flags:-"-a 0.0.0.0 -p 41121 -s /var/spool/pandora/data_in -d"}
tentacle_server_user=${tentacle_server_user:-"pandora"}
load_rc_config $name
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
command=/usr/local/bin/${name}
pidfile=/var/run/$name.pid
start_postcmd=start_postcmd
stop_postcmd=stop_postcmd
procname="/usr/bin/perl"
start_postcmd()
{
TENTACLE_PID=`ps auxww | grep $command | grep -v grep | head -1 | awk '{ print $2 }'`
echo $TENTACLE_PID > $pidfile
}
stop_postcmd()
{
rm -f $pidfile
}
run_rc_command "$1"

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/sh
# Pandora FMS Server Installer (c) 2008-2010 Artica ST # Pandora FMS Server Installer (c) 2008-2010 Artica ST
# Linux Version (generic), for SuSe and Debian/Ubuntu only # Linux/FreeBSD Version (generic), for SuSe, Debian/Ubuntu and FreeBSD 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.1 Build 100223 # v3.1 Build 100223
@ -43,29 +43,34 @@ get_distro () {
OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "` OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "`
OS_VERSION="FEDORA $OS_VERSION" OS_VERSION="FEDORA $OS_VERSION"
LINUX_DISTRO=FEDORA LINUX_DISTRO=FEDORA
elif [ `uname -s` == "Darwin" ] elif [ `uname -s` = "Darwin" ]
then then
# For future reference, Darwin doesn't have /etc/init.d but uses LaunchDaemons # For future reference, Darwin doesn't have /etc/init.d but uses LaunchDaemons
LINUX_DISTRO="Darwin" LINUX_DISTRO="Darwin"
OS_VERSION=`uname -r` OS_VERSION=`uname -r`
LINUX=NO LINUX=NO
elif [ `uname -s` == "AIX" ] elif [ `uname -s` = "AIX" ]
then then
# For future reference, AIX doesn't have /etc/init.d # For future reference, AIX doesn't have /etc/init.d
LINUX_DISTRO="AIX" LINUX_DISTRO="AIX"
OS_VERSION=`uname -r` OS_VERSION=`uname -r`
LINUX=NO LINUX=NO
elif [ `uname -s` == "SunOS" ] elif [ `uname -s` = "SunOS" ]
then then
# Some Solaris and other Unices don't have /etc/init.d, some have /usr/spool instead of /var/spool # Some Solaris and other Unices don't have /etc/init.d, some have /usr/spool instead of /var/spool
LINUX_DISTRO="Solaris" LINUX_DISTRO="Solaris"
OS_VERSION=`uname -r` OS_VERSION=`uname -r`
LINUX=NO LINUX=NO
elif [ `uname -s` == "Linux" ] elif [ `uname -s` = "Linux" ]
then then
# Test for Linux to make sure we're on Linux # Test for Linux to make sure we're on Linux
LINUX_DISTRO="GENERIC" LINUX_DISTRO="GENERIC"
OS_VERSION=`uname -r` OS_VERSION=`uname -r`
elif [ `uname -s` = "FreeBSD" ]
then
LINUX_DISTRO="FreeBSD"
OS_VERSION=`uname -r`
LINUX=NO
else else
# Default to Linux is false, test for real Linux above - that way we don't assume we can just plunk down files everywhere # Default to Linux is false, test for real Linux above - that way we don't assume we can just plunk down files everywhere
LINUX_DISTRO=`uname -s` LINUX_DISTRO=`uname -s`
@ -102,6 +107,20 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
echo " " echo " "
echo " You also will need to install xprobe2 and wmiclient from rpm (download from our website)" echo " You also will need to install xprobe2 and wmiclient from rpm (download from our website)"
echo " " echo " "
echo "For FreeBSD do : "
echo " "
echo " Install perl5.8 from ports with thread enabled."
echo " (perl-5.8.x.pkg can not be used.)"
echo " # cd /usr/ports/lang/perl5.8"
echo " # make config"
echo " -> Enable THREADS."
echo " # make"
echo " # make install"
echo " "
echo " Install following tools from ports. Don't use packages."
echo " Recommended: p5-DBI p5-Mail-Sendmail p5-NetAddr-IP p5-XML-Simple p5-Time-Format p5-HTML-Parser p5-Net-Traceroute-PurePerl p5-IO-Socket-Multicast p5-DBD-mysql"
echo " Optional: nmap xprobe"
echo " "
echo "To get it from source through CPAN do" echo "To get it from source through CPAN do"
echo " " echo " "
echo " $ cpan Digest::MD5 Time::Local DBI XML::Simple IO::Socket Time::HiRes Time::Format NetAddr::IP Mail::Sendmail Net::Traceroute::PurePerl HTML::Entities" echo " $ cpan Digest::MD5 Time::Local DBI XML::Simple IO::Socket Time::HiRes Time::Format NetAddr::IP Mail::Sendmail Net::Traceroute::PurePerl HTML::Entities"
@ -115,12 +134,22 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
OS_VERSION=`echo $GET_DISTRO | cut -f 2 -d ":"` OS_VERSION=`echo $GET_DISTRO | cut -f 2 -d ":"`
LINUX=`echo $GET_DISTRO | cut -f 3 -d ":"` LINUX=`echo $GET_DISTRO | cut -f 3 -d ":"`
if [ "$DISTRO" == "UBUNTU" ] if [ "$DISTRO" = "UBUNTU" ]
then then
echo "UBUNTU distribution detected" echo "UBUNTU distribution detected"
elif [ "$DISTRO" == "SUSE" ] elif [ "$DISTRO" = "SUSE" ]
then then
echo "SUSE distribution detected" echo "SUSE distribution detected"
elif [ "$DISTRO" = "FreeBSD" ]
then
echo "FreeBSD detected"
PANDORA_SPOOL=/var/spool/pandora
PANDORA_HOME=/usr/local/share/pandora_server
PANDORA_CFG_DIR=/usr/local/etc/pandora
PANDORA_LOG=/var/log/pandora
PANDORA_SERVER=/usr/local/etc/rc.d/pandora_server
TENTACLE_SERVER=/usr/local/etc/rc.d/tentacle_server
PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf
fi fi
echo "Installing binaries and libraries" echo "Installing binaries and libraries"
@ -135,23 +164,31 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
echo "ERROR compiling Pandora FMS Server from sources. Aborting" echo "ERROR compiling Pandora FMS Server from sources. Aborting"
exit 1 exit 1
fi fi
ln -s /usr/local/bin/pandora_server /usr/bin if [ "$DISTRO" != "FreeBSD" ]
ln -s /usr/local/bin/pandora_exec /usr/bin then
ln -s /usr/local/bin/pandora_server /usr/bin
ln -s /usr/local/bin/pandora_exec /usr/bin
fi
fi fi
echo "Creating common Pandora FMS directories" echo "Creating common Pandora FMS directories"
id pandora id pandora 2> /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo " " echo " "
echo "User pandora does exist, make sure the SSH directories are correct" echo "User pandora does exist, make sure the SSH directories are correct"
else else
echo "Are you sure we can create a standard 'pandora' user locally? [y/N]" echo "Are you sure we can create a standard 'pandora' user locally? [y/N]"
read AREYOUSURE read AREYOUSURE
if [ "$AREYOUSURE" == "y" ]; then if [ "$AREYOUSURE" = "y" ]; then
useradd pandora if [ "$DISTRO" = "FreeBSD" ]
mkdir /home/pandora 2> /dev/null then
mkdir /home/pandora/.ssh 2> /dev/null echo "pandora:41121:::::Pandora FMS:/home/pandora:/usr/sbin/nologin:" | adduser -f - -w no 2> /dev/null
chown -R pandora /home/pandora else
useradd pandora
mkdir /home/pandora 2> /dev/null
mkdir /home/pandora/.ssh 2> /dev/null
chown -R pandora /home/pandora
fi
else else
echo "Please create the 'pandora' user manually according to your authentication scheme then restart the installation" echo "Please create the 'pandora' user manually according to your authentication scheme then restart the installation"
echo "Aborting..." echo "Aborting..."
@ -166,17 +203,17 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
mkdir $PANDORA_LOG 2> /dev/null mkdir $PANDORA_LOG 2> /dev/null
echo "Giving proper permission to /var/spool/pandora" echo "Giving proper permission to /var/spool/pandora"
id -g www-data > /dev/null id -g www-data 2> /dev/null
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
chown -R pandora:www-data $PANDORA_SPOOL chown -R pandora:www-data $PANDORA_SPOOL
else else
id -g www > /dev/null id -g www 2> /dev/null
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
chown -R pandora:www $PANDORA_SPOOL chown -R pandora:www $PANDORA_SPOOL
else else
id -g apache > /dev/null id -g apache 2> /dev/null
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
chown -R pandora:apache $PANDORA_SPOOL chown -R pandora:apache $PANDORA_SPOOL
@ -188,7 +225,7 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
fi fi
echo "Creating setup directory in /etc/pandora" echo "Creating setup directory in $PANDORA_CFG_DIR"
mkdir $PANDORA_CFG_DIR 2> /dev/null mkdir $PANDORA_CFG_DIR 2> /dev/null
if [ -e $PANDORA_CFG_FILE ] if [ -e $PANDORA_CFG_FILE ]
then then
@ -196,25 +233,36 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
echo "Old installation detected, backing up pandora_server.conf.$ODFILENAMETMP" echo "Old installation detected, backing up pandora_server.conf.$ODFILENAMETMP"
mv $PANDORA_CFG_FILE $PANDORA_CFG_FILE.$OLDFILENAMETMP mv $PANDORA_CFG_FILE $PANDORA_CFG_FILE.$OLDFILENAMETMP
fi fi
echo cp conf/pandora_server.conf $PANDORA_CFG_DIR if [ "$DISTRO" = "FreeBSD" ]
cp conf/pandora_server.conf $PANDORA_CFG_DIR then
echo cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR
cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR
else
echo cp conf/pandora_server.conf $PANDORA_CFG_DIR
cp conf/pandora_server.conf $PANDORA_CFG_DIR
fi
chmod 770 $PANDORA_CFG_FILE chmod 770 $PANDORA_CFG_FILE
echo "Installing Pandora Server manual" echo "Installing Pandora Server manual"
cp man/man1/pandora_server.1.gz /usr/share/man/man1 if [ "$DISTRO" = "FreeBSD" ]
then
cp man/man1/pandora_server.1.gz /usr/local/man/man1
else
cp man/man1/pandora_server.1.gz /usr/share/man/man1
fi
if [ "$LINUX" == "YES" ] if [ "$LINUX" = "YES" ]
then then
echo "Copying the daemon script into /etc/init.d/pandora_server" echo "Copying the daemon script into /etc/init.d/pandora_server"
cp util/pandora_server /etc/init.d/ cp util/pandora_server /etc/init.d/
if [ "$DISTRO" == "UBUNTU" ] || [ "$DISTRO" == "DEBIAN" ] if [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ]
then then
echo "Linking startup script to /etc/rc2.d" echo "Linking startup script to /etc/rc2.d"
update-rc.d pandora_server defaults update-rc.d pandora_server defaults
else else
if [ "$DISTRO" == "SUSE" ] if [ "$DISTRO" = "SUSE" ]
then then
echo "Creating startup daemons" echo "Creating startup daemons"
insserv pandora_server insserv pandora_server
@ -229,6 +277,13 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
ln -s $PANDORA_SERVER /etc/rc.d/rc$INITLV.d/S90pandora_server ln -s $PANDORA_SERVER /etc/rc.d/rc$INITLV.d/S90pandora_server
fi fi
fi fi
else
if [ "$DISTRO" = "FreeBSD" ]
then
echo "Copying the daemon script into $PANDORA_SERVER"
cp FreeBSD/pandora_server $PANDORA_SERVER
chmod 555 $PANDORA_SERVER
fi
fi fi
if [ -d /etc/logrotate.d ]; then if [ -d /etc/logrotate.d ]; then
@ -238,11 +293,11 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
fi fi
if [ "$LINUX" == "YES" ] if [ "$LINUX" = "YES" ]
then then
if [ "$SECOPT" != "--no-tentacle" ] if [ "$SECOPT" != "--no-tentacle" ]
then then
if [ "$DISTRO" == "UBUNTU" ] || [ "$DISTRO" == "DEBIAN" ] if [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ]
then then
# Tentacle server install (Ubuntu) # Tentacle server install (Ubuntu)
echo "Installing tentacle server" echo "Installing tentacle server"
@ -250,7 +305,7 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
cp util/tentacle_serverd $TENTACLE_SERVER cp util/tentacle_serverd $TENTACLE_SERVER
update-rc.d tentacle_serverd defaults update-rc.d tentacle_serverd defaults
else else
if [ "$DISTRO" == "SUSE" ] if [ "$DISTRO" = "SUSE" ]
then then
echo "Creating Tentacle startup daemon" echo "Creating Tentacle startup daemon"
cp bin/tentacle_server /usr/bin cp bin/tentacle_server /usr/bin
@ -268,9 +323,22 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
echo "Installing Tentacle Server manual" echo "Installing Tentacle Server manual"
cp man/man1/tentacle_server.1.gz /usr/share/man/man1 cp man/man1/tentacle_server.1.gz /usr/share/man/man1
fi fi
else
if [ "$SECOPT" != "--no-tentacle" ]
then
if [ "$DISTRO" = "FreeBSD" ]
then
echo "Installing tentacle server"
cp bin/tentacle_server /usr/local/bin
cp FreeBSD/tentacle_server $TENTACLE_SERVER
chmod 555 $TENTACLE_SERVER
echo "Installing Tentacle Server manual"
cp man/man1/tentacle_server.1.gz /usr/local/man/man1
fi
fi
fi fi
echo "Creating Pandora FMS distribution directory in /usr/share/pandora_server" echo "Creating Pandora FMS distribution directory in $PANDORA_HOME"
mkdir $PANDORA_HOME 2> /dev/null mkdir $PANDORA_HOME 2> /dev/null
cp -R util $PANDORA_HOME cp -R util $PANDORA_HOME
@ -281,11 +349,23 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.daily/pandora_db echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.daily/pandora_db
chmod +x /etc/cron.daily/pandora_db chmod +x /etc/cron.daily/pandora_db
else 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:" if [ "$DISTRO" = "FreeBSD" ]
echo " perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" then
grep pandora_db.pl /etc/crontab > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "# Pandora FMS" >> /etc/crontab
echo "2 0 * * * root perl /usr/local/share/pandora_server/util/pandora_db.pl /usr/local/etc/pandora/pandora_server.conf" >> /etc/crontab
else
echo "The crontab for pandora_db.pl is already configured."
fi
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:"
echo " perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf"
fi
fi fi
echo echo
echo "Now you have to edit your /etc/pandora/pandora_server.conf file to change the database password (default is pandora) with the one set in include/config.php of your Pandora FMS Console." echo "Now you have to edit your $PANDORA_CFG_FILE file to change the database password (default is pandora) with the one set in include/config.php of your Pandora FMS Console."
echo "After setting password you can start your Pandora FMS Server!!" echo "After setting password you can start your Pandora FMS Server!!"
rm output rm output
@ -294,15 +374,58 @@ perl-TimeDate perl-XML-Simple perl-libwww-perl mysql-client"
echo "Managing Pandora FMS logs with logrotate (Distro independent)" echo "Managing Pandora FMS logs with logrotate (Distro independent)"
cp -aRf util/pandora_logrotate /etc/logrotate.d/pandora cp -aRf util/pandora_logrotate /etc/logrotate.d/pandora
fi fi
if [ "$DISTRO" = "FreeBSD" ]
then
echo " "
echo "Define 'pandora_server_enable=\"YES\"' in /etc/rc.conf to enable pandora server daemon."
echo "Define 'tentacle_server_enable=\"YES\"' in /etc/rc.conf to enable tentacle server daemon."
fi
fi fi
} }
uninstall_freebsd () {
PANDORA_SPOOL=/var/spool/pandora
PANDORA_HOME=/usr/local/share/pandora_server
PANDORA_CFG_DIR=/usr/local/etc/pandora
PANDORA_LOG=/var/log/pandora
PANDORA_SERVER=/usr/local/etc/rc.d/pandora_server
TENTACLE_SERVER=/usr/local/etc/rc.d/tentacle_server
PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf
TMP_CRONTAB=/tmp/crontab.tmp
echo "Removing Pandora Servers"
rm -Rf $PANDORA_SPOOL/data_in/
echo "If the user Pandora is not being used for any other operations, please delete using the following commands:"
echo " rmuser pandora"
rm -Rf $PANDORA_LOG 2> /dev/null
rm -Rf $PANDORA_CFG_FILE 2> /dev/null
rm -Rf $PANDORA_SERVER 2> /dev/null
rm -Rf $PANDORA_HOME
rm -Rf $PANDORA_SERVER
rm -Rf $TENTACLE_SERVER
cat /etc/crontab | grep -v "Pandora FMS" | grep -v "pandora_db.pl" > $TMP_CRONTAB
cp $TMP_CRONTAB /etc/crontab
rm $TMP_CRONTAB
echo "Done"
exit
}
uninstall () { uninstall () {
GET_DISTRO="`get_distro`" GET_DISTRO="`get_distro`"
DISTRO=`echo $GET_DISTRO | cut -f 1 -d ":"` DISTRO=`echo $GET_DISTRO | cut -f 1 -d ":"`
if [ "`uname -s`" != "Linux" ]; then if [ "`uname -s`" != "Linux" ]; then
if [ "$DISTRO" = "FreeBSD" ]
then
uninstall_freebsd
else
echo "This is not a Linux-based distro. Uninstaller is currently not working for your OS" echo "This is not a Linux-based distro. Uninstaller is currently not working for your OS"
fi
fi fi
echo "Removing Pandora Servers" echo "Removing Pandora Servers"
rm -Rf $PANDORA_SPOOL/data_in/ rm -Rf $PANDORA_SPOOL/data_in/
@ -323,7 +446,7 @@ uninstall () {
rm -Rf $PANDORA_HOME rm -Rf $PANDORA_HOME
rm -Rf /etc/cron.daily/pandora_db rm -Rf /etc/cron.daily/pandora_db
rm -Rf /etc/logrotate.d/pandora rm -Rf /etc/logrotate.d/pandora
if [ "$DISTRO" == "UBUNTU" ] || [ "$DISTRO" == "DEBIAN" ] if [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ]
then then
update-rc.d -f pandora_server remove update-rc.d -f pandora_server remove
update-rc.d -f tentacle_serverd remove update-rc.d -f tentacle_serverd remove