aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/mnrpes
diff options
context:
space:
mode:
authorswills <swills@FreeBSD.org>2014-04-13 10:10:02 +0800
committerswills <swills@FreeBSD.org>2014-04-13 10:10:02 +0800
commitdd0b2ae0a12abd4e76e7e37f21f809923b4bf374 (patch)
tree42863add1d6065d1932bd99ab77f24bcfa0755ca /sysutils/mnrpes
parentd343d6a239d3662e12c961e6f3359e0e715d755b (diff)
downloadfreebsd-ports-gnome-dd0b2ae0a12abd4e76e7e37f21f809923b4bf374.tar.gz
freebsd-ports-gnome-dd0b2ae0a12abd4e76e7e37f21f809923b4bf374.tar.zst
freebsd-ports-gnome-dd0b2ae0a12abd4e76e7e37f21f809923b4bf374.zip
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
Diffstat (limited to 'sysutils/mnrpes')
-rw-r--r--sysutils/mnrpes/Makefile52
-rw-r--r--sysutils/mnrpes/distinfo2
-rw-r--r--sysutils/mnrpes/files/mnrpes_receiver.in114
-rw-r--r--sysutils/mnrpes/files/mnrpes_scheduler.in119
-rw-r--r--sysutils/mnrpes/pkg-descr5
-rw-r--r--sysutils/mnrpes/pkg-plist19
6 files changed, 311 insertions, 0 deletions
diff --git a/sysutils/mnrpes/Makefile b/sysutils/mnrpes/Makefile
new file mode 100644
index 000000000000..c7bcc08f61e0
--- /dev/null
+++ b/sysutils/mnrpes/Makefile
@@ -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>
diff --git a/sysutils/mnrpes/distinfo b/sysutils/mnrpes/distinfo
new file mode 100644
index 000000000000..1b00f421a79d
--- /dev/null
+++ b/sysutils/mnrpes/distinfo
@@ -0,0 +1,2 @@
+SHA256 (mnrpes-2014033101.tar.gz) = 7b4b3c88ca739d8bc19f12f58df9c309242f7e80736613bed28cfbc21acce632
+SIZE (mnrpes-2014033101.tar.gz) = 82215
diff --git a/sysutils/mnrpes/files/mnrpes_receiver.in b/sysutils/mnrpes/files/mnrpes_receiver.in
new file mode 100644
index 000000000000..68a0b9d2d2f0
--- /dev/null
+++ b/sysutils/mnrpes/files/mnrpes_receiver.in
@@ -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"
diff --git a/sysutils/mnrpes/files/mnrpes_scheduler.in b/sysutils/mnrpes/files/mnrpes_scheduler.in
new file mode 100644
index 000000000000..38ebcf2e3144
--- /dev/null
+++ b/sysutils/mnrpes/files/mnrpes_scheduler.in
@@ -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"
diff --git a/sysutils/mnrpes/pkg-descr b/sysutils/mnrpes/pkg-descr
new file mode 100644
index 000000000000..931c93a97f52
--- /dev/null
+++ b/sysutils/mnrpes/pkg-descr
@@ -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
diff --git a/sysutils/mnrpes/pkg-plist b/sysutils/mnrpes/pkg-plist
new file mode 100644
index 000000000000..7e1b362f2add
--- /dev/null
+++ b/sysutils/mnrpes/pkg-plist
@@ -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%%