2008-09-08 Raul Mateos <raulofpandora@gmail.com>

* pandora_*: Updated headers with build and new URL, better style

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1088 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
raulmateos 2008-09-08 16:12:57 +00:00
parent f66de3bce0
commit 663170fb5b
11 changed files with 249 additions and 240 deletions

View File

@ -4,6 +4,8 @@
* util/pandora_dbstress.pl: Updated year and build. * util/pandora_dbstress.pl: Updated year and build.
* pandora_*: Updated headers with build and new URL, better style
2008-09-03 Sancho Lerena <slerena@gmail.com> 2008-09-03 Sancho Lerena <slerena@gmail.com>
* pandora_server_installer: Added more info about some dependencies. * pandora_server_installer: Added more info about some dependencies.
@ -14,8 +16,8 @@
2008-09-01 Sancho Lerena <slerena@gmail.com> 2008-09-01 Sancho Lerena <slerena@gmail.com>
* lib/PandoraFMS/DB.pm: Sending mail now replaces macros also * lib/PandoraFMS/DB.pm: Sending mail now replaces macros also
in the subject. in the subject.
2008-08-28 Evi Vanoost <vanooste@rcbi.rochester.edu> 2008-08-28 Evi Vanoost <vanooste@rcbi.rochester.edu>

View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
# Pandora FMS Network Server, startup script # Pandora FMS Network Server, startup script
# Sancho Lerena, <slerena@gmail.com> # Copyright (c) 2006-2008 Sancho Lerena, <slerena@gmail.com>
# Linux Version (generic) # Linux Version (generic)
# v1.3 Build 070731 # v2.0 Build 080903
# http://www.pandorafms.com
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/etc/pandora/pandora_server.conf" PANDORA_HOME="/etc/pandora/pandora_server.conf"
@ -21,52 +22,52 @@ fi
if [ ! -f $PANDORA_DAEMON ] if [ ! -f $PANDORA_DAEMON ]
then then
echo "Pandora FMS Network Server not found, please check setup and read manual" echo "Pandora FMS Network Server not found, please check setup and read manual"
exit exit
fi fi
case "$1" in case "$1" in
start) start)
OLD_PATH="`pwd`" OLD_PATH="`pwd`"
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ ! -z $PANDORA_PID ] if [ ! -z $PANDORA_PID ]
then then
echo "Pandora FMS Network Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..." echo "Pandora FMS Network Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..."
exit 1 exit 1
else else
rm -f $PANDORA_PID rm -f $PANDORA_PID
fi fi
$PANDORA_DAEMON $PANDORA_HOME -D $PANDORA_DAEMON $PANDORA_HOME -D
sleep 1 sleep 1
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ ! -z "$PANDORA_PID" ] if [ ! -z "$PANDORA_PID" ]
then then
echo "Pandora Network Server is now running with PID $PANDORA_PID" echo "Pandora Network Server is now running with PID $PANDORA_PID"
else else
echo "Cannot start Pandora FMS Network Server. Aborted." echo "Cannot start Pandora FMS Network Server. Aborted."
fi fi
cd "$OLD_PATH" cd "$OLD_PATH"
;; ;;
stop) stop)
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ -z $PANDORA_PID ] if [ -z $PANDORA_PID ]
then then
echo "Pandora FMS Network Server is not running, cannot stop it." echo "Pandora FMS Network Server is not running, cannot stop it."
exit 1 exit 1
else else
echo "Stopping Pandora FMS Network Server" echo "Stopping Pandora FMS Network Server"
kill $PANDORA_PID > /dev/null 2>&1 kill $PANDORA_PID > /dev/null 2>&1
rm -f $PANDORA_PID rm -f $PANDORA_PID
fi fi
;; ;;
force-reload|restart) force-reload|restart)
$0 stop $0 stop
$0 start $0 start
;; ;;
*) *)
echo "Usage: pandora_network {start|stop|restart}" echo "Usage: pandora_network {start|stop|restart}"
exit 1 exit 1
esac esac

