Date: Sun, 13 Apr 2014 02:10:02 +0000 (UTC) From: Steve Wills <swills@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r351172 - in head/sysutils: . mnrpes mnrpes/files Message-ID: <201404130210.s3D2A2gB069816@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: swills Date: Sun Apr 13 02:10:02 2014 New Revision: 351172 URL: http://svnweb.freebsd.org/changeset/ports/351172 QAT: https://qat.redports.org/buildarchive/r351172/ Log: Mnrpes is a system that uses MCollective and the Rufus scheduler to build a distributed async scheduler and checker for Nagios based on the Passive mode. WWW: https://github.com/nullDowntimeLtd/mnrpes PR: ports/188420 Submitted by: ports@robakdesign.com Added: head/sysutils/mnrpes/ head/sysutils/mnrpes/Makefile (contents, props changed) head/sysutils/mnrpes/distinfo (contents, props changed) head/sysutils/mnrpes/files/ head/sysutils/mnrpes/files/mnrpes_receiver.in (contents, props changed) head/sysutils/mnrpes/files/mnrpes_scheduler.in (contents, props changed) head/sysutils/mnrpes/pkg-descr (contents, props changed) head/sysutils/mnrpes/pkg-plist (contents, props changed) Modified: head/sysutils/Makefile Modified: head/sysutils/Makefile ============================================================================== --- head/sysutils/Makefile Sun Apr 13 01:52:21 2014 (r351171) +++ head/sysutils/Makefile Sun Apr 13 02:10:02 2014 (r351172) @@ -517,6 +517,7 @@ SUBDIR += mkfwimage SUBDIR += mkntpwd SUBDIR += mksunbootcd + SUBDIR += mnrpes SUBDIR += modules SUBDIR += monit SUBDIR += monitord Added: head/sysutils/mnrpes/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/mnrpes/Makefile Sun Apr 13 02:10:02 2014 (r351172) @@ -0,0 +1,52 @@ +# $FreeBSD$ + +PORTNAME= mnrpes +PORTVERSION= 2014033101 +CATEGORIES= sysutils + +MAINTAINER= ports@robakdesign.com +COMMENT= MCollective and Rufus scheduler wrapper + +LICENSE= APACHE20 + +RUN_DEPENDS= mcollective>=2:${PORTSDIR}/sysutils/mcollective \ + rubygem-rufus-scheduler>=0.1:${PORTSDIR}/devel/rubygem-rufus-scheduler + +USE_RUBY= yes +USE_GITHUB= yes +GH_ACCOUNT= nullDowntimeLtd +GH_TAGNAME= ${GH_COMMIT} +GH_COMMIT= 0b67031 + +USE_RC_SUBR= mnrpes_receiver \ + mnrpes_scheduler + +RESETPREFIX= ${PREFIX} + +PLIST_SUB+= PORTNAME=${PORTNAME} \ + RESETPREFIX=${RESETPREFIX} + +NO_BUILD= yes + +do-install: + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${MKDIR} ${STAGEDIR}${RUBY_SITELIBDIR}/${PORTNAME} + ${MKDIR} ${STAGEDIR}${RUBY_SITELIBDIR}/${PORTNAME}/output + ${INSTALL_SCRIPT} ${WRKSRC}/bin/mnrpes-receiver.rb ${STAGEDIR}${PREFIX}/bin/ + ${INSTALL_SCRIPT} ${WRKSRC}/bin/mnrpes-scheduler.rb ${STAGEDIR}${PREFIX}/bin/ + ${INSTALL_SCRIPT} ${WRKSRC}/lib/mnrpes.rb ${STAGEDIR}${RUBY_SITELIBDIR}/ + ${INSTALL_SCRIPT} ${WRKSRC}/lib/mnrpes/receiver.rb ${STAGEDIR}${RUBY_SITELIBDIR}/mnrpes/ + ${INSTALL_SCRIPT} ${WRKSRC}/lib/mnrpes/scheduler.rb ${STAGEDIR}${RUBY_SITELIBDIR}/mnrpes/ + ${INSTALL_SCRIPT} ${WRKSRC}/lib/mnrpes/output/flapjack.rb ${STAGEDIR}${RUBY_SITELIBDIR}/mnrpes/output/ + ${INSTALL_SCRIPT} ${WRKSRC}/lib/mnrpes/output/nagios.rb ${STAGEDIR}${RUBY_SITELIBDIR}/mnrpes/output/ + ${INSTALL_SCRIPT} ${WRKSRC}/lib/mnrpes/output/redis_status.rb ${STAGEDIR}${RUBY_SITELIBDIR}/mnrpes/output/ + ${INSTALL_SCRIPT} ${WRKSRC}/lib/mnrpes/output/stdout.rb ${STAGEDIR}${RUBY_SITELIBDIR}/mnrpes/output/ + ${INSTALL_DATA} ${WRKSRC}/etc/checks.txt.dist ${STAGEDIR}${ETCDIR} + ${INSTALL_DATA} ${WRKSRC}/etc/mnrpes-receiver.cfg.dist ${STAGEDIR}${ETCDIR} + ${INSTALL_DATA} ${WRKSRC}/etc/mnrpes-scheduler.cfg.dist ${STAGEDIR}${ETCDIR} + +post-install: + ${MKDIR} ${STAGEDIR}/var/run/${PORTNAME} + ${MKDIR} ${STAGEDIR}/var/log/${PORTNAME} + +.include <bsd.port.mk> Added: head/sysutils/mnrpes/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/mnrpes/distinfo Sun Apr 13 02:10:02 2014 (r351172) @@ -0,0 +1,2 @@ +SHA256 (mnrpes-2014033101.tar.gz) = 7b4b3c88ca739d8bc19f12f58df9c309242f7e80736613bed28cfbc21acce632 +SIZE (mnrpes-2014033101.tar.gz) = 82215 Added: head/sysutils/mnrpes/files/mnrpes_receiver.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/mnrpes/files/mnrpes_receiver.in Sun Apr 13 02:10:02 2014 (r351172) @@ -0,0 +1,114 @@ +#!/bin/sh + +# $FreeBSD$ +# +# mnrpes_receiver startup script +# +# PROVIDE: mnrpes_receiver +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following to /etc/rc.conf[.local] to enable this service +# +# mnrpes_receiver_enable="YES" +# +# You can fine tune others variables too: +# mnrpes_receiver_config= +# Use mnrpes_receiver_user to run mnrpes_receiver as user + +# mnrpes_receiver rc.d script supports multiple profiles (a-la rc.d/nginx) +# When profiles are specified, the non-profile specific parameters become defaults. +# +# Example: +# +# mnrpes_receiver_enable="YES" +# mnrpes_receiver_profiles="myserver myotherserver" +# mnrpes_receiver_config="/usr/local/etc/mnrpes/mnrpes-receiver.cfg" +# mnrpes_receiver_myserver_user="myuser" +# mnrpes_receiver_myotherserver_user="myotheruser" +# mnrpes_receiver_myotherserver_config="/usr/local/etc/mnrpes/mnrpes-receiver-myotherserver.cfg" + +. /etc/rc.subr + +name="mnrpes_receiver" +rcvar=mnrpes_receiver_enable + +mnrpes_receiver_setfib() { + if command -v check_namevarlist > /dev/null 2>&1; then + check_namevarlist fib && return 0 + fi + + ${SYSCTL} net.fibs >/dev/null 2>&1 || return 0 + + mnrpes_receiver_fib=${mnrpes_receiver_fib:-"NONE"} + case "$mnrpes_receiver_fib" in + [Nn][Oo][Nn][Ee]) + ;; + *) + command="setfib -F ${mnrpes_receiver_fib} ${command}" + ;; + esac +} + +mnrpes_receiver_precmd() { + user="$1" + piddir="$2" + logdir="$3" + mnrpes_receiver_setfib + install -d -o $user -g wheel -m 1750 "${piddir}" + install -d -o $user -g wheel -m 1750 "${logdir}" +} + +command_interpreter="ruby" + +piddir="/var/run/mnrpes/receiver" +pidname="receiver" +logdir="/var/log/mnrpes/receiver" + +load_rc_config $name + +# These are just the defaults, they might get overriden for a specific profile. +mnrpes_receiver_enable=${mnrpes_receiver_enable:-"NO"} +mnrpes_receiver_user=${mnrpes_receiver_user:-"nobody"} +mnrpes_receiver_config=${mnrpes_receiver_config:-"/usr/local/etc/mnrpes/mnrpes-receiver.cfg"} + +# This handles profile specific vars. +if [ -n "$2" ]; then + profile="$2" + if [ -n "${mnrpes_receiver_profiles}" ]; then + piddir="${piddir}.${profile}" + pidname="${pidname}.${profile}" + logdir="${logdir}.${profile}" + eval mnrpes_receiver_enable="\${mnrpes_receiver_${profile}_enable:-${mnrpes_receiver_enable}}" + eval mnrpes_receiver_fib="\${mnrpes_receiver_${profile}_fib:-${mnrpes_receiver_fib}}" + eval mnrpes_receiver_user="\${mnrpes_receiver_${profile}_user:-${mnrpes_receiver_user}}" + eval mnrpes_receiver_config="\${mnrpes_receiver_${profile}_config:-${mnrpes_receiver_config}}" + else + echo "$0: extra argument ignored" + fi +else + if [ -n "${mnrpes_receiver_profiles}" -a -n "$1" ]; then + for profile in ${mnrpes_receiver_profiles}; do + echo "===> mnrpes_receiver profile: ${profile}" + /usr/local/etc/rc.d/mnrpes_receiver $1 ${profile} + retcode="$?" + if [ "0${retcode}" -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + # It exits so that non-profile rc.d is not started when there are profiles. + exit 0 + fi +fi + +pidfile="${piddir}/${pidname}.pid" + +command="/usr/local/bin/mnrpes-receiver.rb" + +start_precmd="mnrpes_receiver_precmd ${mnrpes_receiver_user} ${piddir} ${logdir}" + +command_args="--pid ${pidfile} --config ${mnrpes_receiver_config}" + +run_rc_command "$1" Added: head/sysutils/mnrpes/files/mnrpes_scheduler.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/mnrpes/files/mnrpes_scheduler.in Sun Apr 13 02:10:02 2014 (r351172) @@ -0,0 +1,119 @@ +#!/bin/sh + +# $FreeBSD$ +# +# mnrpes_scheduler startup script +# +# PROVIDE: mnrpes_scheduler +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following to /etc/rc.conf[.local] to enable this service +# +# mnrpes_scheduler_enable="YES" +# +# You can fine tune others variables too: +# mnrpes_scheduler_config= +# mnrpes_scheduler_checks= +# Use mnrpes_scheduler_user to run mnrpes_scheduler as user + +# mnrpes_scheduler rc.d script supports multiple profiles (a-la rc.d/nginx) +# When profiles are specified, the non-profile specific parameters become defaults. +# +# Example: +# +# mnrpes_scheduler_enable="YES" +# mnrpes_scheduler_profiles="myserver myotherserver" +# mnrpes_scheduler_config="/usr/local/etc/mnrpes/mnrpes-scheduler.cfg" +# mnrpes_scheduler_checks="/usr/local/etc/mnrpes/checks.txt" +# mnrpes_scheduler_myserver_user="myuser" +# mnrpes_scheduler_myotherserver_user="myotheruser" +# mnrpes_scheduler_myotherserver_config="/usr/local/etc/mnrpes/mnrpes-scheduler-myotherserver.cfg" +# mnrpes_scheduler_myotherserver_checks="/usr/local/etc/mnrpes/checks-myotherserver.txt" + +. /etc/rc.subr + +name="mnrpes_scheduler" +rcvar=mnrpes_scheduler_enable + +mnrpes_scheduler_setfib() { + if command -v check_namevarlist > /dev/null 2>&1; then + check_namevarlist fib && return 0 + fi + + ${SYSCTL} net.fibs >/dev/null 2>&1 || return 0 + + mnrpes_scheduler_fib=${mnrpes_scheduler_fib:-"NONE"} + case "$mnrpes_scheduler_fib" in + [Nn][Oo][Nn][Ee]) + ;; + *) + command="setfib -F ${mnrpes_scheduler_fib} ${command}" + ;; + esac +} + +mnrpes_scheduler_precmd() { + user="$1" + piddir="$2" + logdir="$3" + mnrpes_scheduler_setfib + install -d -o $user -g wheel -m 1750 "${piddir}" + install -d -o $user -g wheel -m 1750 "${logdir}" +} + +command_interpreter="ruby" + +piddir="/var/run/mnrpes/scheduler" +pidname="scheduler" +logdir="/var/log/mnrpes/scheduler" + +load_rc_config $name + +# These are just the defaults, they might get overriden for a specific profile. +mnrpes_scheduler_enable=${mnrpes_scheduler_enable:-"NO"} +mnrpes_scheduler_user=${mnrpes_scheduler_user:-"nobody"} +mnrpes_scheduler_config=${mnrpes_scheduler_config:-"/usr/local/etc/mnrpes/mnrpes-scheduler.cfg"} +mnrpes_scheduler_checks=${mnrpes_scheduler_checks:-"/usr/local/etc/mnrpes/checks.txt"} + +# This handles profile specific vars. +if [ -n "$2" ]; then + profile="$2" + if [ -n "${mnrpes_scheduler_profiles}" ]; then + piddir="${piddir}.${profile}" + pidname="${pidname}.${profile}" + logdir="${logdir}.${profile}" + eval mnrpes_scheduler_enable="\${mnrpes_scheduler_${profile}_enable:-${mnrpes_scheduler_enable}}" + eval mnrpes_scheduler_fib="\${mnrpes_scheduler_${profile}_fib:-${mnrpes_scheduler_fib}}" + eval mnrpes_scheduler_user="\${mnrpes_scheduler_${profile}_user:-${mnrpes_scheduler_user}}" + eval mnrpes_scheduler_config="\${mnrpes_scheduler_${profile}_config:-${mnrpes_scheduler_config}}" + eval mnrpes_scheduler_checks="\${mnrpes_scheduler_${profile}_checks:-${mnrpes_scheduler_checks}}" + else + echo "$0: extra argument ignored" + fi +else + if [ -n "${mnrpes_scheduler_profiles}" -a -n "$1" ]; then + for profile in ${mnrpes_scheduler_profiles}; do + echo "===> mnrpes_scheduler profile: ${profile}" + /usr/local/etc/rc.d/mnrpes_scheduler $1 ${profile} + retcode="$?" + if [ "0${retcode}" -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + # It exits so that non-profile rc.d is not started when there are profiles. + exit 0 + fi +fi + +pidfile="${piddir}/${pidname}.pid" + +command="/usr/local/bin/mnrpes-scheduler.rb" + +start_precmd="mnrpes_scheduler_precmd ${mnrpes_scheduler_user} ${piddir} ${logdir}" + +command_args="--pid ${pidfile} --config ${mnrpes_scheduler_config} --checks ${mnrpes_scheduler_checks}" + +run_rc_command "$1" Added: head/sysutils/mnrpes/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/mnrpes/pkg-descr Sun Apr 13 02:10:02 2014 (r351172) @@ -0,0 +1,5 @@ +Mnrpes is a system that uses MCollective and the Rufus scheduler +to build a distributed async scheduler and checker for Nagios +based on the Passive mode. + +WWW: https://github.com/nullDowntimeLtd/mnrpes Added: head/sysutils/mnrpes/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/mnrpes/pkg-plist Sun Apr 13 02:10:02 2014 (r351172) @@ -0,0 +1,19 @@ +bin/mnrpes-receiver.rb +bin/mnrpes-scheduler.rb +%%ETCDIR%%/checks.txt.dist +%%ETCDIR%%/mnrpes-receiver.cfg.dist +%%ETCDIR%%/mnrpes-scheduler.cfg.dist +%%RUBY_SITELIBDIR%%/mnrpes.rb +%%RUBY_SITELIBDIR%%/%%PORTNAME%%/receiver.rb +%%RUBY_SITELIBDIR%%/%%PORTNAME%%/scheduler.rb +%%RUBY_SITELIBDIR%%/%%PORTNAME%%/output/flapjack.rb +%%RUBY_SITELIBDIR%%/%%PORTNAME%%/output/nagios.rb +%%RUBY_SITELIBDIR%%/%%PORTNAME%%/output/redis_status.rb +%%RUBY_SITELIBDIR%%/%%PORTNAME%%/output/stdout.rb +@dirrmtry %%ETCDIR%% +@dirrm %%RUBY_SITELIBDIR%%/%%PORTNAME%%/output +@dirrm %%RUBY_SITELIBDIR%%/%%PORTNAME%% +@cwd / +@dirrmtry var/run/%%PORTNAME%% +@dirrmtry var/log/%%PORTNAME%% +@cwd %%RESETPREFIX%%
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404130210.s3D2A2gB069816>