From a9f5ac6154a930b3e55a79891f61c32f9b7d21a2 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 23 Apr 2015 15:37:59 +0000 Subject: Add net-mgmt/nsca-ng and net-mgmt/nsca-ng-client, client-server pair which makes the Nagios command file accessible to remote systems. PR: 188938 Submitted by root peng spline inf fu-berlin de Sponsored by: Absolight --- net-mgmt/Makefile | 2 + net-mgmt/nsca-ng-client/Makefile | 15 ++++++ net-mgmt/nsca-ng-client/pkg-plist | 5 ++ net-mgmt/nsca-ng/Makefile | 56 +++++++++++++++++++++++ net-mgmt/nsca-ng/distinfo | 2 + net-mgmt/nsca-ng/files/nsca-ng.in | 36 +++++++++++++++ net-mgmt/nsca-ng/files/patch-src_server_nsca-ng.c | 16 +++++++ net-mgmt/nsca-ng/pkg-descr | 19 ++++++++ net-mgmt/nsca-ng/pkg-plist | 4 ++ 9 files changed, 155 insertions(+) create mode 100644 net-mgmt/nsca-ng-client/Makefile create mode 100644 net-mgmt/nsca-ng-client/pkg-plist create mode 100644 net-mgmt/nsca-ng/Makefile create mode 100644 net-mgmt/nsca-ng/distinfo create mode 100644 net-mgmt/nsca-ng/files/nsca-ng.in create mode 100644 net-mgmt/nsca-ng/files/patch-src_server_nsca-ng.c create mode 100644 net-mgmt/nsca-ng/pkg-descr create mode 100644 net-mgmt/nsca-ng/pkg-plist diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile index c15518b..b1203fe 100644 --- a/net-mgmt/Makefile +++ b/net-mgmt/Makefile @@ -173,6 +173,8 @@ SUBDIR += nrpe-ssl SUBDIR += nsca SUBDIR += nsca-client + SUBDIR += nsca-ng + SUBDIR += nsca-ng-client SUBDIR += nsca27 SUBDIR += nsca27-client SUBDIR += nstreams diff --git a/net-mgmt/nsca-ng-client/Makefile b/net-mgmt/nsca-ng-client/Makefile new file mode 100644 index 0000000..5b81474 --- /dev/null +++ b/net-mgmt/nsca-ng-client/Makefile @@ -0,0 +1,15 @@ +# Created by: Alexander Sulfrian +# $FreeBSD$ + +PKGNAMESUFFIX= -client + +CONFLICTS= nsca-client-2.* nsca27-client-2.* +PLIST= ${.CURDIR}/pkg-plist + +DOCSDIR= ${PREFIX}/share/doc/${PORTNAME}${PKGNAMESUFFIX} +PORTEXAMPLES= README acknowledge debug_server disable_notifications \ + downtime enable_notifications invoke_check + +MASTERDIR= ${.CURDIR}/../nsca-ng + +.include "${MASTERDIR}/Makefile" diff --git a/net-mgmt/nsca-ng-client/pkg-plist b/net-mgmt/nsca-ng-client/pkg-plist new file mode 100644 index 0000000..fe3570e --- /dev/null +++ b/net-mgmt/nsca-ng-client/pkg-plist @@ -0,0 +1,5 @@ +@sample etc/send_nsca.cfg.sample +libexec/nagios/send_nsca +man/man5/send_nsca.cfg.5.gz +man/man8/send_nsca.8.gz +sbin/send_nsca diff --git a/net-mgmt/nsca-ng/Makefile b/net-mgmt/nsca-ng/Makefile new file mode 100644 index 0000000..5f97b22 --- /dev/null +++ b/net-mgmt/nsca-ng/Makefile @@ -0,0 +1,56 @@ +# Created by: Alexander Sulfrian +# $FreeBSD$ + +PORTNAME= nsca-ng +PORTVERSION= 1.2 +CATEGORIES= net-mgmt +MASTER_SITES= https://www.nsca-ng.org/download/ http://www.nsca-ng.org/download/ + +MAINTAINER= alexander@sulfrian.net +COMMENT= Nagios Service Check Acceptor + +LICENSE= BSD2CLAUSE +LICENSE_FILE= ${WRKSRC}/COPYING + +LIB_DEPENDS= libev.so:${PORTSDIR}/devel/libev + +.if !defined(PKGNAMESUFFIX) +LIB_DEPENDS+= libconfuse.so:${PORTSDIR}/devel/libconfuse +.endif + +CONFLICTS?= nsca-2.* nsca27-2.* + +GNU_CONFIGURE= yes +CONFIGURE_ARGS= --localstatedir=/var/spool/nagios +USE_OPENSSL= yes + +.if !defined(PKGNAMESUFFIX) +USE_RC_SUBR= nsca-ng +CONFIGURE_ARGS+= --enable-server +.endif + +PORTDOCS= NEWS COPYING README PROTOCOL TODO + +post-install: +.if defined(PKGNAMESUFFIX) + ${INSTALL_DATA} -d ${STAGEDIR}${PREFIX}/libexec/nagios/ + ${LN} -s ${PREFIX}/sbin/send_nsca ${STAGEDIR}${PREFIX}/libexec/nagios/send_nsca + + ${INSTALL_DATA} -d ${STAGEDIR}${EXAMPLESDIR} + cd ${WRKSRC}/contrib && ${INSTALL_DATA} ${PORTEXAMPLES} \ + ${STAGEDIR}${EXAMPLESDIR} + + cd ${STAGEDIR}${PREFIX}/etc && ${MV} send_nsca.cfg send_nsca.cfg.sample + # remove files not used here + cd ${STAGEDIR}${PREFIX} && ${RM} man/man8/nsca-ng.8 man/man5/nsca-ng.cfg.5 +.else + cd ${STAGEDIR}${PREFIX}/etc && ${MV} nsca-ng.cfg nsca-ng.cfg.sample + # remove files not used here + cd ${STAGEDIR}${PREFIX} && ${RM} etc/send_nsca.cfg man/man5/send_nsca.cfg.5 \ + man/man8/send_nsca.8 sbin/send_nsca +.endif + + @${MKDIR} ${STAGEDIR}${DOCSDIR} + cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR} + +.include diff --git a/net-mgmt/nsca-ng/distinfo b/net-mgmt/nsca-ng/distinfo new file mode 100644 index 0000000..8b2a0ab --- /dev/null +++ b/net-mgmt/nsca-ng/distinfo @@ -0,0 +1,2 @@ +SHA256 (nsca-ng-1.2.tar.gz) = fd0edf7a3c4da46aff5321bf005c68853dad5bae0b889e5e42336e85cb7a24e7 +SIZE (nsca-ng-1.2.tar.gz) = 327702 diff --git a/net-mgmt/nsca-ng/files/nsca-ng.in b/net-mgmt/nsca-ng/files/nsca-ng.in new file mode 100644 index 0000000..03d58c1 --- /dev/null +++ b/net-mgmt/nsca-ng/files/nsca-ng.in @@ -0,0 +1,36 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: nsca-ng +# REQUIRE: nagios icinga +# BEFORE: LOGIN +# KEYWORD: shutdown + +# Add the following lines to /etc/rc.conf to enable nsca-ng: +# nsca_ng_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable nsca-ng. +# nsca_ng_flags (str): Empty by default. +# nsca_ng_configfile (str): Set to "%%PREFIX%%/etc/nsca-ng.cfg" by default. +# + +. /etc/rc.subr + +name=nsca_ng +desc="Nagios Service Check Acceptor" +rcvar=nsca_ng_enable + +load_rc_config "${name}" + +command="%%PREFIX%%/sbin/nsca-ng" +pidfile="/var/run/${name}.pid" +extra_commands=reload + +nsca_ng_enable=${nsca_ng_enable:-"NO"} +nsca_ng_configfile=${nsca_ng_configfile:-"%%PREFIX%%/etc/nsca-ng.cfg"} + +required_files="${nsca_ng_configfile}" +command_args="-c ${nsca_ng_configfile} -P ${pidfile}" + +run_rc_command "$1" diff --git a/net-mgmt/nsca-ng/files/patch-src_server_nsca-ng.c b/net-mgmt/nsca-ng/files/patch-src_server_nsca-ng.c new file mode 100644 index 0000000..05ca65a --- /dev/null +++ b/net-mgmt/nsca-ng/files/patch-src_server_nsca-ng.c @@ -0,0 +1,16 @@ +--- src/server/nsca-ng.c.orig 2013-11-06 21:44:18 UTC ++++ src/server/nsca-ng.c +@@ -300,11 +300,9 @@ close_descriptors(void) + int min_fd = STDERR_FILENO + 1; + + #if HAVE_CLOSEFROM /* BSD and Solaris. */ +- if (closefrom(min_fd) == -1) +- die("Cannot close file descriptors >= %d: %m", min_fd); ++ (void)closefrom(min_fd); + #elif defined(F_CLOSEM) /* AIX and IRIX. */ +- if (fcntl(min_fd, F_CLOSEM, 0) == -1) +- die("Cannot close file descriptors >= %d: %m", min_fd); ++ (void)fcntl(min_fd, F_CLOSEM, 0); + #else + int max_fd = MIN(sysconf(_SC_OPEN_MAX), /* Arbitrary limit: */ 1048576); + int fd; diff --git a/net-mgmt/nsca-ng/pkg-descr b/net-mgmt/nsca-ng/pkg-descr new file mode 100644 index 0000000..686c98a --- /dev/null +++ b/net-mgmt/nsca-ng/pkg-descr @@ -0,0 +1,19 @@ +NSCA-ng provides a client-server pair which makes the Nagios command file +accessible to remote systems. This allows for submitting passive check +results, downtimes, and many other commands to Nagios or compatible +monitoring solutions. The submitted data is queued by the NSCA-ng +server if Nagios goes down. Multiple check results or commands can be +submitted in one go, and multiline plugin output is fully supported. +NSCA-ng uses TLS encryption and shared-secret authentication with +per-client passwords, as well as fine-grained authorization control. + +This package contains the NSCA-ng server, which is written in C and +uses an event-driven architecture. Disk I/O is avoided unless the data +cannot be submitted in one go due to its size (on Linux, the threshold +is 4kB). In this case, the data is handed over to Nagios via +asynchronously written files. + +NSCA clients cannot talk to NSCA-ng servers (nor vice versa), but NSCA +and NSCA-ng servers can happily run side by side. + +WWW: http://www.nsca-ng.org/ diff --git a/net-mgmt/nsca-ng/pkg-plist b/net-mgmt/nsca-ng/pkg-plist new file mode 100644 index 0000000..c5cf505 --- /dev/null +++ b/net-mgmt/nsca-ng/pkg-plist @@ -0,0 +1,4 @@ +@sample etc/nsca-ng.cfg.sample +man/man5/nsca-ng.cfg.5.gz +man/man8/nsca-ng.8.gz +sbin/nsca-ng -- cgit v1.1