[csw-devel] SF.net SVN: gar:[3124] csw/mgar/pkg

j_arndt at users.sourceforge.net j_arndt at users.sourceforge.net
Mon Feb 16 15:21:13 CET 2009


Revision: 3124
          http://gar.svn.sourceforge.net/gar/?rev=3124&view=rev
Author:   j_arndt
Date:     2009-02-16 14:21:13 +0000 (Mon, 16 Feb 2009)

Log Message:
-----------
nsca: Initial commit

Added Paths:
-----------
    csw/mgar/pkg/nsca/
    csw/mgar/pkg/nsca/branches/
    csw/mgar/pkg/nsca/tags/
    csw/mgar/pkg/nsca/trunk/
    csw/mgar/pkg/nsca/trunk/Makefile
    csw/mgar/pkg/nsca/trunk/checksums
    csw/mgar/pkg/nsca/trunk/files/
    csw/mgar/pkg/nsca/trunk/files/CSWnsca.checkinstall
    csw/mgar/pkg/nsca/trunk/files/CSWnsca.depend
    csw/mgar/pkg/nsca/trunk/files/CSWnsca.gspec
    csw/mgar/pkg/nsca/trunk/files/CSWnsca.preinstall
    csw/mgar/pkg/nsca/trunk/files/CSWnsca.prototype
    csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.depend
    csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.gspec
    csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.preinstall
    csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.prototype
    csw/mgar/pkg/nsca/trunk/files/makefile.diff
    csw/mgar/pkg/nsca/trunk/files/nsca
    csw/mgar/pkg/nsca/trunk/files/nsca.xml
    csw/mgar/pkg/nsca/trunk/files/submit_check_results.diff
    csw/mgar/pkg/nsca/trunk/files/svc-nsca


Property changes on: csw/mgar/pkg/nsca/trunk
___________________________________________________________________
Added: svn:ignore
   + cookies
download
work


Added: svn:externals
   + gar https://gar.svn.sf.net/svnroot/gar/csw/mgar/gar/v2


Added: csw/mgar/pkg/nsca/trunk/Makefile
===================================================================
--- csw/mgar/pkg/nsca/trunk/Makefile	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/Makefile	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,37 @@
+GARNAME = nsca
+GARVERSION = 2.7.2
+CATEGORIES = apps
+
+DESCRIPTION = passive checks for nagios
+define BLURB
+  NSCA allows you to integrate passive alerts and checks from remote machines and applications with Nagios. Useful for processing security alerts, as well as redundant and distributed Nagios setups.
+endef
+
+MASTER_SITES = http://mesh.dl.sourceforge.net/sourceforge/nagios/
+DISTFILES  = $(GARNAME)-$(GARVERSION).tar.gz
+DISTFILES += $(call admfiles,CSWnsca, prototype checkinstall preinstall depend)
+DISTFILES += $(call admfiles,CSWsendnsca, preinstall depend)
+DISTFILES += nsca nsca.xml svc-nsca
+
+PATCHFILES += submit_check_results.diff
+PATCHFILES += makefile.diff
+
+CONFIGURE_ARGS = $(DIRPATHS)
+#CONFIGURE_ARGS += --with-nsca-user=nagios
+#CONFIGURE_ARGS += --with-nsca-grp=nagios
+CONFIGURE_ARGS += --with-nsca-port=5667
+
+sysconfdir ?= $(prefix)/etc
+bindir ?= $(prefix)/bin
+localstatedir ?= $(prefix)/nagios/var
+
+
+BUILD_TARGETS = nsca
+
+SKIPTEST = 1
+
+#INSTALL_ARGS = install-nsca
+INSTALL_ARGS += install-sendnsca
+INSTALL_ARGS += install-nsca
+
+include gar/category.mk

