aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt
diff options
context:
space:
mode:
authorbsam <bsam@FreeBSD.org>2017-07-18 05:39:37 +0800
committerbsam <bsam@FreeBSD.org>2017-07-18 05:39:37 +0800
commit500096a7fa675d981b10d70a5f7ffe90e5baa397 (patch)
tree83c7cae3f08b3bffebdf3d1e0623346194e389e8 /net-mgmt
parent9510ff3bf7362540c2bd19a1e1f488daec379f72 (diff)
downloadfreebsd-ports-gnome-500096a7fa675d981b10d70a5f7ffe90e5baa397.tar.gz
freebsd-ports-gnome-500096a7fa675d981b10d70a5f7ffe90e5baa397.tar.zst
freebsd-ports-gnome-500096a7fa675d981b10d70a5f7ffe90e5baa397.zip
The Prometheus Pushgateway exists to allow ephemeral and batch jobs to
expose their metrics to Prometheus. Since these kinds of jobs may not exist long enough to be scraped, they can instead push their metrics to a Pushgateway. The Pushgateway then exposes these metrics to Prometheus. WWW: https://github.com/prometheus/pushgateway PR: 216882 Submitted by: Athanasios Douitsis <aduitsis@cpan.org>
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/Makefile1
-rw-r--r--net-mgmt/pushgateway/Makefile34
-rw-r--r--net-mgmt/pushgateway/distinfo3
-rw-r--r--net-mgmt/pushgateway/files/pushgateway.in66
-rw-r--r--net-mgmt/pushgateway/pkg-descr6
-rw-r--r--net-mgmt/pushgateway/pkg-plist2
6 files changed, 112 insertions, 0 deletions
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 0017d54cd56c..48d418f49dfc 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -286,6 +286,7 @@
SUBDIR += pnp-icinga2
SUBDIR += portmon
SUBDIR += prometheus
+ SUBDIR += pushgateway
SUBDIR += py-ipcalc
SUBDIR += py-ipy
SUBDIR += py-pyang
diff --git a/net-mgmt/pushgateway/Makefile b/net-mgmt/pushgateway/Makefile
new file mode 100644
index 000000000000..c92f18be29bb
--- /dev/null
+++ b/net-mgmt/pushgateway/Makefile
@@ -0,0 +1,34 @@
+# Created by: Athanasios Douitsis <aduitsis@cpan.org>
+# $FreeBSD$
+
+PORTNAME= pushgateway
+PORTVERSION= 0.3.1
+DISTVERSIONPREFIX=v
+CATEGORIES= net-mgmt
+
+MAINTAINER= aduitsis@cpan.org
+COMMENT= Prometheus push acceptor for ephemeral and batch jobs
+
+LICENSE= APACHE20
+
+USES= go gmake
+GH_ACCOUNT= prometheus
+USE_GITHUB= yes
+
+GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME}
+
+USE_RC_SUBR= pushgateway
+
+USERS= prometheus
+GROUPS= prometheus
+
+STRIP= # stripping can break go binaries
+
+do-build:
+ (cd ${GO_WRKSRC} ; ${SETENV} ${GO_ENV} go install)
+
+do-install:
+ ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/pushgateway ${STAGEDIR}${PREFIX}/bin
+ ${MKDIR} ${STAGEDIR}${DESTDIR}/var/db/${PORTNAME}
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/pushgateway/distinfo b/net-mgmt/pushgateway/distinfo
new file mode 100644
index 000000000000..ec7b07c4e8dc
--- /dev/null
+++ b/net-mgmt/pushgateway/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1486461319
+SHA256 (prometheus-pushgateway-v0.3.1_GH0.tar.gz) = 6b0fffd0ffd05babbcfd8838027e4bad8ee4d91aeaca705aa83d7ddf1f8bb6c6
+SIZE (prometheus-pushgateway-v0.3.1_GH0.tar.gz) = 1140371
diff --git a/net-mgmt/pushgateway/files/pushgateway.in b/net-mgmt/pushgateway/files/pushgateway.in
new file mode 100644
index 000000000000..275629dbfbec
--- /dev/null
+++ b/net-mgmt/pushgateway/files/pushgateway.in
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+# PROVIDE: pushgateway
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# pushgateway_enable (bool): Set to NO by default
+# Set it to YES to enable pushgateway
+# pushgateway_user (string): Set user to run pushgateway
+# Default is "prometheus"
+# pushgateway_group (string): Set group to run pushgateway
+# Default is "prometheus"
+# pushgateway_data_dir (string): Set dir to run pushgateway in
+# Default is "/var/db/pushgateway"
+# pushgateway_persistence_file (string): Set file in which the pushed
+# metrics will be persisted
+# Default is "${pushgateway_data_dir}/persistent.data"
+# pushgateway_log_file (string): Set file that pushgateway will log to
+# Default is "/var/log/pushgateway.log"
+# pushgateway_args (string): Set additional command line arguments
+# Default is ""
+
+. /etc/rc.subr
+
+name=pushgateway
+rcvar=pushgateway_enable
+
+load_rc_config $name
+
+: ${pushgateway_enable:=NO}
+: ${pushgateway_user:=prometheus}
+: ${pushgateway_group:=prometheus}
+: ${pushgateway_data_dir=/var/db/pushgateway}
+: ${pushgateway_persistence_file=${pushgateway_data_dir}/persistent.data}
+: ${pushgateway_log_file=/var/log/pushgateway.log}
+
+pidfile=/var/run/pushgateway.pid
+command=/usr/sbin/daemon
+procname="%%PREFIX%%/bin/pushgateway"
+sig_reload=HUP
+extra_commands=reload
+command_args="-p ${pidfile} /usr/bin/env ${procname} \
+ -persistence.file=${pushgateway_persistence_file} \
+ ${pushgateway_args} > ${pushgateway_log_file} 2>&1"
+
+start_precmd=pushgateway_startprecmd
+
+pushgateway_startprecmd()
+{
+ if [ ! -e ${pidfile} ]; then
+ install -o ${pushgateway_user} -g ${pushgateway_group} /dev/null ${pidfile};
+ fi
+ if [ ! -f "${pushgateway_log_file}" ]; then
+ install -o ${pushgateway_user} -g ${pushgateway_group} -m 640 /dev/null ${pushgateway_log_file};
+ fi
+ if [ ! -d ${pushgateway_data_dir} ]; then
+ install -d -o ${pushgateway_user} -g ${pushgateway_group} -m 750 ${pushgateway_data_dir}
+ fi
+}
+
+run_rc_command "$1"
diff --git a/net-mgmt/pushgateway/pkg-descr b/net-mgmt/pushgateway/pkg-descr
new file mode 100644
index 000000000000..e1ec07bf9058
--- /dev/null
+++ b/net-mgmt/pushgateway/pkg-descr
@@ -0,0 +1,6 @@
+The Prometheus Pushgateway exists to allow ephemeral and batch jobs to
+expose their metrics to Prometheus. Since these kinds of jobs may not
+exist long enough to be scraped, they can instead push their metrics to
+a Pushgateway. The Pushgateway then exposes these metrics to Prometheus.
+
+WWW: https://github.com/prometheus/pushgateway
diff --git a/net-mgmt/pushgateway/pkg-plist b/net-mgmt/pushgateway/pkg-plist
new file mode 100644
index 000000000000..cb0fb214e624
--- /dev/null
+++ b/net-mgmt/pushgateway/pkg-plist
@@ -0,0 +1,2 @@
+bin/pushgateway
+@dir(prometheus,prometheus) /var/db/pushgateway