[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

David GUENAULT dguenault at monitoring-fr.org
Tue Feb 28 22:09:44 UTC 2012


The following commit has been merged in the debian/master branch:
commit 11688b8ca7b80601ceae4d3e3292a5deeaa38226
Author: David GUENAULT <dguenault at monitoring-fr.org>
Date:   Tue Dec 27 16:23:11 2011 +0100

    Added support for pnp4nagios installation

diff --git a/contrib/alternative-installation/shinken-install/shinken.conf b/contrib/alternative-installation/shinken-install/shinken.conf
index 2c32d59..ba2c2e7 100644
--- a/contrib/alternative-installation/shinken-install/shinken.conf
+++ b/contrib/alternative-installation/shinken-install/shinken.conf
@@ -81,3 +81,9 @@ export NAGPLUGAPTPKG="libgnutls-dev libmysqlclient-dev libssl-dev libsnmp-perl l
 export CHECKORACLEHEALTHAPTPKG="libdbi-perl libaio1"
 export CHECKORACLEHEALTHCPAN="http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.36.tar.gz"
 export CHECKORACLEHEALTH="http://labs.consol.de/wp-content/uploads/2011/09/check_oracle_health-1.7.3.tar.gz"
+
+export PNPBRANCH="0.6"
+export PNPRELEASE="16"
+export PNPPREFIX="/usr/local/pnp4nagios"
+export PNPURI="http://downloads.sourceforge.net/project/pnp4nagios/PNP-$PNPBRANCH/pnp4nagios-$PNPBRANCH.$PNPRELEASE.tar.gz"
+export PNPAPTPKG="rrdtool apache2 libapache2-mod-php5 librrds-perl php5-gd"
diff --git a/contrib/alternative-installation/shinken-install/shinken.sh b/contrib/alternative-installation/shinken-install/shinken.sh
index 506bb1f..4366b0a 100755
--- a/contrib/alternative-installation/shinken-install/shinken.sh
+++ b/contrib/alternative-installation/shinken-install/shinken.sh
@@ -385,6 +385,13 @@ function relocate(){
 	cadre "Relocate source tree to $TARGET" green
 	# relocate source tree
 	cd $TARGET
+	
+	# relocate macros
+	for f in $(find $TARGET/contrib/alternative-installation/shinken-install/tools/macros | grep "\.macro$")
+	do
+		cecho " > relocating macro $f" green
+		sed -i "s#__PREFIX__#$TARGET#g" $f
+	done
 
 	# relocate nagios plugin path
 	sed -i "s#/usr/lib/nagios/plugins#$TARGET/libexec#g" ./etc/resource.cfg
@@ -1006,13 +1013,85 @@ echo "Usage : shinken -k | -i | -w | -d | -u | -b | -r | -l | -c | -h | -a | -z
 	-c	Compress rotated logs
     -e  which daemons to keep enabled at boot time
 	-z 	This is a really special usecase that allow to install shinken on Centreon Enterprise Server in place of nagios
-	-p  Install plugins (args should be one of the following : check_esx3|nagios-plugins|check_oracle_health)
-	-h	Show help
-"
+	-p  Install plugins or addons (args should be one of the following : check_esx3|nagios-plugins|check_oracle_health|capture_plugin|pnp4nagios)
+	-h	Show help"
+}
+
+# addons installation
+
+# pnp4nagios
+function install_pnp4nagios(){
+	if [ "$CODE" == "REDHAT" ]
+	then
+		cecho " > Unsuported" red
+		exit 2
+	fi
+	cadre "Install pnp4nagios addon" green
+	cd /tmp
+	cecho " > Installing prerequisites" green
+	for p in $PNPAPTPKG
+	do
+		cecho " -> Installing $p" green
+		apt-get install -y $p > /dev/null 2>&1
+	done
+
+	filename=$(echo $PNPURI | awk -F"/" '{print $NF}')
+	folder=$(echo $filename | sed -e "s/\.tar\.gz//g")
+
+	if [ -z "$filename" ]
+	then 
+		cecho " > Getting pnp4nagios archive" green
+		wget $PNPURI > /dev/null 2>&1
+	fi
+	
+	cecho " > Extracting archive" green
+	if [ -d "$folder" ]
+	then 
+		rm -Rf $folder
+	fi 
+	tar zxvf $filename > /dev/null 2>&1
+	cd $folder
+	cecho " > Enable mod rewrite for apache" green 
+	a2enmod rewrite > /dev/null 2>&1
+	/etc/init.d/apache2 restart > /dev/null 2>&1
+	cecho " > Configuring source tree" green
+	./configure --prefix=$PNPPREFIX --with-nagios-user=$SKUSER --with-nagios-group=$SKGROUP > /dev/null 2>&1	
+	cecho " > Building ...." green
+	make all > /dev/null 2>&1
+	cecho " > Installing" green
+	make fullinstall > /dev/null 2>&1
+	rm -f $PNPPREFIX/share/install.php
+	/etc/init.d/apache2 restart > /dev/null 2>&1
+	cecho " > Enable npcdmod" green
+	do_skmacro enable_npcd.macro $PNPPREFIX/etc/npcd.cfg
+}
+
 
+function do_skmacro(){
+	macro=$1
+	args=$2
+	export PYTHONPATH="$TARGET"
+	export SHINKEN="$PYTHONPATH"
+	export SKTOOLS="$PYTHONPATH/contrib/alternative-installation/shinken-install/tools"
+	$SKTOOLS/skonf.py -a macros -f $SKTOOLS/macros/$macro -d $args > /dev/null 2>&1
 }
+
+
+
 # plugins installation part
 
+# capture_plugin
+function install_capture_plugin(){
+	cadre "Install capture_plugin" green
+	cd /tmp
+	cecho " > Getting capture_plugin" green
+	wget http://www.waggy.at/nagios/capture_plugin.txt > /dev/null 2>&1
+	cecho " > Installing capture_plugin" green
+	mv capture_plugin.txt $TARGET/libexec/capture_plugin
+	chmod +x $TARGET/libexec/capture_plugin	
+	chown $SKUSER:$SKGROUP $TARGET/libexec/capture_plugin
+}
+
 # check_esx3
 
 function install_check_esx3(){
@@ -1198,6 +1277,14 @@ while getopts "kidubcr:lz:hsvp:we:" opt; do
 			then
 				install_check_oracle_health
 				exit 0
+			elif [ "$OPTARG" == "capture_plugin" ]
+			then
+				install_capture_plugin
+				exit 0
+			elif [ "$OPTARG" == "pnp4nagios" ]
+			then
+				install_pnp4nagios
+				exit 0
 			else
 				cecho " > Unknown plugin $OPTARG" red
 			fi
diff --git a/contrib/alternative-installation/shinken-install/tools/macros/control_satelites.macros b/contrib/alternative-installation/shinken-install/tools/macros/control_satelites.macros
index 9e7763a..1bc2080 100644
--- a/contrib/alternative-installation/shinken-install/tools/macros/control_satelites.macros
+++ b/contrib/alternative-installation/shinken-install/tools/macros/control_satelites.macros
@@ -1,5 +1,5 @@
 # macro for controling satelites
 # Arguments are :
 # ARG1 : action (start,stop,restart)
-setauthfile /root/shinken/contrib/alternative-installation/shinken-install/tools/macros/auth  
+setauthfile __PREFIX__/contrib/alternative-installation/shinken-install/tools/macros/auth  
 control ARG1 
diff --git a/contrib/alternative-installation/shinken-install/tools/macros/enable_npcd.macro b/contrib/alternative-installation/shinken-install/tools/macros/enable_npcd.macro
index aeb1f3c..c28d6f0 100644
--- a/contrib/alternative-installation/shinken-install/tools/macros/enable_npcd.macro
+++ b/contrib/alternative-installation/shinken-install/tools/macros/enable_npcd.macro
@@ -1,10 +1,9 @@
 # Enable and configure ndo mysql broker module
 # Arguments are :
 # ARG1 : npcd.cfg path 
-setconfigfile /opt/shinken/etc/shinken-specific.cfg
-setauthfile /root/shinken/contrib/alternative-installation/shinken-install/tools/macros/auth
+setconfigfile __PREFIX__/etc/shinken-specific.cfg
+setauthfile __PREFIX__/contrib/alternative-installation/shinken-install/tools/macros/auth
 setparam config_file=ARG1 from module where module_type=npcdmod
 getdirective modules from broker where broker_name=broker-1
 setparam modules=LAST,NPCDMOD from broker where broker_name=broker-1
 writeconfig
-sync

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list