diff options
author | brd <brd@FreeBSD.org> | 2018-03-31 06:34:09 +0800 |
---|---|---|
committer | brd <brd@FreeBSD.org> | 2018-03-31 06:34:09 +0800 |
commit | 7aa00c8d90744c166358ab96830004ec2253933c (patch) | |
tree | 3dfc9f1a104d06a95e4a17e3f6ff99ee2b70947f /net-mgmt | |
parent | e7c7bbbe7ae49c1d54032edc0d2044db34ba5a64 (diff) | |
download | freebsd-ports-gnome-7aa00c8d90744c166358ab96830004ec2253933c.tar.gz freebsd-ports-gnome-7aa00c8d90744c166358ab96830004ec2253933c.tar.zst freebsd-ports-gnome-7aa00c8d90744c166358ab96830004ec2253933c.zip |
Readd prometheus2 with corrected history.
PR: 225169
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/prometheus2/Makefile | 53 | ||||
-rw-r--r-- | net-mgmt/prometheus2/distinfo | 3 | ||||
-rw-r--r-- | net-mgmt/prometheus2/files/prometheus.in | 100 | ||||
-rw-r--r-- | net-mgmt/prometheus2/pkg-descr | 19 | ||||
-rw-r--r-- | net-mgmt/prometheus2/pkg-plist | 4 |
5 files changed, 179 insertions, 0 deletions
diff --git a/net-mgmt/prometheus2/Makefile b/net-mgmt/prometheus2/Makefile new file mode 100644 index 000000000000..a749cf7f4ace --- /dev/null +++ b/net-mgmt/prometheus2/Makefile @@ -0,0 +1,53 @@ +# $FreeBSD$ + +PORTNAME= prometheus +PORTVERSION= 2.1.0 +DISTVERSIONPREFIX= v +CATEGORIES= net-mgmt + +MAINTAINER= dor.bsd@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} ${MAKE_ENV} ${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> diff --git a/net-mgmt/prometheus2/distinfo b/net-mgmt/prometheus2/distinfo new file mode 100644 index 000000000000..9dc09c7f633f --- /dev/null +++ b/net-mgmt/prometheus2/distinfo @@ -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 diff --git a/net-mgmt/prometheus2/files/prometheus.in b/net-mgmt/prometheus2/files/prometheus.in new file mode 100644 index 000000000000..73814e4591e5 --- /dev/null +++ b/net-mgmt/prometheus2/files/prometheus.in @@ -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" diff --git a/net-mgmt/prometheus2/pkg-descr b/net-mgmt/prometheus2/pkg-descr new file mode 100644 index 000000000000..9113efa4c3e4 --- /dev/null +++ b/net-mgmt/prometheus2/pkg-descr @@ -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/ diff --git a/net-mgmt/prometheus2/pkg-plist b/net-mgmt/prometheus2/pkg-plist new file mode 100644 index 000000000000..39ce271e8e86 --- /dev/null +++ b/net-mgmt/prometheus2/pkg-plist @@ -0,0 +1,4 @@ +bin/prometheus +bin/promtool +@sample etc/prometheus.yml.sample +@dir(prometheus,prometheus) /var/db/prometheus |