Initial commit

This commit is contained in:
yo 2020-08-06 23:09:38 +02:00
commit 6b40cd5331
6 changed files with 136 additions and 0 deletions

43
Makefile Normal file
View File

@ -0,0 +1,43 @@
# $FreeBSD: head/sysutils/dovecot_exporter/Makefile 517745 2019-11-16 12:52:39Z dmgk $
PORTNAME= dovecot_exporter
PORTVERSION= 0.1.3
PORTREVISION= 1
CATEGORIES= sysutils
MAINTAINER= yo@nosd.in
COMMENT= Export dovecot metrics in Prometheus format
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= go
USE_GITHUB= yes
GH_ACCOUNT= kumina
GH_PROJECT= dovecot_exporter
USERS= dovecot_exporter
GROUPS= dovecot_exporter
GH_TUPLE= alecthomas:kingpin:v2.2.6:kingpin/vendor/github.com/alecthomas/kingpin \
alecthomas:template:fb15b89:template/vendor/github.com/alecthomas/template \
alecthomas:units:f65c72e:units/vendor/github.com/alecthomas/units \
beorn7:perks:v1.0.0:perks/vendor/github.com/beorn7/perks \
cespare:xxhash:v2.1.1:xxhash/vendor/github.com/cespare/xxhash/v2 \
golang:protobuf:v1.3.1:protobuf/vendor/github.com/golang/protobuf \
golang:sys:5ac8a444bdc5:sys/vendor/golang.org/x/sys \
hpcloud:tail:v1.0.0:tail/vendor/github.com/hpcloud/tail \
matttproud:golang_protobuf_extensions:v1.0.1:golang_protobuf_extensions/vendor/github.com/matttproud/golang_protobuf_extensions \
prometheus:client_golang:v1.6.0:client_golang/vendor/github.com/prometheus/client_golang \
prometheus:client_model:v0.2.0:client_model/vendor/github.com/prometheus/client_model \
prometheus:common:v0.10.0:common/vendor/github.com/prometheus/common \
prometheus:procfs:v0.0.11:procfs/vendor/github.com/prometheus/procfs
GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT}
USE_RC_SUBR= dovecot_exporter
pre-test:
${SETENV} GOPATH="${WRKDIR}"
.include <bsd.port.mk>

29
distinfo Normal file
View File