View File

@ -67,8 +67,8 @@ install () {
} }
uninstall () { uninstall () {
if [ "`uname -s`" != "Linux" ]; then if [ "`uname -s`" != "Linux" ]; then
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
echo "Removing Pandora Servers" echo "Removing Pandora Servers"
rm -Rf /var/spool/pandora/data_in/ rm -Rf /var/spool/pandora/data_in/

View File

@ -1,15 +1,16 @@
#!/bin/bash #!/bin/bash
# Pandora FMS Plugin Server, startup script # Pandora FMS Plugin Server, startup script
# Sancho Lerena, <slerena@gmail.com> # Copyright (c) 2006-2008 Sancho Lerena, <slerena@gmail.com>
# Linux Version (generic) # Linux Version (generic)
# 2.0 Build 080620 # v2.0 Build 080903
# http://www.pandorafms.com
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/etc/pandora/pandora_server.conf" PANDORA_HOME="/etc/pandora/pandora_server.conf"
PANDORA_PID_PATH="/var/run" PANDORA_PID_PATH="/var/run"
PANDORA_PID=$PANDORA_PID_PATH/pandora_plugin.pid PANDORA_PID=$PANDORA_PID_PATH/pandora_plugin.pid
PANDORA_DAEMON=/usr/bin/pandora_plugin PANDORA_DAEMON=/usr/local/bin/pandora_plugin
# Main script # Main script
@ -21,50 +22,50 @@ fi
if [ ! -f $PANDORA_DAEMON ] if [ ! -f $PANDORA_DAEMON ]
then then
echo "Pandora FMS Plugin Server not found, please check setup and read manual" echo "Pandora FMS Plugin Server not found, please check setup and read manual"
exit exit
fi fi
case "$1" in case "$1" in
start) start)
OLD_PATH="`pwd`" OLD_PATH="`pwd`"
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ ! -z $PANDORA_PID ] if [ ! -z $PANDORA_PID ]
then then
echo "Pandora FMS Plugin Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..." echo "Pandora FMS Plugin Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..."
exit 1 exit 1
fi fi
$PANDORA_DAEMON $PANDORA_HOME -D $PANDORA_DAEMON $PANDORA_HOME -D
sleep 1 sleep 1
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ ! -z "$PANDORA_PID" ] if [ ! -z "$PANDORA_PID" ]
then then
echo "Pandora FMS Plugin Server is now running with PID $PANDORA_PID" echo "Pandora FMS Plugin Server is now running with PID $PANDORA_PID"
else else
echo "Cannot start Pandora FMS Plugin Server. Aborted." echo "Cannot start Pandora FMS Plugin Server. Aborted."
fi fi
cd "$OLD_PATH" cd "$OLD_PATH"
;; ;;
stop) stop)
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ -z $PANDORA_PID ] if [ -z $PANDORA_PID ]
then then
echo "Pandora FMS Plugin Server is not running, cannot stop it." 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 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 esac

View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
# Pandora FMS Prediction, startup script # Pandora FMS Prediction Server, startup script
# Sancho Lerena, <slerena@gmail.com> # Copyright (c) 2006-2008 Sancho Lerena, <slerena@gmail.com>
# Linux Version (generic) # Linux Version (generic)
# v2.0 Build 0080513 # v2.0 Build 080903
# http://www.pandorafms.com
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/etc/pandora/pandora_server.conf" PANDORA_HOME="/etc/pandora/pandora_server.conf"

View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
# Pandora FMS Recon Server, startup script # Pandora FMS Recon Server, startup script
# Sancho Lerena, <slerena@gmail.com> # Copyright (c) 2006-2008 Sancho Lerena, <slerena@gmail.com>
# Linux Version (generic) # Linux Version (generic)
# v1.3 Build 070731 # v2.0 Build 080903
# http://www.pandorafms.com
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/etc/pandora/pandora_server.conf" PANDORA_HOME="/etc/pandora/pandora_server.conf"

