2013-04-03 Junichi Satoh <junichi@rworks.jp>

* pandora_server_installer, Makefile.PL: Added support for NetBSD.

	* NetBSD/pandora_server, NetBSD/pandora_server.conf,
	NetBSD/tentacle_server: Added launcher scripts and configuration
	file for NetBSD.

	Contributed by Hiroki SHIMIZU. Thanks!



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7920 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2013-04-03 04:59:01 +00:00
parent d37b1e5721
commit b1f7bb8836
6 changed files with 533 additions and 15 deletions

View File

@ -1,3 +1,13 @@
2013-04-03 Junichi Satoh <junichi@rworks.jp>
* pandora_server_installer, Makefile.PL: Added support for NetBSD.
* NetBSD/pandora_server, NetBSD/pandora_server.conf,
NetBSD/tentacle_server: Added launcher scripts and configuration
file for NetBSD.
Contributed by Hiroki SHIMIZU. Thanks!
2013-04-02 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Added a suffix to the auto-monitoring XML

View File

@ -6,6 +6,11 @@ WriteMakefile(
(($^O eq 'freebsd')
? (INSTALLSITELIB => '') : ()
),
($^O eq 'netbsd') ? (
INSTALLSITELIB => '/usr/pkg/lib/perl5',
INSTALLSITESCRIPT => '/usr/local/bin',
) :(),
NAME => 'PandoraFMS',
VERSION_FROM => 'lib/PandoraFMS/Config.pm',
AUTHOR => 'Artica ST <info@artica.es>',

View File

@ -0,0 +1,36 @@
#!/bin/sh
# **********************************************************************
# Pandora FMS Server Daemon launcher for NetBSD
# (c) 2013 Hiroki SHIMIZU <shimizu@rworks.jp>
#
# **********************************************************************
# PROVIDE: pandora_server
# REQUIRE: LOGIN mysqld
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable `pandora_server':
#
# pandora_server="YES"
#
. "/etc/rc.subr"
name="pandora_server"
rcvar=${name}
# read configuration and set defaults
pandora_server=${pandora_server:-"NO"}
load_rc_config $name
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
pidfile=/var/run/$name.pid
command=/usr/local/bin/${name}
command_args="-D -P ${pidfile} /usr/local/etc/pandora/pandora_server.conf"
required_files="/usr/local/etc/pandora/pandora_server.conf"
procname="/usr/pkg/bin/perl"
run_rc_command "$1"

View File

@ -0,0 +1,346 @@
#############################################################################
# Pandora FMS Server Parameters
# Pandora FMS, the Flexible Monitoring System.
# Version 4.0
# Licensed under GPL license v2,
# (c) 2003-2011 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
# dbengine: mysql, postgresql or oracle (mysql by default)
#dbengine mysql
# 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
# dbport: Database port number
# Default value depends on the dbengine (mysql: 3306, postgresql: 5432, oracle: 1521)
#dbport 3306
# By default, parent agent will not update
#update_parent 0
# 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
# 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
pluginserver 1
# Pandora FMS Plugin exec tool filepath (by default at /usr/local/bin)
plugin_exec /usr/local/bin/gtimeout
# 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
# wmic: Needed by Pandora FMS wmi server.
wmi_client /usr/local/bin/wmic
# Network timeout (in seconds) for timeout in network connections for Network agents
network_timeout 4
# 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 4
# 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 1
# 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 1
# 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 FMS <pandora@mydomain.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/pkg/bin/nmap
# snmpget: Needed to do SNMP checks. By default is on /usr/local/bin/snmpget
snmpget /usr/pkg/bin/snmpget
# snmp_trapd: Needed by Pandora FMS SNMP console.
snmp_trapd /usr/opkg/sbin/snmptrapd
# Location of the braa binary needed by the Enterprise SNMP Server (/usr/local/bin/braa by default) (PANDORA FMS ENTERPRISE ONLY).
braa /usr/local/bin/braa
# 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
# max_queue_files (500 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 500
# 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
#
#
# This enable realtime reverse geocoding using Google Maps public api.
# This requires internet access, and could have performance penalties processing GIS
# information due the connetion needed to resolve all GIS input.
# NOTE: If you dont pay the service to google, they will ban your IP in a few days.
# google_maps_description 1
# This enable realtime reverse geocoding using Openstreet Maps public api.
# This requires internet access, and could have performance penalties processing GIS
# information due the connetion needed to resolve all GIS input.
# You can alter the code to use a local (your own) openstreet maps server.
# openstreetmaps_description 1
# Enable (1) or disable (0) Pandora FMS Event Web Server (PANDORA FMS ENTERPRISE ONLY).
webserver 1
# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY).
web_threads 1
# Enable (1) or disable (0) Pandora FMS Inventory Server (PANDORA FMS ENTERPRISE ONLY).
inventoryserver 1
# Number of threads for the Web Server (PANDORA FMS ENTERPRISE ONLY).
inventory_threads 1
# Enable (1) or disable (0) Pandora FMS Export Server (PANDORA FMS ENTERPRISE ONLY).
exportserver 0
# Number of threads for the Export Server (PANDORA FMS ENTERPRISE ONLY).
export_threads 1
# Enable (1) or disable (0) Pandora FMS Event Server (PANDORA FMS ENTERPRISE ONLY).
eventserver 1
# Event Server event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
event_window 3600
# Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY).
icmpserver 1
# Number of threads for the Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY).
icmp_threads 2
# Enable (1) or disable (0) Pandora FMS Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY).
snmpserver 0
# Number of threads for the Enterprise SNMP Server (PANDORA FMS ENTERPRISE ONLY).
snmp_threads 2
# Block size for block producer/consumer servers, that is, the number of modules
# per block (25 by default) (PANDORA FMS ENTERPRISE ONLY).
block_size 25

View File

@ -0,0 +1,50 @@
#!/bin/sh
# **********************************************************************
# Tentacle Server Daemon launcher for NetBSD
# (c) 2013 Hiroki SHIMIZU <shimizu@rworks.jp>
#
# **********************************************************************
# PROVIDE: tentacle_server
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable `tentacle_server':
#
# tentacle_server="YES"
#
. "/etc/rc.subr"
name="tentacle_server"
rcvar=${name}
# read configuration and set defaults
tentacle_server=${tentacle_server:-"NO"}
tentacle_server_flags=${tentacle_server_flags:-"-a 0.0.0.0 -p 41121 -s /var/spool/pandora/data_in -i.*\.conf:conf\;.*\.md5:md5\;.*\.zip:collections -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/pkg/perl"
start_postcmd()
{
TENTACLE_PID=`pgrep -f none $name`
echo $TENTACLE_PID > $pidfile
}
stop_postcmd()
{
rm -f $pidfile
}
run_rc_command "$1"

View File

@ -71,6 +71,11 @@ get_distro () {
LINUX_DISTRO="FreeBSD"
OS_VERSION=`uname -r`
LINUX=NO
elif [ `uname -s` = "NetBSD" ]
then
LINUX_DISTRO="NetBSD"
OS_VERSION=`uname -r`
LINUX=NO
else
# 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`
@ -90,13 +95,13 @@ install () {
if [ ! -z "$SECOPT" ]
then
if [ "$SECOPT" == "--force" ]
if [ "$SECOPT" = "--force" ]
then
FORCE=1
fi
fi
if [ $DEPENDENCIAS -gt 0 ] && [ $FORCE == 0 ]
if [ $DEPENDENCIAS -gt 0 ] && [ $FORCE -eq 0 ]
then
echo "You are missing the following dependencies"
echo " "
@ -161,6 +166,24 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S
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
elif [ "$DISTRO" = "NetBSD" ]
then
echo "NetBSD 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=/etc/rc.d/pandora_server
TENTACLE_SERVER=/etc/rc.d/tentacle_server
PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf
sed s:/usr/bin/perl:/usr/pkg/bin/perl: bin/pandora_server > bin/tmp
mv bin/tmp bin/pandora_server
sed s:/usr/bin/perl:/usr/pkg/bin/perl: bin/pandora_exec > bin/tmp
mv bin/tmp bin/pandora_exec
sed s:/usr/bin/perl:/usr/pkg/bin/perl: bin/tentacle_server > bin/tmp
mv bin/tmp bin/tentacle_server
fi
echo "Installing binaries and libraries"
@ -175,7 +198,7 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S
echo "ERROR compiling Pandora FMS Server from sources. Aborting"
exit 1
fi
if [ "$DISTRO" != "FreeBSD" ]
if [ "$DISTRO" != "FreeBSD" -a "$DISTRO" != "NetBSD" ]
then
ln -s /usr/local/bin/pandora_server /usr/bin
ln -s /usr/local/bin/pandora_exec /usr/bin
@ -265,6 +288,14 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S
then
echo cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR
cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR
elif [ "$DISTRO" = "NetBSD" ]
then
if [ ! -d $PANDORA_CFG_DIR ]
then
mkdir -p $PANDORA_CFG_DIR
fi
echo cp NetBSD/pandora_server.conf $PANDORA_CFG_DIR
cp NetBSD/pandora_server.conf $PANDORA_CFG_DIR
else
echo cp conf/pandora_server.conf $PANDORA_CFG_DIR
cp conf/pandora_server.conf $PANDORA_CFG_DIR
@ -312,6 +343,12 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S
cp FreeBSD/pandora_server $PANDORA_SERVER
chmod 555 $PANDORA_SERVER
fi
if [ "$DISTRO" = "NetBSD" ]
then
echo "Copying the daemon script into $PANDORA_SERVER"
cp NetBSD/pandora_server $PANDORA_SERVER
chmod 555 $PANDORA_SERVER
fi
fi
if [ -d /etc/logrotate.d ]; then
@ -367,11 +404,25 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S
echo "Installing Tentacle Server manual"
cp man/man1/tentacle_server.1.gz /usr/local/man/man1
fi
if [ "$DISTRO" = "NetBSD" ]
then
echo "Installing tentacle server"
cp bin/tentacle_server /usr/local/bin
chown pandora /usr/local/bin/tentacle_server
cp NetBSD/tentacle_server $TENTACLE_SERVER
chmod 555 $TENTACLE_SERVER
echo "Installing Tentacle Server manual"
cp man/man1/tentacle_server.1.gz /usr/share/man/man1
fi
fi
fi
echo "Creating Pandora FMS distribution directory in $PANDORA_HOME"
mkdir $PANDORA_HOME 2> /dev/null
if [ ! -d $PANDORA_HOME ]
then
mkdir -p $PANDORA_HOME
fi
cp -R util $PANDORA_HOME
if [ -d /etc/cron.hourly ]
@ -381,7 +432,7 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S
echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.hourly/pandora_db
chmod +x /etc/cron.hourly/pandora_db
else
if [ "$DISTRO" = "FreeBSD" ]
if [ "$DISTRO" = "FreeBSD" -o "$DISTRO" = "NetBSD" ]
then
grep pandora_db.pl /etc/crontab > /dev/null 2>&1
if [ $? -ne 0 ]
@ -413,19 +464,39 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S
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
if [ "$DISTRO" = "NetBSD" ]
then
echo " "
echo "Define 'pandora_server=\"YES\"' in /etc/rc.conf to enable pandora server daemon."
echo "Define 'tentacle_server=\"YES\"' in /etc/rc.conf to enable tentacle server daemon."
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
uninstall_bsd () {
if [ "$DISTRO" = "FreeBSD" ]
then
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
else
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=/etc/rc.d/pandora_server
TENTACLE_SERVER=/etc/rc.d/tentacle_server
PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf
TMP_CRONTAB=/tmp/crontab.tmp
fi
echo "Removing Pandora Servers"
rm -Rf $PANDORA_SPOOL/data_in/
@ -452,9 +523,9 @@ uninstall () {
GET_DISTRO="`get_distro`"
DISTRO=`echo $GET_DISTRO | cut -f 1 -d ":"`
if [ "`uname -s`" != "Linux" ]; then
if [ "$DISTRO" = "FreeBSD" ]
if [ "$DISTRO" = "FreeBSD" -o "$DISTRO" = "NetBSD" ]
then
uninstall_freebsd
uninstall_bsd
else
echo "This is not a Linux-based distro. Uninstaller is currently not working for your OS"
fi