Added: csw/mgar/pkg/nsca/trunk/checksums
===================================================================
--- csw/mgar/pkg/nsca/trunk/checksums	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/checksums	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,14 @@
+33a98e7975f633a9489d7a8938ed6131  download/nsca-2.7.2.tar.gz
+f23029e0be9b0379f46a52101c28f328  download/CSWnsca.gspec
+9fa3302e1adfe6fb72e91b3cb0f5fdc3  download/CSWnsca.prototype
+1886b15eafd2e2a5a4b230918960ea9a  download/CSWnsca.checkinstall
+7fef893e65bb68bc0762434dbeace713  download/CSWnsca.preinstall
+4a31b1f69eb7caee94f3fffa1232e9f4  download/CSWnsca.depend
+b82767ed7ab002fea4b3a4395511c93c  download/CSWsendnsca.gspec
+8bf9882f3115e8514ae6d9a866397c71  download/CSWsendnsca.preinstall
+a590499dfa6f086d05cda4d86c2333cc  download/CSWsendnsca.depend
+58baa05824b28682cef9e678c3d0cefa  download/nsca
+b36f9006d3f725cc8d6cb9c01533a75c  download/nsca.xml
+58baa05824b28682cef9e678c3d0cefa  download/svc-nsca
+cbb38cacd3ca318f00dfa0877b6017df  download/submit_check_results.diff
+9e1686ea93030fb004d8c65f8c0a2e7d  download/makefile.diff

Added: csw/mgar/pkg/nsca/trunk/files/CSWnsca.checkinstall
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWnsca.checkinstall	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWnsca.checkinstall	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,32 @@
+# checkinstall script for nsca
+# Verify that the external command group nagioscm exists
+# 2007-12-02 Fix PKG_INSTALL_ROOT usage.  BASEDIR is not used for non
+#            relocatable packages.
+#
+# See if group are needed
+NEEDCMDGROUP=0
+
+# First check target machines group file, THEN check
+# NIS/NIS+/whatever
+
+/usr/bin/grep '^nagioscm:' /etc/group >/dev/null
+if [ $? -ne 0 ] ; then
+        /usr/bin/getent group nagioscm >/dev/null
+        if [ $? -ne 0 ] ; then
+                NEEDCMDGROUP=1
+        fi
+fi
+
+if [ "$NEEDCMDGROUP" = 1 ] ; then
+        echo "***"
+        echo "Group nagioscm must exist for this package install."
+        echo "nagioscm group will be added."
+        ADDCMDGROUP=1
+else
+        echo "nagioscm group detected"
+fi
+
+cat >$1 <<!
+CLASSES='$CLASSES'
+NEEDCMDGROUP='$NEEDCMDGROUP'
+!

Added: csw/mgar/pkg/nsca/trunk/files/CSWnsca.depend
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWnsca.depend	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWnsca.depend	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,3 @@
+P	CSWlibmcrypt   libmcrypt -  GPL replacement for Unix crypt that supports a wide range of algorithms and modes
+P	CSWlibtoolrt   libtool_rt - Generic library support runtime libraries
+P	CSWnagios      nagios nagios network monitoring base package (no plugins)

Added: csw/mgar/pkg/nsca/trunk/files/CSWnsca.gspec
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWnsca.gspec	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWnsca.gspec	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,8 @@
+%var            bitname nsca
+%var            pkgname CSWnsca
+%var		SERVICE_CONF_FILES	/opt/csw/nagios/etc/nsca.cfg
+%var		RC_INIT_SCRIPT	nsca
+%var		SMF_SCRIPT	svc-nsca
+%var		SMF_MANIFEST	nsca.xml
+%include        url file://%{PKGLIB}/csw_dyndepend.gspec
+%include	url file://%{PKGLIB}/smf_enabled.gspec

