svn commit: r461844 - in head: . net-mgmt net-mgmt/prometheus net-mgmt/prometheus1 net-mgmt/prometheus2 net-mgmt/prometheus2/files

Brad Davis brd at FreeBSD.org
Wed Feb 14 21:58:39 UTC 2018


Author: brd
Date: Wed Feb 14 21:58:37 2018
New Revision: 461844
URL: https://svnweb.freebsd.org/changeset/ports/461844

Log:
  Add net-mgmt/prometheus2
  
  Rename prometheus to prometheus1 so they can coexist since upgrading is
  non-trival:
  
  https://prometheus.io/docs/prometheus/2.0/migration/
  
  PR:		225169
  Submitted by:	David O'Rourke <dor.bsd at xm0.uk>
  Reviewed by:	swills

Added:
  head/net-mgmt/prometheus1/
     - copied from r461843, head/net-mgmt/prometheus/
  head/net-mgmt/prometheus2/
  head/net-mgmt/prometheus2/Makefile   (contents, props changed)
  head/net-mgmt/prometheus2/distinfo   (contents, props changed)
  head/net-mgmt/prometheus2/files/
  head/net-mgmt/prometheus2/files/prometheus.in   (contents, props changed)
  head/net-mgmt/prometheus2/pkg-descr   (contents, props changed)
  head/net-mgmt/prometheus2/pkg-message   (contents, props changed)
  head/net-mgmt/prometheus2/pkg-plist   (contents, props changed)
Deleted:
  head/net-mgmt/prometheus/
Modified:
  head/MOVED
  head/net-mgmt/Makefile
  head/net-mgmt/prometheus1/Makefile

Modified: head/MOVED
==============================================================================
--- head/MOVED	Wed Feb 14 21:43:30 2018	(r461843)
+++ head/MOVED	Wed Feb 14 21:58:37 2018	(r461844)
@@ -9961,3 +9961,4 @@ databases/postgresql-repmgr2||2018-02-10|Removed, only
 www/mod_security-devel|www/mod_security3|2018-02-12|Renamed, upstream has made a release
 devel/pear-channel-htmlpurifier|devel/pear-channel-htmlpurifier.org|2018-02-13|Rename for consistency
 games/lolcat|games/rubygem-lolcat|2018-02-13|Rename to match our rubygems naming
+net-mgmt/prometheus|net-mgmt/prometheus1|2018-02-14|Rename to include major version number in the portname

Modified: head/net-mgmt/Makefile
==============================================================================
--- head/net-mgmt/Makefile	Wed Feb 14 21:43:30 2018	(r461843)
+++ head/net-mgmt/Makefile	Wed Feb 14 21:58:37 2018	(r461844)
@@ -294,7 +294,8 @@
     SUBDIR += pnp-icinga
     SUBDIR += pnp-icinga2
     SUBDIR += portmon
-    SUBDIR += prometheus
+    SUBDIR += prometheus1
+    SUBDIR += prometheus2
     SUBDIR += prometheus-collectd-exporter
     SUBDIR += pushgateway
     SUBDIR += py-adal

Modified: head/net-mgmt/prometheus1/Makefile
==============================================================================
--- head/net-mgmt/prometheus/Makefile	Wed Feb 14 21:43:30 2018	(r461843)
+++ head/net-mgmt/prometheus1/Makefile	Wed Feb 14 21:58:37 2018	(r461844)
@@ -3,9 +3,10 @@
 
 PORTNAME=	prometheus
 PORTVERSION=	1.8.2
-PORTREVISION=	1
 DISTVERSIONPREFIX=	v
+PORTREVISION=	1
 CATEGORIES=	net-mgmt
+PKGNAMESUFFIX=	1
 
 MAINTAINER=	ports at ecadlabs.com
 COMMENT=	Systems monitoring and alerting toolkit

