Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jul 2020 15:56:40 +0000 (UTC)
From:      Ryan Steinmetz <zi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r541759 - in head/net-mgmt/blackbox_exporter: . files
Message-ID:  <202007091556.069FueVP055824@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zi
Date: Thu Jul  9 15:56:39 2020
New Revision: 541759
URL: https://svnweb.freebsd.org/changeset/ports/541759

Log:
  - Switch to a solution that supports log rotation
  - Update pkg-message with details/examples
  - Fix missing name in daemon(1) process
  - Set daemon(1) log process name
  - Bump PORTREVISION
  
  PR:             245601
  Submitted by:   zi@
  Approved by:    bsam@ (maintainer timeout, 2+ months)

Added:
  head/net-mgmt/blackbox_exporter/files/blackbox_exporter.newsyslog   (contents, props changed)
  head/net-mgmt/blackbox_exporter/files/blackbox_exporter.syslog   (contents, props changed)
  head/net-mgmt/blackbox_exporter/pkg-plist   (contents, props changed)
Modified:
  head/net-mgmt/blackbox_exporter/Makefile
  head/net-mgmt/blackbox_exporter/files/blackbox_exporter.in   (contents, props changed)
  head/net-mgmt/blackbox_exporter/files/pkg-message.in

Modified: head/net-mgmt/blackbox_exporter/Makefile
==============================================================================
--- head/net-mgmt/blackbox_exporter/Makefile	Thu Jul  9 15:53:42 2020	(r541758)
+++ head/net-mgmt/blackbox_exporter/Makefile	Thu Jul  9 15:56:39 2020	(r541759)
@@ -3,6 +3,7 @@
 
 PORTNAME=	blackbox_exporter
 PORTVERSION=	0.17.0
+PORTREVISION=	1
 DISTVERSIONPREFIX=v
 CATEGORIES=	net-mgmt
 
@@ -28,9 +29,6 @@ OPTIONS_DEFINE=	EXAMPLES
 
 SUB_FILES=	pkg-message
 SUB_LIST=	GH_TAGNAME=${GH_TAGNAME}
-PLIST_FILES=	bin/blackbox_exporter \
-		${EXAMPLESDIR}/blackbox.yml \
-		${EXAMPLESDIR}/example.yml
 
 post-extract:
 	${RM} -r ${WRKSRC}/vendor/golang.org/x/net
@@ -39,5 +37,11 @@ post-extract:
 post-install:
 	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
 	${INSTALL_DATA} ${WRKSRC}/*.yml ${STAGEDIR}${EXAMPLESDIR}
+	${MKDIR} ${STAGEDIR}${DATADIR}/syslog.d \
+		${STAGEDIR}${DATADIR}/newsyslog.conf.d
+	${INSTALL_DATA} ${PATCHDIR}/blackbox_exporter.syslog \
+		${STAGEDIR}${DATADIR}/syslog.d/blackbox_exporter.conf
+	${INSTALL_DATA} ${PATCHDIR}/blackbox_exporter.newsyslog \
+		${STAGEDIR}${DATADIR}/newsyslog.conf.d/blackbox_exporter.conf
 
 .include <bsd.port.mk>

Modified: head/net-mgmt/blackbox_exporter/files/blackbox_exporter.in
==============================================================================
--- head/net-mgmt/blackbox_exporter/files/blackbox_exporter.in	Thu Jul  9 15:53:42 2020	(r541758)
+++ head/net-mgmt/blackbox_exporter/files/blackbox_exporter.in	Thu Jul  9 15:56:39 2020	(r541759)
@@ -21,8 +21,6 @@
 #               Default is "localhost:9115".
 # blackbox_exporter_config (string):        Set configuration file of blackbox_exporter
 #               Default is "%%PREFIX%%/etc/blackbox_exporter.yml".
-# blackbox_exporter_log_file (string):      Set log file of blackbox_exporter
-#               Default is "/var/log/blackbox_exporter.log".
 
 . /etc/rc.subr
 
@@ -37,15 +35,15 @@ load_rc_config $name
 : ${blackbox_exporter_group:=prometheus}
 : ${blackbox_exporter_listen_address=localhost:9115}
 : ${blackbox_exporter_config="%%PREFIX%%/etc/blackbox_exporter.yml"}
-: ${blackbox_exporter_log_file=/var/log/blackbox_exporter.log}
 
 pidfile=/var/run/blackbox_exporter.pid
 command=/usr/sbin/daemon
 procname="%%PREFIX%%/bin/blackbox_exporter"
-command_args="-p ${pidfile} /usr/bin/env ${procname} \
+command_args="-p ${pidfile} -t ${name} -T ${name} -S \
+    /usr/bin/env ${procname} \
     --web.listen-address=${blackbox_exporter_listen_address} \
     --config.file=${blackbox_exporter_config} \
-    ${blackbox_exporter_args} >> ${blackbox_exporter_log_file} 2>&1"
+    ${blackbox_exporter_args} 2>&1"
 
 start_precmd=blackbox_exporter_startprecmd
 
@@ -58,15 +56,6 @@ blackbox_exporter_startprecmd()
             /dev/null ${pidfile};
     else
         chown ${blackbox_exporter_user}:${blackbox_exporter_group} ${pidfile};
-    fi
-    if [ ! -e ${blackbox_exporter_log_file} ]; then
-        install \
-            -o ${blackbox_exporter_user} \
-            -g ${blackbox_exporter_group} \
-            -m 640 \
-            /dev/null ${blackbox_exporter_log_file};
-    else
-        chown ${blackbox_exporter_user}:${blackbox_exporter_group} ${blackbox_exporter_log_file};
     fi
 }
 

Added: head/net-mgmt/blackbox_exporter/files/blackbox_exporter.newsyslog
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/blackbox_exporter/files/blackbox_exporter.newsyslog	Thu Jul  9 15:56:39 2020	(r541759)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+/var/log/blackbox_exporter.log		644  7	1000	*	J

Added: head/net-mgmt/blackbox_exporter/files/blackbox_exporter.syslog
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/blackbox_exporter/files/blackbox_exporter.syslog	Thu Jul  9 15:56:39 2020	(r541759)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+!blackbox_exporter
+*.*						/var/log/blackbox_exporter.log

Modified: head/net-mgmt/blackbox_exporter/files/pkg-message.in
==============================================================================
--- head/net-mgmt/blackbox_exporter/files/pkg-message.in	Thu Jul  9 15:53:42 2020	(r541758)
+++ head/net-mgmt/blackbox_exporter/files/pkg-message.in	Thu Jul  9 15:56:39 2020	(r541759)
@@ -16,6 +16,10 @@ blackbox_exporter_listen_address rcvar.
 To use the 'ping' module, blackbox_exporter needs to run with
 root privileges. To run blackbox_exporter with root privileges,
 run "sysrc blackbox_exporter_user=root".
+
+By default, blackbox exporter will log via syslog.  Examples for
+controlling which log file and setting up log rotation may be found in:
+%%DATADIR%%
 EOM
 }
 ]

Added: head/net-mgmt/blackbox_exporter/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/blackbox_exporter/pkg-plist	Thu Jul  9 15:56:39 2020	(r541759)
@@ -0,0 +1,5 @@
+bin/blackbox_exporter
+%%DATADIR%%/newsyslog.conf.d/blackbox_exporter.conf
+%%DATADIR%%/syslog.d/blackbox_exporter.conf
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/blackbox.yml
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/example.yml



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007091556.069FueVP055824>