Added: csw/mgar/pkg/nsca/trunk/files/CSWnsca.preinstall
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWnsca.preinstall	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWnsca.preinstall	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,18 @@
+# preinstall for nagioscm
+# Add the group nagioscm if told to by request script.
+# 2007-12-02 Fix PKG_INSTALL_ROOT usage.  BASEDIR is not used for non
+#            relocatable packages.
+
+if [ "$ADDCMDGROUP" = "1" ] ; then
+        /usr/sbin/groupadd nagioscm
+        echo "Added nagioscm group."
+        /usr/sbin/usermod -G nagioscm nagios
+        echo "Added nagios user to nagioscm group."
+        echo "**"
+        echo "To use external commands, you must add your apache"
+        echo "  user to the nagioscm group."
+        echo "Example: usermod -G nagioscm apache"
+        echo "**"
+fi
+#
+exit 0

Added: csw/mgar/pkg/nsca/trunk/files/CSWnsca.prototype
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWnsca.prototype	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWnsca.prototype	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,13 @@
+1 d none /opt/csw/nagios/bin 0755 root bin
+1 f none /opt/csw/nagios/bin/nsca 0755 root bin
+1 d none /opt/csw/nagios/etc 0755 root bin
+1 f none /opt/csw/nagios/etc/nsca.cfg 0600 root bin
+1 d none /opt/csw/share/doc/nsca 0755 root bin
+1 f none /opt/csw/share/doc/nsca/Changelog 0644 root bin
+1 f none /opt/csw/share/doc/nsca/LEGAL 0644 root bin
+1 f none /opt/csw/share/doc/nsca/README 0644 root bin
+1 f none /opt/csw/share/doc/nsca/SECURITY 0644 root bin
+1 i checkinstall=CSWnsca.checkinstall
+1 i depend=CSWnsca.depend
+1 i pkginfo=CSWnsca.pkginfo
+1 i preinstall=CSWnsca.preinstall

Added: csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.depend
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.depend	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.depend	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,3 @@
+P	CSWlibmcrypt         libmcrypt -  GPL replacement for Unix crypt that supports a wide range of algorithms and modes
+P	CSWlibtoolrt         libtool_rt - Generic library support runtime libraries
+P	CSWnagios      nagios nagios network monitoring base package (no plugins)

Added: csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.gspec
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.gspec	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.gspec	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,3 @@
+%var            bitname sendnsca
+%var            pkgname CSWsendnsca
+%include        url file://%{PKGLIB}/csw_dyndepend.gspec

Added: csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.preinstall
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.preinstall	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.preinstall	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,42 @@
+# preinstall for CSWsendnsca
+# This script exists for the sole purpose of making sure the required user
+# accounts "nagios" and groups "nagios" exist already.
+# based on the CSWpostfix preinstall
+# 2007-12-02 Fix PKG_INSTALL_ROOT usage.  BASEDIR is not used for non
+#            relocatable packages.
+
+NAGIOSHOME=/opt/csw/nagios
+
+#First check target machines password file, THEN check
+#NIS/NIS+/whatever
+
+grep '^nagios:' /etc/passwd >/dev/null
+if [ $? -ne 0 ] ; then
+        getent passwd nagios >/dev/null
+        if [ $? -ne 0 ] ; then
+                NEEDUSER=1
+        fi
+fi
+
+grep '^nagios:' /etc/group >/dev/null
+if [ $? -ne 0 ] ; then
+        getent group nagios >/dev/null
+        if [ $? -ne 0 ] ; then
+                NEEDGROUP=1
+        fi
+fi
+
+if [ "$NEEDGROUP" = 1 ] ; then
+        echo adding nagios group
+        /usr/sbin/groupadd nagios
+else
+        echo nagios group detected
+fi
+
+if [ "$NEEDUSER" = 1 ] ; then
+        echo adding nagios user
+        /usr/sbin/useradd -g nagios nagios
+        /usr/sbin/usermod -s /bin/false -d $NAGIOSHOME nagios
+else
+        echo nagios user detected
+fi

