mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 01:26:39 -04:00
net-mgmt/prometheus3: Add new port
Add Prometheus 3.3.0, released on 2025-04-15, to the Ports tree. Prometheus is a systems and service monitoring system. This port is heavily based on net-mgmt/prometheus2. Release notes: https://github.com/prometheus/prometheus/releases/tag/v3.3.0 Migration guide: https://prometheus.io/docs/prometheus/latest/migration/
This commit is contained in:
parent
026304430c
commit
cbc634d294
6 changed files with 289 additions and 0 deletions
|
@ -312,6 +312,7 @@
|
||||||
SUBDIR += prometheus-collectd-exporter
|
SUBDIR += prometheus-collectd-exporter
|
||||||
SUBDIR += prometheus1
|
SUBDIR += prometheus1
|
||||||
SUBDIR += prometheus2
|
SUBDIR += prometheus2
|
||||||
|
SUBDIR += prometheus3
|
||||||
SUBDIR += promscale
|
SUBDIR += promscale
|
||||||
SUBDIR += promxy
|
SUBDIR += promxy
|
||||||
SUBDIR += pushgateway
|
SUBDIR += pushgateway
|
||||||
|
|
79
net-mgmt/prometheus3/Makefile
Normal file
79
net-mgmt/prometheus3/Makefile
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
PORTNAME= prometheus
|
||||||
|
DISTVERSIONPREFIX= v
|
||||||
|
DISTVERSION= 3.3.0
|
||||||
|
CATEGORIES= net-mgmt
|
||||||
|
MASTER_SITES= https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${DISTVERSIONFULL}/:gomod \
|
||||||
|
https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/releases/download/${DISTVERSIONFULL}/:ui
|
||||||
|
PKGNAMESUFFIX= 3
|
||||||
|
DISTFILES= go.mod:gomod ${PORTNAME}-web-ui-${DISTVERSION}.tar.gz:ui
|
||||||
|
|
||||||
|
MAINTAINER= danilo@FreeBSD.org
|
||||||
|
COMMENT= Systems monitoring and alerting toolkit
|
||||||
|
WWW= https://prometheus.io/
|
||||||
|
|
||||||
|
LICENSE= APACHE20
|
||||||
|
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||||
|
|
||||||
|
PATCH_DEPENDS= bash:shells/bash
|
||||||
|
|
||||||
|
USES= cpe go:1.23,modules
|
||||||
|
|
||||||
|
CONFLICTS_INSTALL= prometheus1 prometheus
|
||||||
|
|
||||||
|
USE_GITHUB= yes
|
||||||
|
USE_RC_SUBR= prometheus
|
||||||
|
|
||||||
|
GO_MODULE= github.com/prometheus/prometheus
|
||||||
|
GO_TARGET= ./cmd/prometheus ./cmd/promtool
|
||||||
|
GO_BUILDFLAGS= -a -v -ldflags "${LD_FLAG_STRING}" -tags netgo,builtinassets
|
||||||
|
|
||||||
|
SUB_LIST+= PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
|
||||||
|
PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
|
||||||
|
PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
|
||||||
|
PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
|
||||||
|
PROMETHEUS_USER=${PROMETHEUS_USER}
|
||||||
|
|
||||||
|
USERS= ${PROMETHEUS_USER}
|
||||||
|
GROUPS= ${PROMETHEUS_GROUP}
|
||||||
|
|
||||||
|
PLIST_SUB+= PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
|
||||||
|
PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
|
||||||
|
PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
|
||||||
|
PROMETHEUS_USER=${PROMETHEUS_USER}
|
||||||
|
|
||||||
|
OPTIONS_DEFINE= DOCS
|
||||||
|
|
||||||
|
BUILD_USER?= ${USER}
|
||||||
|
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} \
|
||||||
|
${LD_FLAG_X_PREFIX}.BuildDate=$$(date +'%Y%m%d-%H:%M:%S')
|
||||||
|
LD_FLAG_X_PREFIX= -X github.com/prometheus/common/version
|
||||||
|
|
||||||
|
PROMETHEUS_CONSOLES_DIR?= ${DATADIR}/consoles
|
||||||
|
PROMETHEUS_CONSOLE_LIBRARIES_DIR?= ${DATADIR}/console_libraries
|
||||||
|
PROMETHEUS_DB_DIR?= /var/db/${PORTNAME}
|
||||||
|
PROMETHEUS_GROUP?= prometheus
|
||||||
|
PROMETHEUS_USER?= prometheus
|
||||||
|
|
||||||
|
.include <bsd.port.pre.mk>
|
||||||
|
|
||||||
|
post-patch:
|
||||||
|
@${RM} -rf ${WRKSRC}/web/ui/static
|
||||||
|
@${CP} -a ${WRKDIR}/static ${WRKSRC}/web/ui/static
|
||||||
|
@( cd ${WRKSRC} && ${WRKSRC}/scripts/compress_assets.sh )
|
||||||
|
|
||||||
|
post-install:
|
||||||
|
${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLES_DIR}
|
||||||
|
${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR}
|
||||||
|
${INSTALL_DATA} \
|
||||||
|
${WRKSRC}/documentation/examples/prometheus.yml \
|
||||||
|
${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
|
||||||
|
|
||||||
|
post-install-DOCS-on:
|
||||||
|
@${MKDIR} ${STAGEDIR}${DOCSDIR}
|
||||||
|
@( cd ${WRKSRC}/docs \
|
||||||
|
&& ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} )
|
||||||
|
|
||||||
|
.include <bsd.port.post.mk>
|
7
net-mgmt/prometheus3/distinfo
Normal file
7
net-mgmt/prometheus3/distinfo
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
TIMESTAMP = 1745143828
|
||||||
|
SHA256 (go/net-mgmt_prometheus3/prometheus-prometheus-v3.3.0_GH0/go.mod) = d10eb1ccf4285c63642ef10f2c811073b8945fdc8bdb0fc7a668de4aaf85ff58
|
||||||
|
SIZE (go/net-mgmt_prometheus3/prometheus-prometheus-v3.3.0_GH0/go.mod) = 10745
|
||||||
|
SHA256 (go/net-mgmt_prometheus3/prometheus-prometheus-v3.3.0_GH0/prometheus-web-ui-3.3.0.tar.gz) = 845f1e2c869e7f8679646ca3a97d56c9dfc30f8064e7bd4e0d0d756fe9c74d30
|
||||||
|
SIZE (go/net-mgmt_prometheus3/prometheus-prometheus-v3.3.0_GH0/prometheus-web-ui-3.3.0.tar.gz) = 3487058
|
||||||
|
SHA256 (go/net-mgmt_prometheus3/prometheus-prometheus-v3.3.0_GH0/prometheus-prometheus-v3.3.0_GH0.tar.gz) = 5562c10a41781f1378cf962a117e7d70a2cfc6e4be7f4cada2474dd534f6512a
|
||||||
|
SIZE (go/net-mgmt_prometheus3/prometheus-prometheus-v3.3.0_GH0/prometheus-prometheus-v3.3.0_GH0.tar.gz) = 5045708
|
151
net-mgmt/prometheus3/files/prometheus.in
Normal file
151
net-mgmt/prometheus3/files/prometheus.in
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
#!/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 it to YES to enable prometheus
|
||||||
|
# Set to NO by default
|
||||||
|
# prometheus_user (string)
|
||||||
|
# Set user that prometheus will run under
|
||||||
|
# Default is "%%PROMETHEUS_USER%%"
|
||||||
|
# prometheus_group (string)
|
||||||
|
# Set group that own prometheus files
|
||||||
|
# Default is "%%PROMETHEUS_GROUP%%"
|
||||||
|
# prometheus_config (string)
|
||||||
|
# Set full path to config file
|
||||||
|
# Default is "%%PREFIX%%/etc/prometheus.yml"
|
||||||
|
# prometheus_pidfile (string)
|
||||||
|
# Set full path to pid file
|
||||||
|
# Default is "/var/run/prometheus.pid"
|
||||||
|
# prometheus_syslog_output_enable (bool)
|
||||||
|
# Set it to NO to disable syslog output
|
||||||
|
# Set to YES by default
|
||||||
|
# prometheus_syslog_output_tag (str)
|
||||||
|
# Set syslog tag if syslog enabled
|
||||||
|
# Default is "prometheus"
|
||||||
|
# prometheus_syslog_output_priority (string)
|
||||||
|
# Set syslog priority if syslog enabled
|
||||||
|
# Default is "info"
|
||||||
|
# prometheus_syslog_output_facility (string)
|
||||||
|
# Set syslog facility if syslog enabled
|
||||||
|
# Default is "daemon"
|
||||||
|
# prometheus_agent_mode (bool)
|
||||||
|
# Set to "YES" to enable Prometheus Agent Mode
|
||||||
|
# Default is "NO"
|
||||||
|
# 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_data_dir (string)
|
||||||
|
# Set dir to run prometheus in
|
||||||
|
# Default is "%%PROMETHEUS_DB_DIR%%"
|
||||||
|
# prometheus_loglevel (string)
|
||||||
|
# Set one of [debug, info, warn, error]
|
||||||
|
# Default is "info"
|
||||||
|
# prometheus_logformat (string)
|
||||||
|
# Set one of [logfmt, json]
|
||||||
|
# Default is "logfmt"
|
||||||
|
# prometheus_env (string)
|
||||||
|
# Set environment variables used with prometheus
|
||||||
|
# Default is ""
|
||||||
|
# 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_USER%%"}
|
||||||
|
: ${prometheus_group:="%%PROMETHEUS_GROUP%%"}
|
||||||
|
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"}
|
||||||
|
: ${prometheus_pidfile:="/var/run/prometheus.pid"}
|
||||||
|
: ${prometheus_syslog_output_enable:="YES"}
|
||||||
|
: ${prometheus_agent_mode:="NO"}
|
||||||
|
: ${prometheus_consoles_dir:="%%PROMETHEUS_CONSOLES_DIR%%"}
|
||||||
|
: ${prometheus_console_libraries_dir:="%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"}
|
||||||
|
: ${prometheus_data_dir:="%%PROMETHEUS_DB_DIR%%"}
|
||||||
|
: ${prometheus_loglevel:="info"}
|
||||||
|
: ${prometheus_logformat:="logfmt"}
|
||||||
|
|
||||||
|
if checkyesno prometheus_syslog_output_enable; then
|
||||||
|
if [ -n "${prometheus_syslog_output_tag}" ]; then
|
||||||
|
prometheus_syslog_output_flags="-T ${prometheus_syslog_output_tag}"
|
||||||
|
else
|
||||||
|
prometheus_syslog_output_flags="-T ${name}"
|
||||||
|
fi
|
||||||
|
if [ -n "${prometheus_syslog_output_priority}" ]; then
|
||||||
|
prometheus_syslog_output_flags="${prometheus_syslog_output_flags} -s ${prometheus_syslog_output_priority}"
|
||||||
|
fi
|
||||||
|
if [ -n "${prometheus_syslog_output_facility}" ]; then
|
||||||
|
prometheus_syslog_output_flags="${prometheus_syslog_output_flags} -l ${prometheus_syslog_output_facility}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if checkyesno prometheus_agent_mode; then
|
||||||
|
prometheus_storage_flags="--agent --storage.agent.path=${prometheus_data_dir}"
|
||||||
|
else
|
||||||
|
prometheus_storage_flags="--storage.tsdb.path=${prometheus_data_dir}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pidfile="${prometheus_pidfile}"
|
||||||
|
required_files="${prometheus_config}"
|
||||||
|
|
||||||
|
procname="%%PREFIX%%/bin/prometheus"
|
||||||
|
command="/usr/sbin/daemon"
|
||||||
|
command_args="-f ${prometheus_syslog_output_flags} -p ${pidfile} -t ${name} \
|
||||||
|
/usr/bin/env ${prometheus_env} ${procname} \
|
||||||
|
--config.file=${prometheus_config} \
|
||||||
|
--web.console.templates=${prometheus_consoles_dir} \
|
||||||
|
--web.console.libraries=${prometheus_console_libraries_dir} \
|
||||||
|
--log.level=${prometheus_loglevel} \
|
||||||
|
--log.format=${prometheus_logformat} \
|
||||||
|
${prometheus_storage_flags} \
|
||||||
|
${prometheus_args}"
|
||||||
|
|
||||||
|
start_precmd="prometheus_start_precmd"
|
||||||
|
extra_commands="reload"
|
||||||
|
|
||||||
|
# This checks for the existence of a prometheus 1.x data at the
|
||||||
|
# $prometheus_data_dir location. If one is found, Prometheus will not start.
|
||||||
|
prometheus_check_data_version()
|
||||||
|
{
|
||||||
|
local _version
|
||||||
|
local _version_file="${prometheus_data_dir}/VERSION"
|
||||||
|
|
||||||
|
if [ -f "${_version_file}" ]; then
|
||||||
|
read _version < "${_version_file}"
|
||||||
|
|
||||||
|
if [ "${_version}" = "1" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
prometheus_start_precmd()
|
||||||
|
{
|
||||||
|
if [ ! -e "${pidfile}" ]; then
|
||||||
|
install -m 0600 -o "${prometheus_user}" -g "${prometheus_group}" /dev/null "${pidfile}"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${prometheus_data_dir}" ]; then
|
||||||
|
install -d -m 750 -o "${prometheus_user}" -g "${prometheus_group}" "${prometheus_data_dir}"
|
||||||
|
else
|
||||||
|
# Ensure it's not a prometheus 1.x data
|
||||||
|
if [ ! prometheus_check_data_version ]; then
|
||||||
|
err 1 "Found \"net-mgmt/prometheus1\" data, refusing to start."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_rc_command "$1"
|
17
net-mgmt/prometheus3/pkg-descr
Normal file
17
net-mgmt/prometheus3/pkg-descr
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
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
|
34
net-mgmt/prometheus3/pkg-plist
Normal file
34
net-mgmt/prometheus3/pkg-plist
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
bin/prometheus
|
||||||
|
bin/promtool
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/command-line/index.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/command-line/%%PROMETHEUS_USER%%.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/command-line/promtool.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/configuration/alerting_rules.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/configuration/configuration.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/configuration/https.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/configuration/index.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/configuration/recording_rules.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/configuration/template_examples.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/configuration/template_reference.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/configuration/unit_testing_rules.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/feature_flags.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/federation.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/getting_started.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/http_sd.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/images/remote_integrations.png
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/index.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/installation.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/management_api.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/migration.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/querying/api.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/querying/basics.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/querying/examples.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/querying/functions.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/querying/index.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/querying/operators.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/querying/remote_read_api.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/stability.md
|
||||||
|
%%PORTDOCS%%%%DOCSDIR%%/storage.md
|
||||||
|
@sample etc/prometheus.yml.sample
|
||||||
|
@dir %%DATADIR%%/console_libraries
|
||||||
|
@dir %%DATADIR%%/consoles
|
Loading…
Add table
Reference in a new issue