From 4bdcc0f321b0628e9c8ab13131e7f6f879daed70 Mon Sep 17 00:00:00 2001 From: slerena Date: Thu, 19 Jun 2008 14:53:10 +0000 Subject: [PATCH] 2008-06-19 Sancho Lerena * pandora_plugin: Added startup script. * Makefile.PL: Added new perl dependencies. * pandora_server_installer: Some fixes and updates. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@887 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 7 ++- pandora_server/Makefile.PL | 2 + pandora_server/pandora_plugin | 70 +++++++++++++++++++++++++ pandora_server/pandora_server_installer | 27 +++++++--- 4 files changed, 97 insertions(+), 9 deletions(-) create mode 100755 pandora_server/pandora_plugin diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 32be6d4421..c2f8423e99 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,7 +1,10 @@ +2008-06-19 Sancho Lerena -2008-06-19 Sancho Lerena + * pandora_plugin: Added startup script. - * pandora_recon: Added sleep to main loop to save CPU. + * Makefile.PL: Added new perl dependencies. + + * pandora_recon: Added sleep to main loop to save CPU. 2008-06-18 Sancho Lerena diff --git a/pandora_server/Makefile.PL b/pandora_server/Makefile.PL index ce0826e49e..158485dd24 100644 --- a/pandora_server/Makefile.PL +++ b/pandora_server/Makefile.PL @@ -17,6 +17,8 @@ WriteMakefile( Net::Ping => 0, Time::HiRes => 0, IO::Socket => 0, + Mail::Sendmail => 0, + Net::Traceroute::PurePerl => 0, SNMP => 0 }, EXE_FILES => diff --git a/pandora_server/pandora_plugin b/pandora_server/pandora_plugin new file mode 100755 index 0000000000..e9cc495e4e --- /dev/null +++ b/pandora_server/pandora_plugin @@ -0,0 +1,70 @@ +#!/bin/bash + +# Pandora FMS Plugin Server, startup script +# Sancho Lerena, +# Linux Version (generic) +# 2.0 Build 080620 + +# Configurable path and filenames +PANDORA_HOME="/etc/pandora/pandora_server.conf" +PANDORA_PID_PATH="/var/run" +PANDORA_PID=$PANDORA_PID_PATH/pandora_plugin.pid +PANDORA_DAEMON=/usr/bin/pandora_plugin + +# Main script + +if [ ! -d "$PANDORA_PID_PATH" ] +then + echo "Pandora FMS Plugin Server cannot write it's PID file in $PANDORA_PID_PATH. Please create that directory" + exit +fi + +if [ ! -f $PANDORA_DAEMON ] +then + echo "Pandora FMS Plugin Server not found, please check setup and read manual" + exit +fi + +case "$1" in + start) + OLD_PATH="`pwd`" + PANDORA_PID=$(pidof -x $PANDORA_DAEMON) + if [ ! -z $PANDORA_PID ] + then + echo "Pandora FMS Plugin Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..." + exit 1 + fi + + $PANDORA_DAEMON $PANDORA_HOME -D + sleep 1 + + PANDORA_PID=$(pidof -x $PANDORA_DAEMON) + if [ ! -z "$PANDORA_PID" ] + then + echo "Pandora FMS Plugin Server is now running with PID $PANDORA_PID" + else + echo "Cannot start Pandora FMS Plugin Server. Aborted." + fi + cd "$OLD_PATH" + ;; + stop) + PANDORA_PID=$(pidof -x $PANDORA_DAEMON) + if [ -z $PANDORA_PID ] + then + echo "Pandora FMS Plugin Server is not running, cannot stop it." + exit 1 + else + echo "Stopping Pandora FMS Plugin Server" + kill $PANDORA_PID > /dev/null 2>&1 + rm -f $PANDORA_PID + fi + ;; + force-reload|restart) + $0 stop + $0 start + ;; + *) + echo "Usage: pandora_plugin {start|stop|restart}" + exit 1 +esac + diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 25694c7e6c..c70f85a95b 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -51,13 +51,26 @@ else 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/local/bin/pandora_server /usr/bin/pandora_server - ln -s /usr/local/bin/pandora_snmpconsole /usr/bin/pandora_snmpconsole - ln -s /usr/local/bin/pandora_recon /usr/bin/pandora_recon - ln -s /usr/local/bin/pandora_network /usr/bin/pandora_network - ln -s /usr/local/bin/pandora_prediction /usr/bin/pandora_prediction - ln -s /usr/local/bin/pandora_plugin /usr/bin/pandora_plugin - ln -s /usr/local/bin/pandora_export /usr/bin/pandora_export + ln -s /etc/init.d/pandora_plugin /etc/rc2.d/S90pandora_plugin + ln -s /etc/init.d/pandora_prediction /etc/rc2.d/S90pandora_prediction + + if [ -e /usr/local/bin/pandora_server ] + then + ln -s /usr/local/bin/pandora_server /usr/bin/pandora_server + ln -s /usr/local/bin/pandora_snmpconsole /usr/bin/pandora_snmpconsole + ln -s /usr/local/bin/pandora_recon /usr/bin/pandora_recon + ln -s /usr/local/bin/pandora_network /usr/bin/pandora_network + ln -s /usr/local/bin/pandora_prediction /usr/bin/pandora_prediction + ln -s /usr/local/bin/pandora_plugin /usr/bin/pandora_plugin + else + ln -s /usr/bin/pandora_server /usr/local/bin/pandora_server + ln -s /usr/bin/pandora_network /usr/local/bin/pandora_network + ln -s /usr/bin/pandora_recon /usr/local/bin/pandora_recon + ln -s /usr/bin/pandora_plugin /usr/local/bin/pandora_plugin + ln -s /usr/bin/pandora_prediction /usr/local/bin/pandora_prediction + ln -s /usr/bin/pandora_snmpconsole /usr/local/bin/pandora_snmpconsole + fi + mkdir /usr/share/pandora cp -R util /usr/share/pandora cp -R plugin /usr/share/pandora