Added: csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.prototype
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.prototype	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/CSWsendnsca.prototype	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,13 @@
+1 d none /opt/csw/bin 0755 root bin
+1 f none /opt/csw/bin/send_nsca 0755 root bin 
+1 d none /opt/csw/etc 0755 root bin
+1 f none /opt/csw/etc/send_nsca.cfg 0644 root bin
+1 d none /opt/csw/share/doc/send_nsca 0755 root bin
+1 f none /opt/csw/share/doc/send_nsca/Changelog 0644 root bin
+1 f none /opt/csw/share/doc/send_nsca/LEGAL 0644 root bin
+1 f none /opt/csw/share/doc/send_nsca/README 0644 root bin
+1 f none /opt/csw/share/doc/send_nsca/SECURITY 0644 root bin
+1 f none /opt/csw/share/doc/send_nsca/submit_check_result-sample 0755 root bin
+1 i depend 102 8932 1233484206
+1 i pkginfo 318 26530 1233484206
+1 i preinstall 1105 19093 1230467644

Added: csw/mgar/pkg/nsca/trunk/files/makefile.diff
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/makefile.diff	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/makefile.diff	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,46 @@
+diff --speed-large-files --minimal -Nru nsca-2.7.2.orig/Makefile.in nsca-2.7.2/Makefile.in
+--- nsca-2.7.2.orig/Makefile.in	2003-10-16 01:17:45.000000000 +0200
++++ nsca-2.7.2/Makefile.in	2009-02-11 10:25:05.717351194 +0100
+@@ -9,6 +9,15 @@
+ SRC_BASE=./src/
+ SRC_INCLUDE=./include/
+ 
++prefix=@prefix@
++BINDIR=@bindir@
++NAGIOSBINDIR=@prefix@/nagios/bin
++NAGIOSCFGDIR=@prefix@/nagios/etc
++CFGDIR=@sysconfdir@
++NSCADOCDIR=$(prefix)/share/doc/nsca
++SENDNSCADOCDIR=@prefix@/share/doc/send_nsca
++INSTALL=@INSTALL@
++
+ all:	
+ 	cd $(SRC_BASE); $(MAKE) $@ ; cd ..
+ 
+@@ -35,6 +44,26 @@
+ 	@echo "client and server binaries."
+ 	@echo ""
+ 
++install-nsca:
++	$(INSTALL) -m 755 src/nsca $(DESTDIR)$(NAGIOSBINDIR)
++	$(INSTALL) -m 600 sample-config/nsca.cfg $(DESTDIR)$(NAGIOSCFGDIR)/nsca.cfg
++	$(INSTALL) -m 755 -d $(DESTDIR)$(NSCADOCDIR)
++	$(INSTALL) -m 644 ./Changelog $(DESTDIR)$(NSCADOCDIR)
++	$(INSTALL) -m 644 ./LEGAL $(DESTDIR)$(NSCADOCDIR)
++	$(INSTALL) -m 644 ./README $(DESTDIR)$(NSCADOCDIR)
++	$(INSTALL) -m 644 ./SECURITY $(DESTDIR)$(NSCADOCDIR)
++
++install-sendnsca:
++	$(INSTALL) -m 755 src/send_nsca $(DESTDIR)$(BINDIR)
++	$(INSTALL) -m 755 -d $(DESTDIR)$(SENDNSCADOCDIR)
++	$(INSTALL) -m 755 -d $(DESTDIR)$(CFGDIR)
++	$(INSTALL) -m 755 src/submit_check_result-sample $(DESTDIR)$(SENDNSCADOCDIR)
++	$(INSTALL) -m 600 sample-config/send_nsca.cfg $(DESTDIR)$(CFGDIR)/send_nsca.cfg
++	$(INSTALL) -m 644 ./Changelog $(DESTDIR)$(SENDNSCADOCDIR)
++	$(INSTALL) -m 644 ./LEGAL $(DESTDIR)$(SENDNSCADOCDIR)
++	$(INSTALL) -m 644 ./README $(DESTDIR)$(SENDNSCADOCDIR)
++	$(INSTALL) -m 644 ./SECURITY $(DESTDIR)$(SENDNSCADOCDIR)
++
+ clean:
+ 	cd $(SRC_BASE); $(MAKE) $@ ; cd ..
+ 	rm -f core

