From ed31947b52392bc8c9d29c972eafc8ece06f12eb Mon Sep 17 00:00:00 2001 From: Mathieu Arnold Date: Tue, 19 Jul 2016 13:29:03 +0000 Subject: [PATCH] Install munin-async and munin-asyncd with munin-node. PR: 211159 Reported by: axel axel re Sponsored by: Absolight --- sysutils/munin-common/files/patch-Makefile | 12 ++++++- sysutils/munin-common/munin.mk | 1 + sysutils/munin-node/Makefile | 12 +++---- sysutils/munin-node/files/munin-asyncd.in | 40 ++++++++++++++++++++++ sysutils/munin-node/pkg-plist | 4 +++ 5 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 sysutils/munin-node/files/munin-asyncd.in diff --git a/sysutils/munin-common/files/patch-Makefile b/sysutils/munin-common/files/patch-Makefile index 12af94e59f0b..7a9536c8c7a8 100644 --- a/sysutils/munin-common/files/patch-Makefile +++ b/sysutils/munin-common/files/patch-Makefile @@ -134,7 +134,17 @@ fi \ done -@@ -183,7 +166,7 @@ install-async: +@@ -176,14 +159,14 @@ install-plugins-java: build-plugins-java + install-async-prime: install-async + + install-async: +- mkdir -p $(LIBDIR) +- $(INSTALL) -m 0755 build/node/_bin/munin-async $(LIBDIR)/ +- $(INSTALL) -m 0755 build/node/_bin/munin-asyncd $(LIBDIR)/ ++ mkdir -p $(DESTDIR)$(LIBDIR) ++ $(INSTALL) -m 0755 build/node/_bin/munin-async $(DESTDIR)$(LIBDIR)/ ++ $(INSTALL) -m 0755 build/node/_bin/munin-asyncd $(DESTDIR)$(LIBDIR)/ + install-node-prime: install-node-pre install-node install-node-pre: build/node/munin-node.conf install-pre diff --git a/sysutils/munin-common/munin.mk b/sysutils/munin-common/munin.mk index dc1dc1ea178c..91eb1da6563b 100644 --- a/sysutils/munin-common/munin.mk +++ b/sysutils/munin-common/munin.mk @@ -29,6 +29,7 @@ MAKE_ARGS= ${MUNIN_DIRS} \ USERS= munin GROUPS= munin PLIST_SUB= ${MUNIN_DIRS} USER=${USERS} GROUP=${GROUPS} +SUB_LIST= ${MUNIN_DIRS} USER=${USERS} GROUP=${GROUPS} CPE_VENDOR= munin-monitoring diff --git a/sysutils/munin-node/Makefile b/sysutils/munin-node/Makefile index 38cc4594f163..75cb99d4eb96 100644 --- a/sysutils/munin-node/Makefile +++ b/sysutils/munin-node/Makefile @@ -3,7 +3,7 @@ PORTNAME= munin PORTVERSION= ${MUNIN_VERSION} -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= sysutils perl5 MASTER_SITES= ${MUNIN_SITES} PKGNAMESUFFIX= -node @@ -32,8 +32,8 @@ SHEBANG_FILES= node/sbin/munin-node node/sbin/munin-sched \ .include "${.CURDIR}/../munin-common/munin.mk" -ALL_TARGET= build-node build-plugins -INSTALL_TARGET= install-node-prime install-plugins-prime +ALL_TARGET= build-node build-plugins build/node/_bin/munin-async build/node/_bin/munin-asyncd +INSTALL_TARGET= install-node-prime install-async-prime install-plugins-prime NO_ARCH= yes OPTIONS_DEFINE= SNMP PERL JAVA @@ -55,7 +55,7 @@ JAVA_BUILD= yes JAVA_RUN= yes SUB_FILES= pkg-message plugins.conf -USE_RC_SUBR= munin-node munin-sched +USE_RC_SUBR= munin-asyncd munin-node munin-sched post-patch: @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \ @@ -72,9 +72,7 @@ post-patch: @${FIND} ${WRKSRC}/node/sbin -type f -name "*.orig" -delete post-install: - ${MKDIR} ${STAGEDIR}${DBDIR}/plugin-state - ${INSTALL_SCRIPT} ${WRKDIR}/munin-node \ - ${STAGEDIR}${PREFIX}/etc/rc.d/munin-node + ${MKDIR} ${STAGEDIR}${DBDIR}/plugin-state ${STAGEDIR}${SPOOLDIR}/async ${INSTALL_DATA} ${WRKSRC}/build/node/munin-node.conf \ ${STAGEDIR}${ETCDIR}/munin-node.conf.sample ${INSTALL_DATA} ${WRKDIR}/plugins.conf \ diff --git a/sysutils/munin-node/files/munin-asyncd.in b/sysutils/munin-node/files/munin-asyncd.in new file mode 100644 index 000000000000..f21878cee67e --- /dev/null +++ b/sysutils/munin-node/files/munin-asyncd.in @@ -0,0 +1,40 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: munin-asyncd +# REQUIRE: DAEMON munin-node +# BEFORE: cron +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable munin-asyncd: +# munin_asyncd_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable munin-asyncd +# munin_asyncd_spool: The spool directory, default: +# %%DBDIR%%/async +# munin_asyncd_host: Host to connect to, default: localhost:4949 +# munin_asyncd_args: Extra args to pass to munin-asyncd +# + +. /etc/rc.subr + +name=munin_asyncd +rcvar=munin_asyncd_enable + +load_rc_config $name + +: ${munin_asyncd_enable:=NO} +: ${munin_asyncd_spool:=%%SPOOLDIR%%/async} +: ${munin_asyncd_host:=localhost:4949} + +command="%%DATADIR%%/munin-asyncd" +command_interpreter="%%PREFIX%%/bin/perl" +pidfile="/var/run/${name}.pid" + +start_cmd() +{ + check_startmsgs && echo "Starting ${name}." + daemon -u %%USER%% -f -p ${pidfile} ${command_interpreter} ${command} --spool ${munin_asyncd_spool} --host ${munin_asyncd_host} ${munin_asyncd_args} +} + +run_rc_command $1 diff --git a/sysutils/munin-node/pkg-plist b/sysutils/munin-node/pkg-plist index 838f50c2b0a0..6f755c8ce0c3 100644 --- a/sysutils/munin-node/pkg-plist +++ b/sysutils/munin-node/pkg-plist @@ -50,6 +50,8 @@ sbin/munin-node sbin/munin-node-configure sbin/munin-run sbin/munin-sched +%%DATADIR%%/munin-async +%%DATADIR%%/munin-asyncd %%JAVA%%%%DATADIR%%/munin-jmx-plugins.jar %%DATADIR%%/plugins/amavis %%DATADIR%%/plugins/apache_accesses @@ -251,4 +253,6 @@ sbin/munin-sched %%DATADIR%%/plugins/zimbra_ @dir(%%USER%%,%%GROUP%%,) %%DBDIRNODE%%/plugin-state @dir %%ETCDIR%%/plugins +@dir(%%USER%%,%%GROUP%%,) %%SPOOLDIR%%/async +@comment @dir %%SPOOLDIR%% @comment @dir %%DBDIRNODE%%