View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
# Pandora Data Server, startup script # Pandora FMS Data Server, startup script
# Sancho Lerena, <slerena@gmail.com> # Copyright (c) 2006-2008 Sancho Lerena, <slerena@gmail.com>
# Linux Version (generico) # Linux Version (generic)
# v1.3 Build 070802 # v2.0 Build 080903
# http://www.pandorafms.com
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/etc/pandora/pandora_server.conf" PANDORA_HOME="/etc/pandora/pandora_server.conf"
@ -21,8 +22,8 @@ fi
if [ ! -f $PANDORA_DAEMON ] if [ ! -f $PANDORA_DAEMON ]
then then
echo "Pandora FMS Data Server not found, please check setup and read manual" echo "Pandora FMS Data Server not found, please check setup and read manual"
exit exit
fi fi
case "$1" in case "$1" in
@ -48,25 +49,25 @@ case "$1" in
echo "Cannot start Pandora FMS Data Server. Aborted." echo "Cannot start Pandora FMS Data Server. Aborted."
fi fi
cd "$OLD_PATH" cd "$OLD_PATH"
;; ;;
stop) stop)
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ -z $PANDORA_PID ] if [ -z $PANDORA_PID ]
then then
echo "Pandora FMS Data Server is not running, cannot stop it." echo "Pandora FMS Data Server is not running, cannot stop it."
exit 1 exit 1
else else
echo "Stopping Pandora FMS Data Server" echo "Stopping Pandora FMS Data Server"
kill $PANDORA_PID > /dev/null 2>&1 kill $PANDORA_PID > /dev/null 2>&1
rm -f $PANDORA_PID rm -f $PANDORA_PID
fi fi
;; ;;
force-reload|restart) force-reload|restart)
$0 stop $0 stop
$0 start $0 start
;; ;;
*) *)
echo "Usage: pandora_server {start|stop|restart}" echo "Usage: pandora_server {start|stop|restart}"
exit 1 exit 1
esac esac

View File

@ -1,16 +1,16 @@
# #
# Pandora Server # Pandora FMS Server
# #
%define name pandora_server %define name pandora_server
%define version 1.3.1 %define version 2.0.0
Summary: Pandora Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}
Version: %{version} Version: %{version}
Release: 1 Release: 1
License: GPL License: GPL
Vendor: Sancho Lerena <sancho.lerena@artica.es> Vendor: Sancho Lerena <sancho.lerena@artica.es>
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
URL: http://pandora.sf.net URL: http://www.pandorafms.com
Group: System/Monitoring Group: System/Monitoring
Packager: Manuel Arostegui <marostegui@artica.es> Packager: Manuel Arostegui <marostegui@artica.es>
Prefix: /usr/share Prefix: /usr/share

View File