Added: csw/mgar/pkg/nsca/trunk/files/nsca
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/nsca	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/nsca	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Copyright (c) 1992 - 2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident  "@(#)nsca       1.19    01/12/05 SMI"
+# Modified for OpenCSW by Juergen Arndt 2009-02-08 
+# (derived from svc-nrpe written by Alex Moore)
+
+CONFIG_FILE=/opt/csw/nagios/etc/nsca.cfg
+BIN_FILE="/opt/csw/nagios/bin/nsca"
+pidfile=`grep '^pid_file' $CONFIG_FILE |awk '{ FS = "=" } {print $2;}'`
+nsca_USER=`awk -F'=' '/nsca_user/ { print $NF }' $CONFIG_FILE`
+
+case "$1" in
+'restart')
+        [ -n "`pgrep -x -u 0,1,$nsca_USER nsca`" ] && /usr/bin/kill `head -1 $pidfile`
+        # remove pid file
+        if [ -f "$pidfile" ]; then
+            rm "$pidfile"
+        fi
+        if [ -f $CONFIG_FILE ]; then
+            wait 1
+            $BIN_FILE -c $CONFIG_FILE -d
+        fi
+        ;;
+
+'start')
+        if [ -f $CONFIG_FILE ]; then
+            $BIN_FILE -c $CONFIG_FILE -d
+        fi
+        ;;
+
+'stop') 
+        [ -n "`pgrep -x -u 0,1,$nsca_USER nsca`" ] && /usr/bin/kill `head -1 $pidfile`
+        # remove pid file
+        if [ -f "$pidfile" ]; then
+            rm "$pidfile"
+        fi
+        ;;
+
+*)
+        echo "Usage: $0 { start | stop | restart }"
+        exit 1
+        ;;
+esac
+exit 0

Added: csw/mgar/pkg/nsca/trunk/files/nsca.xml
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/nsca.xml	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/nsca.xml	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,82 @@
+<?xml version='1.0'?>
+ <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
+<!--
+
+        Juergen Arndt (opencsw.org) 02/09
+        Service manifest for nsca
+ -->
+
+ <service_bundle type='manifest' name='nsca:nrpe'>
+
+ <service
+         name='network/cswnsca'
+         type='service'
+         version='1'>
+         <create_default_instance enabled='false' />
+         <single_instance />
+
+
+         <dependency name='fs'
+                 grouping='require_all'
+                 restart_on='none'
+                 type='service'>
+                 <service_fmri value='svc:/system/filesystem/local' />
+         </dependency>
+
+         <dependency
+                 name='config-file'
+                 grouping='require_any'
+                 restart_on='refresh'
+                 type='path'>
+                 <service_fmri
+                     value='file://localhost/opt/csw/nagios/etc/nsca.cfg' />
+         </dependency>
+
+	<dependency
+		name='nagios-command-file'
+		grouping='require_any'
+		restart_on='none'
+		type='path'>
+		<service_fmri value='file://localhost/opt/csw/nagios/var/rw/nagios.cmd' />
+	</dependency>
+
+
+         <dependency name='net'
+                 grouping='require_all'
+                 restart_on='none'
+                 type='service'>
+                 <service_fmri value='svc:/network/loopback' />
+         </dependency>
+
+         <dependency name='network'
+                 grouping='require_all'
+                 restart_on='none'
+                 type='service'>
+                 <service_fmri value='svc:/network/service' />
+         </dependency>
+
+         <dependency name='syslog'
+                 grouping='optional_all'
+                 restart_on='none'
+                 type='service'>
+                 <service_fmri value='svc:/system/system-log' />
+         </dependency>
+
+         <exec_method
+                 type='method'
+                 name='start'
+                 exec='/opt/csw/lib/svc/method/svc-nsca start'
+                 timeout_seconds='-1'>
+         </exec_method>
+
+         <exec_method
+                 type='method'
+                 name='stop'
+                 exec='/opt/csw/lib/svc/method/svc-nsca stop'
+                 timeout_seconds='-1'>
+         </exec_method>
+
+
+ </service>
+
+ </service_bundle>

