1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-16 07:58:04 +00:00

net-mgmt/promxy: Add new port

Promxy is a prometheus proxy that makes many shards of prometheus appear
as a single API endpoint to the user. This significantly simplifies
operations and use of prometheus at scale (when you have more than one
prometheus host). Promxy delivers this unified access endpoint without
requiring any sidecars, custom-builds, or other changes to your
prometheus infrastructure.

PR:		269195
This commit is contained in:
Pavel Timofeev 2024-07-11 15:28:19 +02:00 committed by Emanuel Haupt
parent fb8f1c4acf
commit 0de56f2a1c
8 changed files with 133 additions and 2 deletions

2
GIDs
View File

@ -421,7 +421,7 @@ fiche:*:477:
prometheus:*:478:
alertmanager:*:479:
datadog:*:480:
# free: 481
promxy:*:481:
# free: 482
# free: 483
# free: 484

2
UIDs
View File

@ -426,7 +426,7 @@ fiche:*:477:477::0:0:fiche Daemon:/usr/local/www/fiche:/usr/sbin/nologin
prometheus:*:478:478::0:0:Prometheus Daemon:/var/tmp/prometheus:/usr/sbin/nologin
alertmanager:*:479:479::0:0:Alertmanager Daemon:/var/tmp/alertmanager:/usr/sbin/nologin
datadog:*:480:480::0:0:DataDog Agent:/var/db/datadog:/usr/sbin/nologin
# free: 481
promxy:*:481:481::0:0:Promxy Daemon:/nonexistent:/usr/sbin/nologin
# free: 482
# free: 483
# free: 484

View File

@ -307,6 +307,7 @@
SUBDIR += prometheus1
SUBDIR += prometheus2
SUBDIR += promscale
SUBDIR += promxy
SUBDIR += pushgateway
SUBDIR += py-adal
SUBDIR += py-aggregate6

39
net-mgmt/promxy/Makefile Normal file
View File

@ -0,0 +1,39 @@
PORTNAME= promxy
DISTVERSIONPREFIX= v
DISTVERSION= 0.0.86
CATEGORIES= net-mgmt
MAINTAINER= timp87@gmail.com
COMMENT= Aggregating proxy to enable HA prometheus
WWW= https://github.com/jacksontj/promxy
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= go:modules
USE_RC_SUBR= promxy
GO_MODULE= github.com/jacksontj/promxy
GO_TARGET= ./cmd/promxy
GO_BUILDFLAGS= -ldflags=" \
-X github.com/prometheus/common/version.Version=v${DISTVERSION} \
-X github.com/prometheus/common/version.Revision=${PORTREVISION} \
-X github.com/prometheus/common/version.Branch=release-${PORTVERSION:R} \
-X github.com/prometheus/common/version.BuildUser=${USER} \
-X github.com/prometheus/common/version.BuildDate=$$(date +'%Y%m%d-%T')"
SUB_LIST= GROUPS=${GROUPS} \
USERS=${USERS}
USERS= promxy
GROUPS= promxy
post-patch:
@${REINPLACE_CMD} 's|"\*rule"|"${ETCDIR}/*rule"|' ${WRKSRC}/cmd/promxy/config.yaml
post-install:
${MKDIR} ${STAGEDIR}${ETCDIR}
.for f in alert_example.rule config.yaml
${INSTALL_DATA} ${WRKSRC}/cmd/promxy/${f} ${STAGEDIR}${ETCDIR}/${f}.sample
.endfor
.include <bsd.port.mk>

5
net-mgmt/promxy/distinfo Normal file
View File

