From 1bb8f03c78b55377b34d8a44290576cd27c86c8d Mon Sep 17 00:00:00 2001 From: Craig Leres Date: Wed, 25 Sep 2019 20:03:48 +0000 Subject: [PATCH] net-mgmt/telegraf: Add a rc.conf option for the --config-directory option While we're here: - Sort ONLY_FOR_ARCHS as per portlint - Match "telegraf -h" usage message (-quiet, -config -> --quiet, --config) PR: 239291 Approved by: girgen (maintainer timeout, 9 weeks), matthew (mentor, implicit) --- net-mgmt/telegraf/Makefile | 3 ++- net-mgmt/telegraf/files/telegraf.in | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/net-mgmt/telegraf/Makefile b/net-mgmt/telegraf/Makefile index 071482e9ceb0..2a1207e9c6d4 100644 --- a/net-mgmt/telegraf/Makefile +++ b/net-mgmt/telegraf/Makefile @@ -3,6 +3,7 @@ PORTNAME= telegraf DISTVERSION= 1.12.1 +PORTREVISION= 1 CATEGORIES= net-mgmt MAINTAINER= girgen@FreeBSD.org @@ -10,7 +11,7 @@ COMMENT= Time-series data collection LICENSE= MIT -ONLY_FOR_ARCHS= amd64 i386 armv6 armv7 +ONLY_FOR_ARCHS= amd64 armv6 armv7 i386 USES= go diff --git a/net-mgmt/telegraf/files/telegraf.in b/net-mgmt/telegraf/files/telegraf.in index 8252f6054bbe..e136c62c91d1 100644 --- a/net-mgmt/telegraf/files/telegraf.in +++ b/net-mgmt/telegraf/files/telegraf.in @@ -13,12 +13,14 @@ # Default: NO # telegraf_conf (str): telegraf configuration file # Default: ${PREFIX}/etc/telegraf.conf +# telegraf_confdir (str): telegraf configuration directory +# Default: none # telegraf_user (str): telegraf daemon user # Default: %%TELEGRAF_USER%% # telegraf_group (str): telegraf daemon group # Default: %%TELEGRAF_GROUP%% # telegraf_flags (str): Extra flags passed to telegraf -# Default: -quiet +# Default: --quiet . /etc/rc.subr @@ -31,9 +33,14 @@ load_rc_config $name : ${telegraf_enable:="NO"} : ${telegraf_user:="%%TELEGRAF_USER%%"} : ${telegraf_group:="%%TELEGRAF_GROUP%%"} -: ${telegraf_flags:="-quiet"} +: ${telegraf_flags:="--quiet"} : ${telegraf_conf:="%%PREFIX%%/etc/${name}.conf"} -: ${telegraf_options:="${telegraf_flags} -config=${telegraf_conf}"} +: ${telegraph_confdir:=""} +: ${telegraf_options:="${telegraf_flags} --config=${telegraf_conf}"} + +if [ -n "${telegraf_confdir}" ]; then + telegraf_options="${telegraf_options} --config-directory=${telegraf_confdir}" +fi logfile="%%TELEGRAF_LOGDIR%%/${name}.log" pidfile="/var/run/${name}.pid"