Revision: 18210 http://gar.svn.sourceforge.net/gar/?rev=18210&view=rev Author: j_arndt Date: 2012-06-03 15:45:46 +0000 (Sun, 03 Jun 2012) Log Message: ----------- nrpe: finalizing 2.13
Modified Paths: -------------- csw/mgar/pkg/nrpe/trunk/Makefile csw/mgar/pkg/nrpe/trunk/files/cswnrpe Removed Paths: ------------- csw/mgar/pkg/nrpe/trunk/files/CSWnrpe.postinstall Modified: csw/mgar/pkg/nrpe/trunk/Makefile =================================================================== --- csw/mgar/pkg/nrpe/trunk/Makefile 2012-06-03 11:00:42 UTC (rev 18209) +++ csw/mgar/pkg/nrpe/trunk/Makefile 2012-06-03 15:45:46 UTC (rev 18210) @@ -4,7 +4,7 @@ GARTYPE = v2 SPKG_DESC_CSWnrpe = Nagios remote plugin executor -SPKG_DESC_CSWnrpeplugin = Nagios plugin that connects to nrpe demon +SPKG_DESC_CSWnrpe-plugin = Nagios plugin that connects to nrpe demon define BLURB NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.). NRPE can also communicate with some of the Windows agent addons, so you can execute scripts and check metrics on remote Windows machines as well. @@ -21,30 +21,33 @@ EXTRA_MODULATORS = SIZE MODULATIONS_SIZE = 1k 8k -# Distfiles for CSWnrpe - DISTFILES += CSWnrpe.preinstall -#DISTFILES += CSWnrpe.prototype DISTFILES += cswnrpe cswusergroup DISTFILES += README_8k -# Distfiles for nrpe_plugin - -#DISTFILES += CSWnrpeplugin.prototype - -#PATCHFILES = patch.diff - PATCHFILES_isa-sparcv8plus-size-8k = 0002-changing-packetbuffer-length-to-8k.patch PATCHFILES_isa-pentium_pro-size-8k = 0002-changing-packetbuffer-length-to-8k.patch PACKAGING_PLATFORMS = solaris10-sparc solaris10-i386 -PACKAGES = CSWnrpe CSWnrpeplugin +# +# +# + +PACKAGES = CSWnrpe CSWnrpe-plugin CATALOGNAME_CSWnrpe = nrpe -CATALOGNAME_CSWnrpeplugin = nrpe_plugin +CATALOGNAME_CSWnrpe-plugin = nrpe_plugin +OBSOLETED_BY_CSWnrpe-plugin = CSWnrpeplugin +SPKG_CATALOG_NAME_CSWnrpeplugin = nrpe_plugin_stub + +# +# files for CSWnrpe +# + PKGFILES_CSWnrpe = /opt/csw/bin/nrpe_1k PKGFILES_CSWnrpe += /opt/csw/bin/nrpe_8k +PKGFILES_CSWnrpe += /opt/csw/bin/nrpe PKGFILES_CSWnrpe += /etc/opt/csw/nrpe.cfg.CSW PKGFILES_CSWnrpe += /opt/csw/share/doc/nrpe PKGFILES_CSWnrpe += /opt/csw/share/doc/nrpe/NRPE.pdf @@ -56,23 +59,40 @@ PKGFILES_CSWnrpe += /opt/csw/share/doc/nrpe/SECURITY PKGFILES_CSWnrpe += /opt/csw/nagios PKGFILES_CSWnrpe += /etc/opt/csw/init.d/cswnrpe +PKGFILES_CSWnrpe += /etc/opt/csw/init.d/cswusergroup PKGFILES_CSWnrpe += /opt/csw/etc/templates/CSWnrpe$(CFGDIR) PKGFILES_CSWnrpe += /opt/csw/etc/templates/CSWnrpe$(CFGDIR)/nrpe.cfg -PKGFILES_CSWnrpeplugin = /opt/csw/libexec/nagios-plugins -PKGFILES_CSWnrpeplugin += /opt/csw/libexec/nagios-plugins/check_nrpe -PKGFILES_CSWnrpeplugin += /opt/csw/libexec/nagios-plugins/check_nrpe_8k -PKGFILES_CSWnrpeplugin += /opt/csw/share/doc/nrpe -PKGFILES_CSWnrpeplugin += /opt/csw/share/doc/nrpe/README_8k -PKGFILES_CSWnrpeplugin += /opt/csw/share/doc/nrpe_plugin -PKGFILES_CSWnrpeplugin += /opt/csw/share/doc/nrpe_plugin/license +# +# files for CSWnrpe-plugin +# +PKGFILES_CSWnrpe-plugin = /opt/csw/libexec/nagios-plugins +PKGFILES_CSWnrpe-plugin += /opt/csw/libexec/nagios-plugins/check_nrpe +PKGFILES_CSWnrpe-plugin += /opt/csw/libexec/nagios-plugins/check_nrpe_1k +PKGFILES_CSWnrpe-plugin += /opt/csw/libexec/nagios-plugins/check_nrpe_8k +PKGFILES_CSWnrpe-plugin += /opt/csw/share/doc/nrpe +PKGFILES_CSWnrpe-plugin += /opt/csw/share/doc/nrpe/README_8k +PKGFILES_CSWnrpe-plugin += /opt/csw/share/doc/nrpe_plugin +PKGFILES_CSWnrpe-plugin += /opt/csw/share/doc/nrpe_plugin/license -RUNTIME_DEP_PKGS_CSWnrpe = CSWosslrt CSWtcpwrap -RUNTIME_DEP_PKGS_CSWnrpeplugin = CSWosslrt -#SPKG_CLASSES_CSWnrpe = none cswusergroup cswpreserveconf cswinitsmf +# +# migrate configuration +# +MIGRATE_FILES_CSWnrpe = nrpe.cfg +MIGRATE_SOURCE_DIR = /opt/csw/etc +MIGRATE_DEST_DIR = /etc/opt/csw + +# +# +# + +RUNTIME_DEP_PKGS_CSWnrpe-plugin += CSWlibssl1-0-0 +RUNTIME_DEP_PKGS_CSWnrpe += CSWlibwrap1 +RUNTIME_DEP_PKGS_CSWnrpe += CSWlibssl1-0-0 + LICENSE = LEGAL NOISALIST = 1 @@ -110,6 +130,25 @@ USERGROUP = /etc/opt/csw/pkg/CSWnrpe/cswusergroup #POSTMSG = /opt/csw/share/doc/nrpe/README.CSW +# +# overrides +# + +# Bad content only in READMEs and as examples in config files + +CHECKPKG_OVERRIDES_CSWnrpe += file-with-bad-content|/usr/local|root/opt/csw/share/doc/nrpe/SECURITY +CHECKPKG_OVERRIDES_CSWnrpe += file-with-bad-content|/usr/local|root/opt/csw/share/doc/nrpe/README +CHECKPKG_OVERRIDES_CSWnrpe += file-with-bad-content|/usr/local|root/opt/csw/etc/templates/CSWnrpe/etc/opt/csw/nrpe.cfg + +# README_8k should be in every package + +CHECKPKG_OVERRIDES_CSWnrpe += file-collision|/opt/csw/share/doc/nrpe/README_8k|CSWnrpe|CSWnrpe-plugin +CHECKPKG_OVERRIDES_CSWnrpe-plugin += file-collision|/opt/csw/share/doc/nrpe/README_8k|CSWnrpe|CSWnrpe-plugin + +# +# +# + include gar/category.mk DOCDIR=$(datadir)/doc/nrpe @@ -123,8 +162,10 @@ @ginstall -m 755 -d $(DESTDIR)$(LIBEXECDIR) @ginstall -m 755 -d $(DESTDIR)$(BINDIR) @ginstall -m 755 -d $(DESTDIR)/nagios - @ginstall -m 755 $(WORKSRC)/src/check_nrpe $(DESTDIR)$(LIBEXECDIR) + @ginstall -m 755 $(WORKSRC)/src/check_nrpe $(DESTDIR)$(LIBEXECDIR)/check_nrpe_1k + @ln -s $(LIBEXECDIR)/check_nrpe_1k $(DESTDIR)$(LIBEXECDIR)/check_nrpe @ginstall -m 755 $(WORKSRC)/src/nrpe $(DESTDIR)$(BINDIR)/nrpe_1k + @ln -s $(BINDIR)/nrpe_1k $(DESTDIR)$(BINDIR)/nrpe @ginstall -m 644 $(WORKSRC)/docs/NRPE.pdf $(DESTDIR)$(DOCDIR) @ginstall -m 644 $(FILEDIR)/README_8k $(DESTDIR)$(DOCDIR) @ginstall -m 644 $(WORKSRC)/LEGAL $(DESTDIR)$(DOCDIR) @@ -150,6 +191,6 @@ merge-copy-nrpe-only: cp $(INSTALLISADIR)$(bindir)/nrpe_1k $(PKGROOT)$(bindir)/nrpe_8k - cp $(INSTALLISADIR)$(LIBEXECDIR)/check_nrpe $(PKGROOT)$(LIBEXECDIR)/check_nrpe_8k + cp $(INSTALLISADIR)$(LIBEXECDIR)/check_nrpe_1k $(PKGROOT)$(LIBEXECDIR)/check_nrpe_8k @$(MAKECOOKIE) Deleted: csw/mgar/pkg/nrpe/trunk/files/CSWnrpe.postinstall =================================================================== --- csw/mgar/pkg/nrpe/trunk/files/CSWnrpe.postinstall 2012-06-03 11:00:42 UTC (rev 18209) +++ csw/mgar/pkg/nrpe/trunk/files/CSWnrpe.postinstall 2012-06-03 15:45:46 UTC (rev 18210) @@ -1,70 +0,0 @@ -# postinstall for nrpe package -# 2007-01-19 Add csw.conf support -# 2007-09-11 Fix PKG_INSTALL_ROOT usage. BASEDIR is not used for non -# relocatable packages. -# - -# daemons are started by default -enable_daemon=yes - -# Source csw.conf, if it exists -if [ -f $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf ] ; then - . $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf -fi -if [ -f $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf ] ; then - . $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf -fi - -# If defined, autoenable for the specific daemon name takes precedence -if [ "$autoenable_nrpe" = "no" ] ; then - enable_daemon=no -elif [ "$autoenable_daemons" = "no" -a ! -n "$autoenable_nrpe" ] ; then - enable_daemon=no -fi - -# Set variable for the availability of SMF -smf=no -if [ -f /usr/sbin/svccfg -a -f $BASEDIR/usr/sbin/svcadm ] - then - smf=yes -fi - -# Stop nrpe if it is running -if pgrep nrpe >/dev/null 2>&1 ; then - echo "## Stopping nrpe" - if [ $smf = yes ]; then - /usr/sbin/svcadm disable svc:/application/cswnrpe >/dev/null 2>&1 - else - /etc/init.d/cswnrpe stop >/dev/null 2>&1 - fi - while pgrep nrpe > /dev/null - do - sleep 1 - done -fi - -if [ $smf = yes ]; then - # Register with SMF - echo "Configuring service in SMF" - /usr/sbin/svccfg import /opt/csw/var/svc/manifest/application/nrpe.xml >/dev/null 2>&1 - /usr/sbin/svcadm disable svc:application/cswnrpe >/dev/null 2>&1 - echo "nrpe is using Service Management Facility. The FMRI is:" - echo " svc:/application/cswnrpe:default" -fi - -# Start nrpe -if [ "$enable_daemon" = "yes" ] ; then - if [ -f $BASEDIR/opt/csw/nagios/etc/nrpe.cfg ]; then - echo "## Starting nrpe" - if [ $smf = yes ]; then - /usr/sbin/svcadm enable svc:/application/cswnrpe >/dev/null 2>&1 - else - /etc/init.d/cswnrpe start >/dev/null 2>&1 - fi - else - echo "## Not starting nrpe - configuration file not found" - if [ $smf = yes ] ; then - /usr/sbin/svcadm disable svc:/application/cswnrpe >/dev/null 2>&1 - fi - fi -fi Modified: csw/mgar/pkg/nrpe/trunk/files/cswnrpe =================================================================== --- csw/mgar/pkg/nrpe/trunk/files/cswnrpe 2012-06-03 11:00:42 UTC (rev 18209) +++ csw/mgar/pkg/nrpe/trunk/files/cswnrpe 2012-06-03 15:45:46 UTC (rev 18210) @@ -1,86 +1,144 @@ #!/bin/sh + +BINDIR="/opt/csw/bin" +BINFILE="$BINDIR/nrpe" + +RUNFLAG=1 + # -# Copyright (c) 1992 - 2001 by Sun Microsystems, Inc. -# All rights reserved. +# Solaris Release # -#ident "@(#)nrpe 1.19 01/12/05 SMI" -# Modified for CSW by Alex Moore 2005-12-03 -# 2007-08-18 Add pid file support. -# 2007-08-19 Fix nagios uid used for pgrep. Thanks to Will McDonald for this. -# Modified for OpenCSW by Juergen Arndt 2009-03-14 -#RC_KNUM 20 # Number used for kill script symlink, e.g. K20cswfoo -#RC_SNUM 80 # Number used for start script symlink, e.g. S80cswfoo -#RC_KLEV 0,1,2,S # Run levels that should have a kill script symlink -#RC_SLEV 3 # Run levels that should have a start script symlink -#FMRI application # FMRI path for service -#AUTOENABLE yes +SOLREL=`uname -r | awk -F. '{print $2}'` -SMF_EXIT_ERR_CONFIG=1 +# +# +# -if [ -f /lib/svc/share/smf_include.sh ] +if [ $SOLREL -ge 10 ] then - . /lib/svc/share/smf_include.sh + ZONENAME=`zonename` + . /lib/svc/share/smf_include.sh fi +# +# +# + CONFIG_FILE=/etc/opt/csw/nrpe.cfg -if [ ! -f $CONFIG_FILE ] ; then - CONFIG_FILE=/opt/csw/etc/nrpe.cfg -fi if [ ! -f $CONFIG_FILE ] then - exit $SMF_EXIT_ERR_CONFIG + if [ $SOLREL -lt 10 ] + then + exit 1 + else + exit $SMF_EXIT_ERR_CONFIG + fi fi -BIN_FILE="/opt/csw/bin/nrpe" -pidfile=`awk -F'=' '/^[ \t]*pid_file/ {print $2}' $CONFIG_FILE` -NRPE_USER=`awk -F'=' '/^[ \t]*nrpe_user/ { print $2 }' $CONFIG_FILE` +# +# +# -start_nrpe () +get_pid () { - if [ -f $CONFIG_FILE ]; then - wait 1 - $BIN_FILE -c $CONFIG_FILE -d + if [ $SOLREL -lt 10 ] + then + pid=`ps -ef | grep -v "grep" | grep $BINFILE | awk '{print $2}'` + else + pid=`ps -fz $ZONENAME | grep -v "grep" | grep $BINFILE | awk '{print $2}'` fi } -stop_nrpe () +# +# +# + +stop () { - if [ -f "$pidfile" ]; then - if [ `uname -r` = 5.8 -o `uname -r` = 5.9 ] - then - [ -n "`pgrep -x -u 0,1,$NRPE_USER -f \"$BIN_FILE -c $CONFIGFILE -d\"`" ] && /usr/bin/kill `head -1 $pidfile` - else - [ -n "`pgrep -x -u 0,1,$NRPE_USER -z \`zonename\` -f \"$BIN_FILE -c $CONFIG_FILE -d\"`" ] && /usr/bin/kill `head -1 $pidfile` - fi - rm "$pidfile" - else - if [ `uname -r` = 5.8 -o `uname -r` = 5.9 ] - then - /usr/bin/kill `pgrep -x -u 0,1,$NRPE_USER -f "$BIN_FILE -c $CONFIGFILE -d"` - else - /usr/bin/kill `pgrep -x -u 0,1,$NRPE_USER -z \`zonename\` -f "$BIN_FILE -c $CONFIG_FILE -d"` - fi - fi + get_pid + + if [ "$pid" ] + then + kill $pid + sleep 1 + kill -9 $pid 2>/dev/null + echo "$BINFILE stopped." + else + echo "$BINFILE was not running." + fi } -case "$1" in -'restart') - stop_nrpe - start_nrpe - ;; +# +# +# -'start') - start_nrpe - ;; -'stop') - stop_nrpe - ;; +status () +{ + get_pid + + if [ "$pid" ] + then + echo "$BINFILE running with pid $pid." + RUNFLAG=0 + else + echo "$BINFILE not running." + RUNFLAG=1 + fi +} -*) - echo "Usage: $0 { start | stop | restart }" - exit 1 - ;; +# +# +# + +start () +{ + get_pid + + if [ "$pid" ] # already running? + then + echo "$BINFILE already running with $pid." + return 1 + fi + + if [ -f $BINFILE ] # does it exist? + then + $BINFILE -c $CONFIG_FILE -d + get_pid + echo "$BINFILE running with pid $pid" + else + if [ $SOLREL -lt 10 ] + then + echo "$BINFILE does not exist." + exit 1 + else + echo "$BINFILE does not exist." + exit $SMF_EXIT_ERR_FATAL + fi + fi +} + +# +# +# + +print_usage () +{ + echo "usage: $0 {start|stop|status}" +} + +case "$1" in + "status" ) status + exit $RUNFLAG + ;; + "start" ) start + exit 0 + ;; + "stop" ) stop + exit 0 + ;; + * ) print_usage + exit 1 + ;; esac -exit 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ devel mailing list devel@lists.opencsw.org https://lists.opencsw.org/mailman/listinfo/devel