Added: csw/mgar/pkg/nsca/trunk/files/submit_check_results.diff
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/submit_check_results.diff	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/submit_check_results.diff	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,40 @@
+diff --speed-large-files --minimal -Nru nsca-2.7.2.orig/src/submit_check_result-sample nsca-2.7.2/src/submit_check_result-sample
+--- nsca-2.7.2.orig/src/submit_check_result-sample	1970-01-01 01:00:00.000000000 +0100
++++ nsca-2.7.2/src/submit_check_result-sample	2009-02-07 16:12:02.559207031 +0100
+@@ -0,0 +1,36 @@
++#!/bin/sh
++
++# Arguments:
++#  $1 = host_name (Short name of host that the service is
++#       associated with)
++#  $2 = svc_description (Description of the service)
++#  $3 = state_string (A string representing the status of
++#       the given service - "OK", "WARNING", "CRITICAL"
++#       or "UNKNOWN")
++#  $4 = plugin_output (A text string that should be used
++#       as the plugin output for the service checks)
++#
++
++# Convert the state string to the corresponding return code
++return_code=-1
++
++case "$3" in
++        OK)
++        return_code=0
++                    ;;
++                WARNING)
++                    return_code=1
++                        ;;
++                CRITICAL)
++                    return_code=2
++                        ;;
++                UNKNOWN)
++                    return_code=-1
++                        ;;
++        esac
++
++# pipe the service check info into the send_nsca program, which
++# in turn transmits the data to the nsca daemon on the central
++# monitoring server
++
++/usr/bin/echo "$1\t$2\t$return_code\t$4" |  /opt/csw/bin/send_nsca my.central.server -c /opt/csw/etc/send_nsca.cfg

Added: csw/mgar/pkg/nsca/trunk/files/svc-nsca
===================================================================
--- csw/mgar/pkg/nsca/trunk/files/svc-nsca	                        (rev 0)
+++ csw/mgar/pkg/nsca/trunk/files/svc-nsca	2009-02-16 14:21:13 UTC (rev 3124)
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Copyright (c) 1992 - 2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident  "@(#)nsca       1.19    01/12/05 SMI"
+# Modified for OpenCSW by Juergen Arndt 2009-02-08 
+# (derived from svc-nrpe written by Alex Moore)
+
+CONFIG_FILE=/opt/csw/nagios/etc/nsca.cfg
+BIN_FILE="/opt/csw/nagios/bin/nsca"
+pidfile=`grep '^pid_file' $CONFIG_FILE |awk '{ FS = "=" } {print $2;}'`
+nsca_USER=`awk -F'=' '/nsca_user/ { print $NF }' $CONFIG_FILE`
+
+case "$1" in
+'restart')
+        [ -n "`pgrep -x -u 0,1,$nsca_USER nsca`" ] && /usr/bin/kill `head -1 $pidfile`
+        # remove pid file
+        if [ -f "$pidfile" ]; then
+            rm "$pidfile"
+        fi
+        if [ -f $CONFIG_FILE ]; then
+            wait 1
+            $BIN_FILE -c $CONFIG_FILE -d
+        fi
+        ;;
+
+'start')
+        if [ -f $CONFIG_FILE ]; then
+            $BIN_FILE -c $CONFIG_FILE -d
+        fi
+        ;;
+
+'stop') 
+        [ -n "`pgrep -x -u 0,1,$nsca_USER nsca`" ] && /usr/bin/kill `head -1 $pidfile`
+        # remove pid file
+        if [ -f "$pidfile" ]; then
+            rm "$pidfile"
+        fi
+        ;;
+
+*)
+        echo "Usage: $0 { start | stop | restart }"
+        exit 1
+        ;;
+esac
+exit 0


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list