Added: head/net-mgmt/prometheus2/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/prometheus2/Makefile	Wed Feb 14 21:58:37 2018	(r461844)
@@ -0,0 +1,53 @@
+# $FreeBSD$
+
+PORTNAME=	prometheus
+PORTVERSION=	2.1.0
+DISTVERSIONPREFIX=	v
+CATEGORIES=	net-mgmt
+
+MAINTAINER=	dor.bsd at xm0.uk
+COMMENT=	Systems monitoring and alerting toolkit
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		go gmake
+USE_GITHUB=	yes
+GH_ACCOUNT=	prometheus
+GH_PROJECT=	prometheus
+
+GO_PKGNAME=	github.com/${GH_ACCOUNT}/${GH_PROJECT}
+
+USE_RC_SUBR=	prometheus
+
+USERS=		prometheus
+GROUPS=		prometheus
+
+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
+
+do-build:
+.for bin in ${PROMETHEUS_BINARIES}
+	( cd ${GO_WRKSRC}/cmd/${bin} ; \
+		${SETENV} ${GO_ENV} go install -ldflags "${LD_FLAG_STRING}" )
+.endfor
+
+do-install:
+.for bin in ${PROMETHEUS_BINARIES}
+	${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${bin} ${STAGEDIR}${PREFIX}/bin
+.endfor
+
+	${INSTALL_DATA} \
+		${WRKSRC}/documentation/examples/prometheus.yml \
+		${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
+
+	${MKDIR} ${STAGEDIR}${DESTDIR}/var/db/prometheus
+
+.include <bsd.port.mk>

Added: head/net-mgmt/prometheus2/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/prometheus2/distinfo	Wed Feb 14 21:58:37 2018	(r461844)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1516749966
+SHA256 (prometheus-prometheus-v2.1.0_GH0.tar.gz) = c6fc92d695c9af30574eb41af5e0e89f4fde9a04a3169ba58aa2b2f80d5862a4
+SIZE (prometheus-prometheus-v2.1.0_GH0.tar.gz) = 5669858

Added: head/net-mgmt/prometheus2/files/prometheus.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/prometheus2/files/prometheus.in	Wed Feb 14 21:58:37 2018	(r461844)
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+# PROVIDE: prometheus
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# 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 ""
+
+. /etc/rc.subr
+
+name=prometheus
+rcvar=prometheus_enable
+
+load_rc_config $name
+
+: ${prometheus_enable:="NO"}
+: ${prometheus_user:="prometheus"}
+: ${prometheus_group:="prometheus"}
+: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"}
+: ${prometheus_data_dir:="/var/db/prometheus"}
+: ${prometheus_log_file:="/var/log/prometheus.log"}
+: ${prometheus_args:=""}
+
+pidfile="/var/run/${name}.pid"
+required_files="${prometheus_config}"
+command="/usr/sbin/daemon"
+procname="%%PREFIX%%/bin/${name}"
+sig_reload="HUP"
+extra_commands="reload"
+command_args="-p ${pidfile} /usr/bin/env ${procname} \
+                --config.file=${prometheus_config} \
+                --storage.tsdb.path=${prometheus_data_dir} \
+                ${prometheus_args} >> ${prometheus_log_file} 2>&1"
+
+start_precmd=prometheus_startprecmd
+
+# This checks for the existence of a prometheus 1.x data dir at the
+# $prometheus_data_dir location. If one is found, Prometheus will not start.
+prometheus_check_data_dir_version()
+{
+    local data_dir_version_file="${prometheus_data_dir}/VERSION"
+
+    if [ -f "${data_dir_version_file}" ]; then
+        local data_dir_version="0"
+
+        read data_dir_version < "${data_dir_version_file}"
+
+        if [ "${data_dir_version}" = "1" ]; then
+            return 1
+        fi
+    fi
+}
+
+prometheus_startprecmd()
+{
+    if [ ! -e ${pidfile} ]; then
+        install \
+            -o ${prometheus_user} \
+            -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 \
+            -o ${prometheus_user} \
+            -g ${prometheus_group} \
+            -m 750 \
+            ${prometheus_data_dir}
+    else
+        # The directory already existed. Ensure it's not a prometheus 1.x
+        # data dir.
+        if ! prometheus_check_data_dir_version; then
+            err 1 "Found net-mgmt/prometheus1 data dir, refusing to start."
+        fi
+    fi
+}
+
+load_rc_config $name
+run_rc_command "$1"

Added: head/net-mgmt/prometheus2/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/prometheus2/pkg-descr	Wed Feb 14 21:58:37 2018	(r461844)
@@ -0,0 +1,19 @@
+Prometheus is a systems and service monitoring system. It collects metrics
+from configured targets at given intervals, evaluates rule expressions,
+displays the results, and can trigger alerts if some condition is observed
+to be true.
+
+Prometheus' main distinguishing features as compared to other monitoring
+systems are:
+
+- a multi-dimensional data model (timeseries defined by metric name and
+  set of key/value dimensions)
+- a flexible query language to leverage this dimensionality
+- no dependency on distributed storage; single server nodes are autonomous
+- timeseries collection happens via a pull model over HTTP
+- pushing timeseries is supported via an intermediary gateway
+- targets are discovered via service discovery or static configuration
+- multiple modes of graphing and dashboarding support
+- support for hierarchical and horizontal federation
+
+WWW: https://prometheus.io/

Added: head/net-mgmt/prometheus2/pkg-message
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/prometheus2/pkg-message	Wed Feb 14 21:58:37 2018	(r461844)
@@ -0,0 +1,43 @@
+
+If you are a user of Prometheus 1.x, the following information may be relevant.
+
+Prometheus 2 contains a number of breaking changes, including:
+  - Changes to how command line flags are parsed (double dash is now required)
+  - Removal of some command line flags
+  - Alert Manager options moved into prometheus.yaml
+  - Alerting / Recording Rules format changes
+    - Rules are now in YAML format
+  - Changes to the storage engine
+    - These changes mean that old data will be unreadable by Prometheus 2,
+      refer to the Prometheus 2 migration guide for more information on this
+      issue
+
+Any existing Prometheus 1 `prometheus.yml` should continue to work with
+Prometheus 2.
+
+As a safety measure, the Prometheus 2 init script will refuse to start
+Prometheus if it finds a Prometheus 1 data dir at the $prometheus_data_dir
+location.
+
+You will likely wish to review the Prometheus 2 migration guide at
+https://prometheus.io/docs/prometheus/2.1/migration/
+
+Brief migration steps:
+  - Stop the running Prometheus 1.
+  - Move any existing `prometheus_` rcconf variables to their equivalent
+   `prometheus1_` rcconf variable.
+  - Move the Prometheus 1 data dir to a suitable location.
+    - A new $prometheus_data_dir for Prometheus 2 will be created by the init
+      script.
+  - Set the `prometheus1_data_dir` rcconf variable to the location that you
+    moved the Prometheus 1 data dir to.
+  - Copy your existing `prometheus.yml` to `prometheus1.yml`.
+    - Prometheus 2 should be able to use your existing Prometheus 1 config.
+  - Put Prometheus 1 into a read-only mode on a different port making changes
+    described at: https://prometheus.io/docs/prometheus/2.0/migration/#storage
+    - You can use the `prometheus1_args` rcconf setting to pass additional
+      arguments.
+  - Add a `remote_read` section to the `prometheus.yml` used by Prometheus 2,
+    this allows Prometheus 2 to have access to the metrics previously gathered
+    by Prometheus 1.
+  - Start both Prometheus 1 and 2.

Added: head/net-mgmt/prometheus2/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/prometheus2/pkg-plist	Wed Feb 14 21:58:37 2018	(r461844)
@@ -0,0 +1,4 @@
+bin/prometheus
+bin/promtool
+ at sample etc/prometheus.yml.sample
+ at dir(prometheus,prometheus) /var/db/prometheus


More information about the svn-ports-head mailing list