aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/prometheus2
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2018-07-01 07:16:50 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2018-07-01 07:16:50 +0000
commit9334941dd17cc911dc42b3af52a0a00c0d4312c4 (patch)
treeb51b6e2fea977b0c56663c429ef2d478a6ea1d59 /net-mgmt/prometheus2
parent53cdbb8290fffab6ba0fcf88b42b2e80454247ff (diff)
downloadports-9334941dd17cc911dc42b3af52a0a00c0d4312c4.tar.gz
ports-9334941dd17cc911dc42b3af52a0a00c0d4312c4.zip
Notes
Diffstat (limited to 'net-mgmt/prometheus2')
-rw-r--r--net-mgmt/prometheus2/Makefile72
-rw-r--r--net-mgmt/prometheus2/distinfo6
-rw-r--r--net-mgmt/prometheus2/files/newsyslog.conf.in6
-rw-r--r--net-mgmt/prometheus2/files/prometheus.in56
-rw-r--r--net-mgmt/prometheus2/files/syslog.d.conf.in5
-rw-r--r--net-mgmt/prometheus2/pkg-plist14
6 files changed, 120 insertions, 39 deletions
diff --git a/net-mgmt/prometheus2/Makefile b/net-mgmt/prometheus2/Makefile
index 21e8d85b903b..bef754e5fa04 100644
--- a/net-mgmt/prometheus2/Makefile
+++ b/net-mgmt/prometheus2/Makefile
@@ -2,7 +2,7 @@
PORTNAME= prometheus
DISTVERSIONPREFIX= v
-DISTVERSION= 2.2.1
+DISTVERSION= 2.3.1
CATEGORIES= net-mgmt
MAINTAINER= dor.bsd@xm0.uk
@@ -16,22 +16,57 @@ GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT}
USE_GITHUB= yes
USE_RC_SUBR= prometheus
-USERS= prometheus
-GROUPS= prometheus
+OPTIONS_DEFINE= USE_SYSLOG
+OPTIONS_DEFAULT= USE_SYSLOG
+USE_SYSLOG_DESC= Install configuration files for syslog and newsyslog
+OPTIONS_SUB= yes
+
+PROMETHEUS_USER?= prometheus
+PROMETHEUS_GROUP?= prometheus
+
+USERS= ${PROMETHEUS_USER}
+GROUPS= ${PROMETHEUS_GROUP}
+
+PROMETHEUS_BINARIES= prometheus promtool
+PROMETHEUS_SHARE_DIR= ${DATADIR}
+PROMETHEUS_CONSOLES_DIR= ${PROMETHEUS_SHARE_DIR}/consoles
+PROMETHEUS_CONSOLE_LIBRARIES_DIR= ${PROMETHEUS_SHARE_DIR}/console_libraries
+PROMETHEUS_DB_DIR= /var/db/${PORTNAME}
+PROMETHEUS_LOG_DIR= /var/log/prometheus
+PROMETHEUS_LOG_FILE= ${PROMETHEUS_LOG_DIR}/prometheus.log
+
+SUB_FILES= prometheus \
+ newsyslog.conf \
+ syslog.d.conf
+
+SUB_LIST+= PROMETHEUS_USER=${PROMETHEUS_USER} \
+ PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
+ PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
+ PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
+ PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
+ PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR} \
+ PROMETHEUS_LOG_FILE=${PROMETHEUS_LOG_FILE} \
+ PROMETHEUS_SHARE_DIR=${PROMETHEUS_SHARE_DIR}
+
+PLIST_SUB+= PORTNAME=${PORTNAME} \
+ PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
+ PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
+ PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
+ PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR}
BUILD_USER?= ${USER}
LD_FLAG_X_PREFIX= -X ${GO_PKGNAME}/vendor/${GO_PKGNAME:H}/common/version
LD_FLAG_STRING= -s \
- ${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
- ${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
- ${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
- ${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER}
-PROMETHEUS_BINARIES= prometheus promtool
+ ${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
+ ${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
+ ${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
+ ${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER}
do-build:
.for bin in ${PROMETHEUS_BINARIES}
( cd ${GO_WRKSRC}/cmd/${bin} ; \
- ${SETENV} ${MAKE_ENV} ${GO_ENV} go install -ldflags "${LD_FLAG_STRING}" )
+ ${SETENV} ${MAKE_ENV} ${GO_ENV} \
+ ${GO_CMD} install -v -ldflags "${LD_FLAG_STRING}" )
.endfor
do-install:
@@ -41,7 +76,24 @@ do-install:
${INSTALL_DATA} \
${WRKSRC}/documentation/examples/prometheus.yml \
${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
+ @${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_DB_DIR}
+ @${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLES_DIR}
+ @${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR}
+ @${MKDIR} ${STAGEDIR}${PROMETHEUS_LOG_DIR}
+ ( cd ${WRKSRC}/console_libraries \
+ && ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
+ )
+ ( cd ${WRKSRC}/consoles \
+ && ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLES_DIR} \
+ )
- ${MKDIR} ${STAGEDIR}${DESTDIR}/var/db/prometheus
+post-install-USE_SYSLOG-on:
+ @${MKDIR} ${STAGEDIR}${ETCDIR}
+ ${INSTALL_DATA} \
+ ${WRKDIR}/syslog.d.conf \
+ ${STAGEDIR}${ETCDIR}/syslog.d.conf.sample
+ ${INSTALL_DATA} \
+ ${WRKDIR}/newsyslog.conf \
+ ${STAGEDIR}${ETCDIR}/newsyslog.conf.sample
.include <bsd.port.mk>
diff --git a/net-mgmt/prometheus2/distinfo b/net-mgmt/prometheus2/distinfo
index 6b93b44f6666..32257e441cb2 100644
--- a/net-mgmt/prometheus2/distinfo
+++ b/net-mgmt/prometheus2/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1523391674
-SHA256 (prometheus-prometheus-v2.2.1_GH0.tar.gz) = 4f75427449bb72d1886f6cd46f752fe6300242da48b8bb870dbbd7ffc879ed92
-SIZE (prometheus-prometheus-v2.2.1_GH0.tar.gz) = 5629500
+TIMESTAMP = 1529852060
+SHA256 (prometheus-prometheus-v2.3.1_GH0.tar.gz) = 3aab85d3cb59540b6b43f5a80b14d13937fc0d51e8e82a29f0efebf6addd5f75
+SIZE (prometheus-prometheus-v2.3.1_GH0.tar.gz) = 6175030
diff --git a/net-mgmt/prometheus2/files/newsyslog.conf.in b/net-mgmt/prometheus2/files/newsyslog.conf.in
new file mode 100644
index 000000000000..997171f5e8cd
--- /dev/null
+++ b/net-mgmt/prometheus2/files/newsyslog.conf.in
@@ -0,0 +1,6 @@
+# newsyslog(8) file for net-mgmt/prometheus2
+# See newsyslog.conf(5) for details.
+#
+# Log file will be rotated daily, and we'll keep 15 days of logs matching the
+# default Prometheus TSDB retention time.
+%%PROMETHEUS_LOG_FILE%% 640 15 * @T00 JC
diff --git a/net-mgmt/prometheus2/files/prometheus.in b/net-mgmt/prometheus2/files/prometheus.in
index 73814e4591e5..913d291b5037 100644
--- a/net-mgmt/prometheus2/files/prometheus.in
+++ b/net-mgmt/prometheus2/files/prometheus.in
@@ -7,18 +7,27 @@
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
-# prometheus_enable (bool): Set to NO by default
-# Set it to YES to enable prometheus
-# prometheus_user (string): Set user to run prometheus
-# Default is "prometheus"
-# prometheus_group (string): Set group to run prometheus
-# Default is "prometheus"
-# prometheus_data_dir (string): Set dir to run prometheus in
-# Default is "/var/db/prometheus"
-# prometheus_log_file (string): Set file that prometheus will log to
-# Default is "/var/log/prometheus.log"
-# prometheus_args (string): Set additional command line arguments
-# Default is ""
+# prometheus_enable (bool)
+# Set to NO by default
+# Set it to YES to enable prometheus
+# prometheus_user (string)
+# Set user to run prometheus
+# Default is "%%PROMETHEUS_USER%%"
+# prometheus_group (string)
+# Set group to run prometheus
+# Default is "%%PROMETHEUS_GROUP%%"
+# prometheus_data_dir (string)
+# Set dir to run prometheus in
+# Default is "%%PROMETHEUS_DB_DIR%%"
+# prometheus_consoles (string)
+# Set dir that contains Prometheus consoles
+# Default is "%%PROMETHEUS_CONSOLES_DIR%%"
+# prometheus_console_libraries (string)
+# Set dir containing Prometheus console libraries
+# Default is "%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"
+# prometheus_args (string)
+# Set additional command line arguments
+# Default is ""
. /etc/rc.subr
@@ -28,11 +37,12 @@ rcvar=prometheus_enable
load_rc_config $name
: ${prometheus_enable:="NO"}
-: ${prometheus_user:="prometheus"}
-: ${prometheus_group:="prometheus"}
+: ${prometheus_user:="%%PROMETHEUS_USER%%"}
+: ${prometheus_group:="%%PROMETHEUS_GROUP%%"}
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"}
-: ${prometheus_data_dir:="/var/db/prometheus"}
-: ${prometheus_log_file:="/var/log/prometheus.log"}
+: ${prometheus_data_dir:="%%PROMETHEUS_DB_DIR%%"}
+: ${prometheus_consoles_dir:="%%PROMETHEUS_CONSOLES_DIR%%"}
+: ${prometheus_console_libraries_dir:="%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"}
: ${prometheus_args:=""}
pidfile="/var/run/${name}.pid"
@@ -41,10 +51,13 @@ command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/${name}"
sig_reload="HUP"
extra_commands="reload"
-command_args="-p ${pidfile} /usr/bin/env ${procname} \
+command_args="-p ${pidfile} -m 3 -T ${name} \
+ /usr/bin/env ${procname} \
--config.file=${prometheus_config} \
--storage.tsdb.path=${prometheus_data_dir} \
- ${prometheus_args} >> ${prometheus_log_file} 2>&1"
+ --web.console.templates=${prometheus_consoles_dir} \
+ --web.console.libraries=${prometheus_console_libraries_dir} \
+ ${prometheus_args}"
start_precmd=prometheus_startprecmd
@@ -73,13 +86,6 @@ prometheus_startprecmd()
-g ${prometheus_group} \
/dev/null ${pidfile};
fi
- if [ ! -f "${prometheus_log_file}" ]; then
- install \
- -o ${prometheus_user} \
- -g ${prometheus_group} \
- -m 640 \
- /dev/null ${prometheus_log_file};
- fi
if [ ! -d ${prometheus_data_dir} ]; then
install \
-d \
diff --git a/net-mgmt/prometheus2/files/syslog.d.conf.in b/net-mgmt/prometheus2/files/syslog.d.conf.in
new file mode 100644
index 000000000000..36f10d3c31bc
--- /dev/null
+++ b/net-mgmt/prometheus2/files/syslog.d.conf.in
@@ -0,0 +1,5 @@
+# syslogd(8) configuration file for net-mgmt/prometheus2
+#
+# See syslog.conf(5) for details.
+!prometheus
+daemon.* %%PROMETHEUS_LOG_FILE%%
diff --git a/net-mgmt/prometheus2/pkg-plist b/net-mgmt/prometheus2/pkg-plist
index 39ce271e8e86..c0d818e58ad0 100644
--- a/net-mgmt/prometheus2/pkg-plist
+++ b/net-mgmt/prometheus2/pkg-plist
@@ -1,4 +1,16 @@
bin/prometheus
bin/promtool
+%%USE_SYSLOG%%@sample %%ETCDIR%%/newsyslog.conf.sample etc/newsyslog.conf.d/%%PORTNAME%%.conf
+%%USE_SYSLOG%%@sample %%ETCDIR%%/syslog.d.conf.sample /etc/syslog.d/%%PORTNAME%%.conf
+%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%/menu.lib
+%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%/prom.lib
+%%PROMETHEUS_CONSOLES_DIR%%/index.html.example
+%%PROMETHEUS_CONSOLES_DIR%%/node-cpu.html
+%%PROMETHEUS_CONSOLES_DIR%%/node-disk.html
+%%PROMETHEUS_CONSOLES_DIR%%/node-overview.html
+%%PROMETHEUS_CONSOLES_DIR%%/node.html
+%%PROMETHEUS_CONSOLES_DIR%%/prometheus-overview.html
+%%PROMETHEUS_CONSOLES_DIR%%/prometheus.html
@sample etc/prometheus.yml.sample
-@dir(prometheus,prometheus) /var/db/prometheus
+@dir(prometheus,prometheus) %%PROMETHEUS_DB_DIR%%
+@dir(root,root) %%PROMETHEUS_LOG_DIR%%