mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
2008-04-09 Sancho Lerena <slerena@gmail.com>
* pandora_server_installer: Updated some strings and version. Added new servers. * lib/PandoraFMS/Config.pm: Included support for export server. * bin/pandora_export: Export server skeleton. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@794 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a29b65eacd
commit
7029a85437
@ -1,3 +1,12 @@
|
|||||||
|
2008-04-09 Sancho Lerena <slerena@gmail.com>
|
||||||
|
|
||||||
|
* pandora_server_installer: Updated some strings and version.
|
||||||
|
Added new servers.
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Config.pm: Included support for export server.
|
||||||
|
|
||||||
|
* bin/pandora_export: Export server skeleton.
|
||||||
|
|
||||||
2008-04-01 Sancho Lerena <slerena@gmail.com>
|
2008-04-01 Sancho Lerena <slerena@gmail.com>
|
||||||
|
|
||||||
* bin/pandora_prediction: Fixed several problems with
|
* bin/pandora_prediction: Fixed several problems with
|
||||||
|
57
pandora_server/bin/pandora_export
Executable file
57
pandora_server/bin/pandora_export
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
##########################################################################
|
||||||
|
# Pandora FMS Export Server
|
||||||
|
##########################################################################
|
||||||
|
# Copyright (c) 2008 Sancho Lerena, slerena@gmail.com
|
||||||
|
# (c) 2008 Artica Soluciones Tecnologicas S.L
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; version 2 (only).
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
# Includes list
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Date::Manip; # Needed to manipulate DateTime formats of
|
||||||
|
# input, output and compare
|
||||||
|
use Time::Local; # DateTime basic manipulation
|
||||||
|
use XML::Simple; # Useful XML functions
|
||||||
|
use Time::Local; # DateTime basic manipulation
|
||||||
|
use DBI;
|
||||||
|
|
||||||
|
# Pandora Modules
|
||||||
|
use PandoraFMS::Config;
|
||||||
|
use PandoraFMS::Tools;
|
||||||
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
|
# FLUSH in each IO (only for debug, very slooow)
|
||||||
|
# ENABLED in DEBUGMODE
|
||||||
|
# DISABLE FOR PRODUCTION
|
||||||
|
$| = 0;
|
||||||
|
|
||||||
|
my %pa_config;
|
||||||
|
|
||||||
|
$SIG{'TERM'} = 'pandora_shutdown';
|
||||||
|
$SIG{'INT'} = 'pandora_shutdown';
|
||||||
|
|
||||||
|
# Inicio del bucle principal de programa
|
||||||
|
pandora_init(\%pa_config, "Pandora FMS Export Server");
|
||||||
|
|
||||||
|
# Read config file for Global variables
|
||||||
|
pandora_loadconfig (\%pa_config, 7);
|
||||||
|
|
||||||
|
# Audit server starting
|
||||||
|
pandora_audit (\%pa_config, "Pandora FMS Export server starting", "SYSTEM", "System");
|
||||||
|
|
||||||
|
print " [*] Starting up Export Server\n";
|
||||||
|
|
||||||
|
die ("There is no more program yet! :-)");
|
@ -38,7 +38,7 @@ our @EXPORT = qw(
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "2.0-dev";
|
my $pandora_version = "2.0-dev";
|
||||||
my $pandora_build="PS080311";
|
my $pandora_build="PS080404";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
@ -128,7 +128,7 @@ sub pandora_loadconfig {
|
|||||||
my $pa_config = $_[0];
|
my $pa_config = $_[0];
|
||||||
my $opmode = $_[1]; # 0 dataserver, 1 network server, 2 snmp console
|
my $opmode = $_[1]; # 0 dataserver, 1 network server, 2 snmp console
|
||||||
# 3 recon srv, 4 plugin srv, 5 prediction srv
|
# 3 recon srv, 4 plugin srv, 5 prediction srv
|
||||||
# 6 WMI server
|
# 6 WMI server, 7 export server
|
||||||
my $archivo_cfg = $pa_config->{'pandora_path'};
|
my $archivo_cfg = $pa_config->{'pandora_path'};
|
||||||
my $buffer_line;
|
my $buffer_line;
|
||||||
my @command_line;
|
my @command_line;
|
||||||
@ -161,6 +161,7 @@ sub pandora_loadconfig {
|
|||||||
$pa_config->{"wmiserver"} = 0; # Introduced on 2.0
|
$pa_config->{"wmiserver"} = 0; # Introduced on 2.0
|
||||||
$pa_config->{"pluginserver"} = 0; # Introduced on 2.0
|
$pa_config->{"pluginserver"} = 0; # Introduced on 2.0
|
||||||
$pa_config->{"predictionserver"} = 0; # Introduced on 2.0
|
$pa_config->{"predictionserver"} = 0; # Introduced on 2.0
|
||||||
|
$pa_config->{"exportserver"} = 0; # 2.0
|
||||||
$pa_config->{"servermode"} = "";
|
$pa_config->{"servermode"} = "";
|
||||||
$pa_config->{'snmp_logfile'} = "/var/log/pandora_snmptrap.log";
|
$pa_config->{'snmp_logfile'} = "/var/log/pandora_snmptrap.log";
|
||||||
$pa_config->{"network_threads"} = 5; # Fixed default
|
$pa_config->{"network_threads"} = 5; # Fixed default
|
||||||
@ -286,6 +287,9 @@ sub pandora_loadconfig {
|
|||||||
elsif ($parametro =~ m/^wmiserver\s([0-9]*)/i) {
|
elsif ($parametro =~ m/^wmiserver\s([0-9]*)/i) {
|
||||||
$pa_config->{'wmiserver'}= clean_blank($1);
|
$pa_config->{'wmiserver'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
|
elsif ($parametro =~ m/^exportserver\s([0-9]*)/i) {
|
||||||
|
$pa_config->{'exportserver'}= clean_blank($1);
|
||||||
|
}
|
||||||
elsif ($parametro =~ m/^servername\s(.*)/i) {
|
elsif ($parametro =~ m/^servername\s(.*)/i) {
|
||||||
$pa_config->{'servername'}= clean_blank($1);
|
$pa_config->{'servername'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
@ -394,7 +398,10 @@ sub pandora_loadconfig {
|
|||||||
print " [ERROR] You must enable 'wmiserver' in setup file to run Pandora FMS WMI server. \n\n";
|
print " [ERROR] You must enable 'wmiserver' in setup file to run Pandora FMS WMI server. \n\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
if (($opmode ==7) && ($pa_config->{"exportserver"} ne 1)) {
|
||||||
|
print " [ERROR] You must enable 'exportserver' in setup file to run Pandora FMS Export server. \n\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
# Show some config options in startup
|
# Show some config options in startup
|
||||||
if ($pa_config->{"quiet"} == 0){
|
if ($pa_config->{"quiet"} == 0){
|
||||||
if ($opmode == 0){
|
if ($opmode == 0){
|
||||||
@ -431,6 +438,11 @@ sub pandora_loadconfig {
|
|||||||
print " [*] You are running Pandora FMS WMI Server. \n";
|
print " [*] You are running Pandora FMS WMI Server. \n";
|
||||||
$parametro ="Pandora FMS WMI Server";
|
$parametro ="Pandora FMS WMI Server";
|
||||||
$pa_config->{"servermode"}="_WMI";
|
$pa_config->{"servermode"}="_WMI";
|
||||||
|
}
|
||||||
|
if ($opmode == 7){
|
||||||
|
print " [*] You are running Pandora FMS Export Server. \n";
|
||||||
|
$parametro ="Pandora FMS Export Server";
|
||||||
|
$pa_config->{"servermode"}="_Export";
|
||||||
}
|
}
|
||||||
if ($pa_config->{"pandora_check"} == 1) {
|
if ($pa_config->{"pandora_check"} == 1) {
|
||||||
print " [*] MD5 Security enabled.\n";
|
print " [*] MD5 Security enabled.\n";
|
||||||
|
129
pandora_server/pandora_server_installer
Executable file
129
pandora_server/pandora_server_installer
Executable file
@ -0,0 +1,129 @@
|
|||||||
|
# (c) 2008 Manuel Arostegui <marostegui@artica.es>
|
||||||
|
# Please see http://pandora.sourceforge.net
|
||||||
|
# This code is licensed under GPL 2.0 license.
|
||||||
|
# **********************************************************************
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MODE=$1
|
||||||
|
|
||||||
|
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}'
|
||||||
|
echo "The complete installation guide is at: "http://www.openideas.info/wiki/index.php?title=Pandora_1.3:Server:QIG#Installing_from_sources" "
|
||||||
|
echo " "
|
||||||
|
echo "Debian-based distribution do:"
|
||||||
|
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"
|
||||||
|
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 " "
|
||||||
|
echo " $ cpan install Digest::MD5 Time::Local DBI threads threads::shared IO::Socket Time::HiRes Time::Format Net::Ping NetAddr::IP "
|
||||||
|
rm output
|
||||||
|
else
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
mkdir /var/spool/pandora
|
||||||
|
mkdir /var/spool/pandora/data_in
|
||||||
|
useradd pandora
|
||||||
|
mkdir /home/pandora
|
||||||
|
mkdir /home/pandora/.ssh
|
||||||
|
chown -R pandora /home/pandora
|
||||||
|
mkdir /var/log/pandora
|
||||||
|
chown pandora:root /var/spool/pandora/data_in
|
||||||
|
chmod 770 /var/spool/pandora/data_in
|
||||||
|
mkdir /etc/pandora
|
||||||
|
cp conf/pandora_server.conf /etc/pandora/
|
||||||
|
chmod 770 /etc/pandora/pandora_server.conf
|
||||||
|
cp pandora_* /etc/init.d/
|
||||||
|
rm /etc/init.d/pandora_server_installer
|
||||||
|
ln -s /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server
|
||||||
|
ln -s /etc/init.d/pandora_recon /etc/rc2.d/S90pandora_recon
|
||||||
|
ln -s /etc/init.d/pandora_network /etc/rc2.d/S90pandora_network
|
||||||
|
ln -s /etc/init.d/pandora_snmpconsole /etc/rc2.d/S90pandora_snmpconsole
|
||||||
|
ln -s /usr/bin/pandora_server /usr/local/bin/pandora_server
|
||||||
|
ln -s /usr/bin/pandora_snmpconsole /usr/local/bin/pandora_snmpconsole
|
||||||
|
ln -s /usr/bin/pandora_recon /usr/local/bin/pandora_recon
|
||||||
|
ln -s /usr/bin/pandora_network /usr/local/bin/pandora_network
|
||||||
|
ln -s /usr/bin/pandora_prediction /usr/local/bin/pandora_prediction
|
||||||
|
ln -s /usr/bin/pandora_plugin /usr/local/bin/pandora_plugin
|
||||||
|
ln -s /usr/bin/pandora_export /usr/local/bin/pandora_export
|
||||||
|
mkdir /usr/share/pandora
|
||||||
|
cp -R util /usr/share/pandora
|
||||||
|
echo "perl /usr/share/pandora/util/pandora_db /etc/pandora/pandora_server.conf" > /etc/cron.daily/pandora_purge_db
|
||||||
|
chmod +x /etc/cron.daily/pandora_purge_db
|
||||||
|
rm output
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstall () {
|
||||||
|
echo "Removing Pandora Servers"
|
||||||
|
rm -Rf /var/spool/pandora/data_in/
|
||||||
|
rm -Rf /home/pandora/
|
||||||
|
userdel pandora
|
||||||
|
rm -Rf /var/log/pandora/
|
||||||
|
rm -Rf /etc/pandora/pandora_server.conf
|
||||||
|
rm -Rf /etc/init.d/pandora_server
|
||||||
|
rm -Rf /etc/init.d/pandora_network
|
||||||
|
rm -Rf /etc/init.d/pandora_recon
|
||||||
|
rm -Rf /etc/init.d/pandora_snmpconsole
|
||||||
|
rm -Rf /etc/rc2.d/S90pandora_server
|
||||||
|
rm -Rf /etc/rc2.d/S90pandora_recon
|
||||||
|
rm -Rf /etc/rc2.d/S90pandora_network
|
||||||
|
rm -Rf /etc/rc2.d/S90pandora_snmpconsole
|
||||||
|
rm -Rf /usr/local/bin/pandora_server
|
||||||
|
rm -Rf /usr/local/bin/pandora_snmpconsole
|
||||||
|
rm -Rf /usr/local/bin/pandora_recon
|
||||||
|
rm -Rf /usr/local/bin/pandora_network
|
||||||
|
rm -Rf /usr/bin/pandora_server
|
||||||
|
rm -Rf /usr/bin/pandora_snmpconsole
|
||||||
|
rm -Rf /usr/bin/pandora_recon
|
||||||
|
rm -Rf /usr/bin/pandora_network
|
||||||
|
rm -Rf /usr/bin/pandora_prediction 2> /dev/null
|
||||||
|
rm -Rf /usr/bin/pandora_plugin 2> /dev/null
|
||||||
|
rm -Rf /usr/bin/pandora_export 2> /dev/null
|
||||||
|
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"
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
|
||||||
|
# Script banner at start
|
||||||
|
echo " "
|
||||||
|
echo "Pandora FMS 2.0 Server Installer (c) 2008 Manuel Arostegui"
|
||||||
|
echo "This program is licensed under GPL2 Terms. http://pandora.sourceforge.net"
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
case "$MODE" in
|
||||||
|
|
||||||
|
'--install')
|
||||||
|
install
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
|
||||||
|
'--uninstall')
|
||||||
|
uninstall
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
help
|
||||||
|
esac
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user