@ -1,4 +1,4 @@
# (c) 2008 Manuel Arostegui <marostegui@artica.es> # Pandora FMS 2.0 Server Installer (c) 2008 Manuel Arostegui <marostegui@artica.es>
# Please see http://pandora.sourceforge.net # Please see http://pandora.sourceforge.net
# This code is licensed under GPL 2.0 license. # This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
@ -19,7 +19,7 @@ then
echo "You are missing the following dependencies" echo "You are missing the following dependencies"
echo " " echo " "
cat output | awk -F ": prerequisite" '{print $2}' | awk -F " " '{print $1}' 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 "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" "
echo " " echo " "
echo "Debian-based distribution do:" 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 libhtml-parser-perl wmi-client xprobe2" 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"
@ -78,9 +78,9 @@ else
if [ -e /usr/local/bin/pandora_server ] if [ -e /usr/local/bin/pandora_server ]
then then
ln -s /usr/local/bin/pandora_server /usr/bin/pandora_server 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_snmpconsole /usr/bin/pandora_snmpconsole
ln -s /usr/local/bin/pandora_recon /usr/bin/pandora_recon 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_network /usr/bin/pandora_network
ln -s /usr/local/bin/pandora_prediction /usr/bin/pandora_prediction 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_plugin /usr/bin/pandora_plugin
ln -s /usr/local/bin/pandora_wmi /usr/bin/pandora_wmi ln -s /usr/local/bin/pandora_wmi /usr/bin/pandora_wmi
@ -111,11 +111,11 @@ fi
} }
uninstall () { uninstall () {
if [ "`uname -s`" != "Linux" ]; then if [ "`uname -s`" != "Linux" ]; then
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
echo "Removing Pandora Servers" echo "Removing Pandora Servers"
rm -Rf /var/spool/pandora/data_in/ rm -Rf /var/spool/pandora/data_in/
echo "If the user Pandora is not being used for any other operations, please delete using the following commands:" echo "If the user Pandora is not being used for any other operations, please delete using the following commands:"
echo " userdel pandora" echo " userdel pandora"
@ -124,31 +124,30 @@ uninstall () {
## I would hate to have a script clear out this users' information without any notification ## I would hate to have a script clear out this users' information without any notification
rm -Rf /var/log/pandora/ 2> /dev/null rm -Rf /var/log/pandora/ 2> /dev/null
rm -Rf /etc/pandora/pandora_server.conf 2> /dev/null rm -Rf /etc/pandora/pandora_server.conf 2> /dev/null
rm -Rf /etc/init.d/pandora_server 2> /dev/null
rm -Rf /etc/init.d/pandora_server 2> /dev/null
rm -Rf /etc/init.d/pandora_network 2> /dev/null rm -Rf /etc/init.d/pandora_network 2> /dev/null
rm -Rf /etc/init.d/pandora_recon 2> /dev/null rm -Rf /etc/init.d/pandora_recon 2> /dev/null
rm -Rf /etc/init.d/pandora_snmpconsole 2> /dev/null rm -Rf /etc/init.d/pandora_snmpconsole 2> /dev/null
rm -Rf /etc/init.d/pandora_prediction 2> /dev/null rm -Rf /etc/init.d/pandora_prediction 2> /dev/null
rm -Rf /etc/init.d/pandora_wmi 2> /dev/null rm -Rf /etc/init.d/pandora_wmi 2> /dev/null
rm -Rf /etc/init.d/pandora_plugin 2> /dev/null rm -Rf /etc/init.d/pandora_plugin 2> /dev/null
rm -Rf /etc/rc2.d/S90pandora_server 2> /dev/null rm -Rf /etc/rc2.d/S90pandora_server 2> /dev/null
rm -Rf /etc/rc2.d/S90pandora_recon 2> /dev/null rm -Rf /etc/rc2.d/S90pandora_recon 2> /dev/null
rm -Rf /etc/rc2.d/S90pandora_network 2> /dev/null rm -Rf /etc/rc2.d/S90pandora_network 2> /dev/null
rm -Rf /etc/rc2.d/S90pandora_snmpconsole 2> /dev/null rm -Rf /etc/rc2.d/S90pandora_snmpconsole 2> /dev/null
rm -Rf /etc/rc2.d/S90pandora_wmi 2> /dev/null rm -Rf /etc/rc2.d/S90pandora_wmi 2> /dev/null
rm -Rf /etc/rc2.d/S90pandora_prediction 2> /dev/null rm -Rf /etc/rc2.d/S90pandora_prediction 2> /dev/null
rm -Rf /etc/rc2.d/S90pandora_plugin 2> /dev/null rm -Rf /etc/rc2.d/S90pandora_plugin 2> /dev/null
rm -Rf /usr/local/bin/pandora_server 2> /dev/null rm -Rf /usr/local/bin/pandora_server 2> /dev/null
rm -Rf /usr/local/bin/pandora_snmpconsole 2> /dev/null rm -Rf /usr/local/bin/pandora_snmpconsole 2> /dev/null
rm -Rf /usr/local/bin/pandora_recon 2> /dev/null rm -Rf /usr/local/bin/pandora_recon 2> /dev/null
rm -Rf /usr/local/bin/pandora_network 2> /dev/null rm -Rf /usr/local/bin/pandora_network 2> /dev/null
rm -Rf /usr/local/bin/pandora_wmi 2> /dev/null rm -Rf /usr/local/bin/pandora_wmi 2> /dev/null
rm -Rf /usr/local/bin/pandora_prediction 2> /dev/null rm -Rf /usr/local/bin/pandora_prediction 2> /dev/null
rm -Rf /usr/local/bin/pandora_plugin 2> /dev/null rm -Rf /usr/local/bin/pandora_plugin 2> /dev/null
rm -Rf /usr/bin/pandora_wmi 2> /dev/null rm -Rf /usr/bin/pandora_wmi 2> /dev/null
rm -Rf /usr/bin/pandora_server 2> /dev/null rm -Rf /usr/bin/pandora_server 2> /dev/null

View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
# Startup script for Pandora SNMP Console # Pandora FMS SNMP Console, startup script
# Sancho Lerena, <slerena@gmail.com> # Copyright (c) 2006-2008 Sancho Lerena, <slerena@gmail.com>
# Linux Version (generic) # Linux Version (generic)
# v1.3 BUILD 070802 # v2.0 Build 080903
# http://www.pandorafms.com
# Compatible with NetSNMP 5.1 or higher # Compatible with NetSNMP 5.1 or higher
@ -17,35 +18,36 @@ DAEMON_LOG="/var/log/pandora/pandora_snmptrap.log"
DAEMON_PID="$PANDORA_PID_PATH/pandora_snmptrapd.pid" DAEMON_PID="$PANDORA_PID_PATH/pandora_snmptrapd.pid"
DAEMON_PATH=/usr/sbin/snmptrapd DAEMON_PATH=/usr/sbin/snmptrapd
# Dont touch this call unless you know are doing. For different versions of NetSNMP Trap daemon, it's possible you need to change some options # Dont touch this call unless you know are doing.
# For different versions of NetSNMP Trap daemon, it's possible you need to change some options
# Please refer NetSNMP documentation in that case. # Please refer NetSNMP documentation in that case.
DAEMON_OPTIONS="-t -On -n -a -Lf $DAEMON_LOG -p $DAEMON_PID -F %4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%a[**]%N[**]%w[**]%W[**]%q[**]%v\n" DAEMON_OPTIONS="-t -On -n -a -Lf $DAEMON_LOG -p $DAEMON_PID -F %4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%a[**]%N[**]%w[**]%W[**]%q[**]%v\n"
DAEMON="$DAEMON_PATH $DAEMON_OPTIONS" DAEMON="$DAEMON_PATH $DAEMON_OPTIONS"
if [ ! -d "$PANDORA_PID_PATH" ] if [ ! -d "$PANDORA_PID_PATH" ]
then then
echo "Pandora FMS cannot write it's PID file in $PANDORA_PID_PATH. Please create that directory" echo "Pandora FMS cannot write it's PID file in $PANDORA_PID_PATH. Please create that directory"
exit exit
fi fi
if [ ! -f "$DAEMON_PATH" ] if [ ! -f "$DAEMON_PATH" ]
then then
echo "NetSNMP snmptrapd not found at $DAEMON_PATH, please check setup and read manual" echo "NetSNMP snmptrapd not found at $DAEMON_PATH, please check setup and read manual"
exit exit
fi fi
case "$1" in case "$1" in
start) start)
if [ -f $DAEMON_PID ] if [ -f $DAEMON_PID ]
then then
CHECK_PID=`cat $DAEMON_PID` CHECK_PID=`cat $DAEMON_PID`
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "snmp" | wc -l` CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "snmp" | wc -l`
if [ $CHECK_PID_RESULT == 1 ] if [ $CHECK_PID_RESULT == 1 ]
then then
echo "NetSNMP Trap daemon is currently running on this machine with PID ($CHECK_PID). Aborting now..." echo "NetSNMP Trap daemon is currently running on this machine with PID ($CHECK_PID). Aborting now..."
exit exit
fi fi
fi fi
SNMP_WARNING=`ps aux | grep "$DAEMON_PATH" | grep -v grep | wc -l` SNMP_WARNING=`ps aux | grep "$DAEMON_PATH" | grep -v grep | wc -l`
if [ $SNMP_WARNING == 1 ] if [ $SNMP_WARNING == 1 ]
@ -81,22 +83,22 @@ case "$1" in
RESULT="`cat $DAEMON_LOG | grep 'errno 13' 2> /dev/null`" RESULT="`cat $DAEMON_LOG | grep 'errno 13' 2> /dev/null`"
if [ -z "$RESULT" ] if [ -z "$RESULT" ]
then then
echo "NetSNMP Trap daemon is now running with PID `cat $DAEMON_PID 2> /dev/null`" echo "NetSNMP Trap daemon is now running with PID `cat $DAEMON_PID 2> /dev/null`"
else else
echo "NetSNMP cannot open port (udp/162). Please execute as root user" echo "NetSNMP cannot open port (udp/162). Please execute as root user"
rm -f $DAEMON_PID 2> /dev/null rm -f $DAEMON_PID 2> /dev/null
fi fi
if [ -f $PANDORA_PID ] if [ -f $PANDORA_PID ]
then then
CHECK_PID=`cat $PANDORA_PID` CHECK_PID=`cat $PANDORA_PID`
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_snmpconsole" | wc -l` CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_snmpconsole" | wc -l`
if [ $CHECK_PID_RESULT == 1 ] if [ $CHECK_PID_RESULT == 1 ]
then then
echo "Pandora FMS SNMP Server is currently running on this machine with PID ($CHECK_PID). Aborting now..." echo "Pandora FMS SNMP Server is currently running on this machine with PID ($CHECK_PID). Aborting now..."
exit exit
fi fi
fi fi
$PANDORA_DAEMON $PANDORA_HOME -D $PANDORA_DAEMON $PANDORA_HOME -D
sleep 1 sleep 1
@ -111,40 +113,40 @@ case "$1" in
fi fi
cd "$OLD_PATH" cd "$OLD_PATH"
;; ;;
stop) stop)
if [ -f $DAEMON_PID ] if [ -f $DAEMON_PID ]
then then
echo "Stopping NetSNMP Trap daemon" echo "Stopping NetSNMP Trap daemon"
PID_1=`cat $DAEMON_PID` PID_1=`cat $DAEMON_PID`
if [ ! -z "`ps -F -p $PID_1 | grep -v grep | grep 'snmptrapd'`" ] if [ ! -z "`ps -F -p $PID_1 | grep -v grep | grep 'snmptrapd'`" ]
then then
kill -9 `cat $DAEMON_PID 2> /dev/null` kill -9 `cat $DAEMON_PID 2> /dev/null`
fi fi
rm -f $DAEMON_PID 2> /dev/null > /dev/null rm -f $DAEMON_PID 2> /dev/null > /dev/null
rm -f $DAEMON_LOG 2> /dev/null > /dev/null rm -f $DAEMON_LOG 2> /dev/null > /dev/null
else else
echo "NetSNMP Trap daemon is not running, cannot stop it." echo "NetSNMP Trap daemon is not running, cannot stop it."
fi fi
if [ -f $PANDORA_PID ] if [ -f $PANDORA_PID ]
then then
echo "Stopping Pandora SNMP Console" echo "Stopping Pandora SNMP Console"
PID_2=`cat $PANDORA_PID` PID_2=`cat $PANDORA_PID`
if [ ! -z "`ps -F -p $PID_2 | grep -v grep | grep 'pandora_snmpconsole'`" ] if [ ! -z "`ps -F -p $PID_2 | grep -v grep | grep 'pandora_snmpconsole'`" ]
then then
kill `cat $PANDORA_PID` 2> /dev/null > /dev/null kill `cat $PANDORA_PID` 2> /dev/null > /dev/null
fi fi
rm -f $PANDORA_PID rm -f $PANDORA_PID
else else
echo "Pandora FMS SNMP Console is not running, cannot stop it." echo "Pandora FMS SNMP Console is not running, cannot stop it."
fi fi
;; ;;
force-reload|restart) force-reload|restart)
$0 stop $0 stop
$0 start $0 start
;; ;;
*) *)
echo "Usage: pandora_snmpconsole {start|stop|restart}" echo "Usage: pandora_snmpconsole {start|stop|restart}"
exit 1 exit 1
esac esac

View File

@ -1,15 +1,16 @@
#!/bin/bash #!/bin/bash
# Pandora FMS WMI Server, startup script # Pandora FMS WMI Server, startup script
# Sancho Lerena, <slerena@gmail.com> # Copyright (c) 2006-2008 Sancho Lerena, <slerena@gmail.com>
# Linux Version (generic) # Linux Version (generic)
# 2.0 Build 080620 # v2.0 Build 080903
# http://www.pandorafms.com
# Configurable path and filenames # Configurable path and filenames
PANDORA_HOME="/etc/pandora/pandora_server.conf" PANDORA_HOME="/etc/pandora/pandora_server.conf"
PANDORA_PID_PATH="/var/run" PANDORA_PID_PATH="/var/run"
PANDORA_PID=$PANDORA_PID_PATH/pandora_wmi.pid PANDORA_PID=$PANDORA_PID_PATH/pandora_wmi.pid
PANDORA_DAEMON=/usr/bin/pandora_wmi PANDORA_DAEMON=/usr/local/bin/pandora_wmi
# Main script # Main script
@ -21,50 +22,50 @@ fi
if [ ! -f $PANDORA_DAEMON ] if [ ! -f $PANDORA_DAEMON ]
then then
echo "Pandora FMS WMI Server not found, please check setup and read manual" echo "Pandora FMS WMI Server not found, please check setup and read manual"
exit exit
fi fi
case "$1" in case "$1" in
start) start)
OLD_PATH="`pwd`" OLD_PATH="`pwd`"
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ ! -z $PANDORA_PID ] if [ ! -z $PANDORA_PID ]
then then
echo "Pandora FMS WMI Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..." echo "Pandora FMS WMI Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..."
exit 1 exit 1
fi fi
$PANDORA_DAEMON $PANDORA_HOME -D $PANDORA_DAEMON $PANDORA_HOME -D
sleep 1 sleep 1
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ ! -z "$PANDORA_PID" ] if [ ! -z "$PANDORA_PID" ]
then then
echo "Pandora FMS WMI Server is now running with PID $PANDORA_PID" echo "Pandora FMS WMI Server is now running with PID $PANDORA_PID"
else else
echo "Cannot start Pandora FMS WMI Server. Aborted." echo "Cannot start Pandora FMS WMI Server. Aborted."
fi fi
cd "$OLD_PATH" cd "$OLD_PATH"
;; ;;
stop) stop)
PANDORA_PID=$(pidof -x $PANDORA_DAEMON) PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ -z $PANDORA_PID ] if [ -z $PANDORA_PID ]
then then
echo "Pandora FMS WMI Server is not running, cannot stop it." echo "Pandora FMS WMI Server is not running, cannot stop it."
exit 1
else
echo "Stopping Pandora FMS WMI 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 exit 1
else
echo "Stopping Pandora FMS WMI 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 esac