@ -0,0 +1,29 @@
TIMESTAMP = 1591302469
SHA256 (kumina-dovecot_exporter-0.1.3_GH0.tar.gz) = 5dbf95af4b8591f312cbf94ac1c798c41bc67fccfb07028b71057c81e3cfd239
SIZE (kumina-dovecot_exporter-0.1.3_GH0.tar.gz) = 7195
SHA256 (alecthomas-kingpin-v2.2.6_GH0.tar.gz) = 4624eae43489de8a71ea60efaf6744c581b6bd62909f7514c484c1ea0efaba5a
SIZE (alecthomas-kingpin-v2.2.6_GH0.tar.gz) = 44383
SHA256 (alecthomas-template-fb15b89_GH0.tar.gz) = edc515063323c61120740ef930ce60e659e9ae82e2b21062ec451ff675b8d6be
SIZE (alecthomas-template-fb15b89_GH0.tar.gz) = 55333
SHA256 (alecthomas-units-f65c72e_GH0.tar.gz) = ea7b78bc113b977f2cb2a52cf7bb46dc2e61476b13a8ae7ab6ce79883a69b0a5
SIZE (alecthomas-units-f65c72e_GH0.tar.gz) = 4920
SHA256 (beorn7-perks-v1.0.0_GH0.tar.gz) = b69d92e2e84b7d510dfa6110d3ac4ada0096a6c81190c5e174aa888bfe475cbc
SIZE (beorn7-perks-v1.0.0_GH0.tar.gz) = 10866
SHA256 (cespare-xxhash-v2.1.1_GH0.tar.gz) = 0ee31178d2c5a1249be4e26294a2f428008dc4e1ecbbfbe47f74e41026df1148
SIZE (cespare-xxhash-v2.1.1_GH0.tar.gz) = 9292
SHA256 (golang-protobuf-v1.3.1_GH0.tar.gz) = 3f3a6123054a9847093c119895f1660612f301fe95358f3a6a1a33fd0933e6cf
SIZE (golang-protobuf-v1.3.1_GH0.tar.gz) = 310884
SHA256 (golang-sys-5ac8a444bdc5_GH0.tar.gz) = 1d94fa910156b4c897b28dba696f29ecb0ef67d8f1f9626588bec21350e29c13
SIZE (golang-sys-5ac8a444bdc5_GH0.tar.gz) = 1110515
SHA256 (hpcloud-tail-v1.0.0_GH0.tar.gz) = 3aa982c4a779b1c1dc5723bbf2345eed1dd46cd5bcc490e69de4beab8f5d4b02
SIZE (hpcloud-tail-v1.0.0_GH0.tar.gz) = 37816
SHA256 (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 2def0ee6f6b12b1efc0e3007d89f598608a072610e805c3655ea9d13c3ead49b
SIZE (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 37184
SHA256 (prometheus-client_golang-v1.6.0_GH0.tar.gz) = e255f632b7223f794e0f60d99976535c16153cc00fadf39ee87fd9f678d6a32c
SIZE (prometheus-client_golang-v1.6.0_GH0.tar.gz) = 157355
SHA256 (prometheus-client_model-v0.2.0_GH0.tar.gz) = 4ab1be9cdfa702d7f49beeb09a256bcc6a2aad55e8a0a37e7732a46934264e12
SIZE (prometheus-client_model-v0.2.0_GH0.tar.gz) = 10986
SHA256 (prometheus-common-v0.10.0_GH0.tar.gz) = 349381082ea8e66637c2d2475f1ae0e74ca04a7b91eb3b96817c261b87668fd3
SIZE (prometheus-common-v0.10.0_GH0.tar.gz) = 107763
SHA256 (prometheus-procfs-v0.0.11_GH0.tar.gz) = fd84664db471a0d08d721abc383665fe9a61a56001ff2c8b3b3734f8146bf0ae
SIZE (prometheus-procfs-v0.0.11_GH0.tar.gz) = 135114

38
files/dovecot_exporter.in Normal file
View File

@ -0,0 +1,38 @@
#!/bin/sh
# $FreeBSD: head/net/dovecot_exporter/files/dovecot_exporter.in 529909 2020-03-30 19:18:03Z decke $
#
# PROVIDE: dovecot_exporter
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# dovecot_exporter_enable (bool): Set to "YES" to enable dovecot_exporter.
# (default: "NO")
#
# dovecot_exporter_socket (str): Dovecot socket path
# (default: "/var/run/dovecot/stats-reader")
# dovecot_exporter_listen (str): Exporter listening address
# (default: ":9166")
# dovecot_exporter_telemetry_path (str): Path under which to expose metrics
# (default: "/metrics")
# dovecot_exporter_stats_scopes (str): Stats scopes to query (comma separated)
. /etc/rc.subr
name=dovecot_exporter
rcvar=dovecot_exporter_enable
load_rc_config $name
: ${dovecot_exporter_enable="NO"}
: ${dovecot_exporter_socket="/var/run/dovecot/stats-reader"}
: ${dovecot_exporter_listen=":9166"}
: ${dovecot_exporter_telemetry_path="/metrics"}
: ${dovecot_exporter_pidfile:="/var/run/dovecot_exporter.pid"}
: ${dovecot_exporter_user:="dovecot_exporter"}
command="/usr/local/bin/dovecot_exporter"
command_args="--web.listen-address=\${dovecot_exporter_listen} --web.telemetry-path=\${dovecot_exporter_telemetry_path} --dovecot.socket-path=\${dovecot_exporter_showq} --dovecot.scopes=\${dovecot_exporter_stats_scopes}"
start_cmd="/usr/sbin/daemon -u ${dovecot_exporter_user} ${command} ${command_args}"
run_rc_command "$1"

View File

@ -0,0 +1,21 @@
--- dovecot_exporter.go.orig 2018-09-12 13:52:05 UTC
+++ dovecot_exporter.go
@@ -25,7 +25,8 @@ import (
"strings"
"github.com/prometheus/client_golang/prometheus"
- "gopkg.in/alecthomas/kingpin.v2"
+ "github.com/prometheus/client_golang/prometheus/promhttp"
+ "github.com/alecthomas/kingpin"
)
var dovecotUpDesc = prometheus.NewDesc(
@@ -216,7 +217,7 @@ func main() {
exporter := NewDovecotExporter(*socketPath, strings.Split(*dovecotScopes, ","))
prometheus.MustRegister(exporter)
- http.Handle(*metricsPath, prometheus.Handler())
+ http.Handle(*metricsPath, promhttp.Handler())
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`
<html>

3
pkg-descr Normal file
View File

@ -0,0 +1,3 @@
Export dovecot metrics in Prometheus format.
WWW: https://github.com/kumina/dovecot_exporter

2
pkg-plist Normal file
View File

@ -0,0 +1,2 @@
bin/dovecot_exporter
etc/rc.d/dovecot_exporter