@ -0,0 +1,5 @@
TIMESTAMP = 1717380682
SHA256 (go/net-mgmt_promxy/promxy-v0.0.86/v0.0.86.mod) = eb2034fcead52a7deb94942379564c5590fee7720f4eb735b5a363f7477b7f67
SIZE (go/net-mgmt_promxy/promxy-v0.0.86/v0.0.86.mod) = 8436
SHA256 (go/net-mgmt_promxy/promxy-v0.0.86/v0.0.86.zip) = ccc9b18c573ab0ec3adfacabec5048beda9b93f8d5dd250098189212f6e5e8ba
SIZE (go/net-mgmt_promxy/promxy-v0.0.86/v0.0.86.zip) = 226317

View File

@ -0,0 +1,77 @@
#!/bin/sh
# PROVIDE: promxy
# REQUIRE: NETWORKING SERVERS DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf or /etc/rc.conf.local
# to enable this service:
#
# promxy_enable: Enable Promxy
# Default: NO
# promxy_user: Username to run Promxy
# Default: %%USERS%%
# promxy_config: Configuration file to run Promxy
# Default: %%ETCDIR%%/config.yaml
# promxy_pidfile: Full path of the Promxy process PID file
# Default: /var/run/promxy.pid
# promxy_remediate_enable: Enable auto-restart if Promxy's been terminated
# Default: NO
# promxy_remediate_delay: Auto-restart delay if auto-restart enabled
# Default: 5
# promxy_syslog_output_enable: Enable syslog output.
# Default: YES
# promxy_syslog_output_tag: Syslog tag if syslog output enabled.
# Default: promxy
# promxy_syslog_output_priority: Syslog priority if syslog output enabled.
# Default: info
# promxy_syslog_output_facility: Syslog facility if syslog output enabled.
# Default: daemon
. /etc/rc.subr
name=promxy
rcvar=promxy_enable
load_rc_config "${name}"
: ${promxy_enable:="NO"}
: ${promxy_user:="%%USERS%%"}
: ${promxy_config:="%%ETCDIR%%/config.yaml"}
: ${promxy_pidfile:=/var/run/promxy.pid}
: ${promxy_remediate_enable:="NO"}
: ${promxy_remediate_delay="5"}
: ${promxy_syslog_output_enable:="YES"}
: ${promxy_syslog_output_tag:="${name}"}
: ${promxy_syslog_output_priority:="info"}
: ${promxy_syslog_output_facility:="daemon"}
if checkyesno promxy_syslog_output_enable; then
if [ -n "${promxy_syslog_output_tag}" ]; then
promxy_syslog_output_flags="-T ${promxy_syslog_output_tag}"
fi
if [ -n "${promxy_syslog_output_priority}" ]; then
promxy_syslog_output_flags="${promxy_syslog_output_flags} -s ${promxy_syslog_output_priority}"
fi
if [ -n "${promxy_syslog_output_facility}" ]; then
promxy_syslog_output_flags="${promxy_syslog_output_flags} -l ${promxy_syslog_output_facility}"
fi
fi
if checkyesno promxy_remediate_enable; then
if [ -n "${promxy_remediate_delay}" ]; then
promxy_remediate_flags="-R ${promxy_remediate_delay}"
fi
fi
pidfile="${promxy_pidfile}"
required_files="${promxy_config}"
promxy_bin="%%PREFIX%%/bin/promxy"
command="/usr/sbin/daemon"
command_args="-u ${promxy_user} ${promxy_remediate_flags} -f ${promxy_syslog_output_flags} -P ${pidfile} ${promxy_bin} --config=${promxy_config}"
# Run daemon(8) as root
unset promxy_user
run_rc_command "$1"

View File

@ -0,0 +1,5 @@
Promxy is a prometheus proxy that makes many shards of prometheus appear as
a single API endpoint to the user. This significantly simplifies operations
and use of prometheus at scale (when you have more than one prometheus host).
Promxy delivers this unified access endpoint without requiring any sidecars,
custom-builds, or other changes to your prometheus infrastructure.

View File

@ -0,0 +1,4 @@
bin/promxy
@dir %%ETCDIR%%
@sample %%ETCDIR%%/alert_example.rule.sample
@sample %%ETCDIR%%/config.yaml.sample