git: e90f4ca7918f - main - net-mgmt/mqtt2prometheus: Add new port

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Mon, 02 May 2022 12:42:57 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e90f4ca7918fc3dee0f7dedfae4a02051d9a0863

commit e90f4ca7918fc3dee0f7dedfae4a02051d9a0863
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-05-02 12:40:36 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-05-02 12:42:01 +0000

    net-mgmt/mqtt2prometheus: Add new port
    
    Exporter that allows to translate MQTT topics to prometheus metrics.
---
 net-mgmt/Makefile                  |  1 +
 net-mgmt/mqtt2prometheus/Makefile  | 57 ++++++++++++++++++++++++++++++++++++++
 net-mgmt/mqtt2prometheus/distinfo  | 57 ++++++++++++++++++++++++++++++++++++++
 net-mgmt/mqtt2prometheus/pkg-descr | 11 ++++++++
 net-mgmt/mqtt2prometheus/pkg-plist |  2 ++
 5 files changed, 128 insertions(+)

diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index cc67d38de89d..40af2dc09f36 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -128,6 +128,7 @@
     SUBDIR += midpoint
     SUBDIR += mk-livestatus
     SUBDIR += monitoring-plugins
+    SUBDIR += mqtt2prometheus
     SUBDIR += mrtg
     SUBDIR += mrtg-ping-probe
     SUBDIR += mtrace
diff --git a/net-mgmt/mqtt2prometheus/Makefile b/net-mgmt/mqtt2prometheus/Makefile
new file mode 100644
index 000000000000..b9953d63c721
--- /dev/null
+++ b/net-mgmt/mqtt2prometheus/Makefile
@@ -0,0 +1,57 @@
+PORTNAME=		mqtt2prometheus
+DISTVERSIONPREFIX=	v
+DISTVERSION=		0.1.6
+CATEGORIES=		net-mgmt
+
+MAINTAINER=	manu@FreeBSD.org
+COMMENT=	Export MQTT metrics to prometheus
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		gmake go
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	hikhvar
+GH_TUPLE=	\
+		beorn7:perks:v1.0.1:beorn7_perks/vendor/github.com/beorn7/perks \
+		eclipse:paho.mqtt.golang:v1.3.5:paho/vendor/github.com/eclipse/paho.mqtt.golang \
+		go-kit:kit:v0.10.0:go_kit_kit/vendor/github.com/go-kit/kit \
+		go-yaml:yaml:v2.4.0:go_yaml_yaml/vendor/gopkg.in/yaml.v2 \
+		gorilla:websocket:v1.4.2:gorilla_websocket/vendor/github.com/gorilla/websocket \
+		patrickmn:go-cache:v2.1.0:patrickmn_go_cache/vendor/github.com/patrickmn/go-cache \
+		pkg:errors:v0.9.1:pkg_errors/vendor/github.com/pkg/errors \
+		prometheus:client_golang:v1.7.0:prometheus_client_golang/vendor/github.com/prometheus/client_golang \
+		prometheus:client_model:v0.2.0:prometheus_client_model/vendor/github.com/prometheus/client_model \
+		prometheus:common:v0.15.0:prometheus_common/vendor/github.com/prometheus/common \
+		prometheus:exporter-toolkit:v0.5.1:prometheus_exporter_toolkit/vendor/github.com/prometheus/exporter-toolkit \
+		prometheus:procfs:v0.6.0:prometheus_procfs/vendor/github.com/prometheus/procfs \
+		uber-go:zap:v1.16.0:uber_go_zap/vendor/go.uber.org/zap \
+		thedevsaddam:gojsonq:v2.5.2:thedevsaddam_gojsonq_v2/vendor/github.com/thedevsaddam/gojsonq/v2 \
+		golang:net:4c5254603344:golang_net/vendor/golang.org/x/net \
+		cespare:xxhash:v2.1.1:cespare_xxhash_v2/vendor/github.com/cespare/xxhash/v2 \
+		golang:protobuf:v1.4.2:protobuf/vendor/github.com/golang/protobuf \
+		golang:crypto:5f87f3452ae9:crypto/vendor/golang.org/x/crypto \
+		uber-go:atomic:v1.6.0:uber_go_atomic/vendor/go.uber.org/atomic \
+		uber-go:multierr:v1.5.0:multierr/vendor/go.uber.org/multierr \
+		go-logfmt:logfmt:v0.5.0:go_logfmt_logfmt/vendor/github.com/go-logfmt/logfmt \
+		matttproud:golang_protobuf_extensions:v1.0.1:extensions/vendor/github.com/matttproud/golang_protobuf_extensions \
+		mwitkow:go-conntrack:2f068394615f:mwitkow_go_conntrack/vendor/github.com/mwitkow/go-conntrack \
+		golang:sys:47abb6519492:golang_sys/vendor/golang.org/x/sys \
+		golang:text:v0.3.2:golang_text/vendor/golang.org/x/text \
+		jpillora:backoff:v1.0.0:jpillora_backoff/vendor/github.com/jpillora/backoff \
+		protocolbuffers:protobuf-go:v1.23.0:protocolbuffers_protobuf_go/vendor/google.golang.org/protobuf
+
+GO_TARGET=	./cmd:${PORTNAME}
+
+post-extract:
+	@${MKDIR} ${GO_WRKSRC:H}
+	@${LN} -sf ${WRKSRC} ${GO_WRKSRC}
+	@${MKDIR} ${WRKSRC}/vendor/github.com/hikhvar/mqtt2prometheus/
+	@${LN} -s ${WRKSRC}/pkg ${WRKSRC}/vendor/github.com/hikhvar/mqtt2prometheus/pkg
+
+post-install:
+	${MKDIR} ${STAGEDIR}${PREFIX}/etc/mqtt2prometheus/
+	${INSTALL_DATA} ${WRKSRC}/config.yaml.dist ${STAGEDIR}${PREFIX}/etc/mqtt2prometheus/
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/mqtt2prometheus/distinfo b/net-mgmt/mqtt2prometheus/distinfo
new file mode 100644
index 000000000000..54eec49f99f2
--- /dev/null
+++ b/net-mgmt/mqtt2prometheus/distinfo
@@ -0,0 +1,57 @@
+TIMESTAMP = 1651494981
+SHA256 (hikhvar-mqtt2prometheus-v0.1.6_GH0.tar.gz) = 61b046469b76411641d4fcb4d56ac29b4e86b4374111da60b988de91267df848
+SIZE (hikhvar-mqtt2prometheus-v0.1.6_GH0.tar.gz) = 59608
+SHA256 (beorn7-perks-v1.0.1_GH0.tar.gz) = 98db84bb0224a26094e6adba91b7ee7a1a7ace28cb648d818f8e779e6a19f825
+SIZE (beorn7-perks-v1.0.1_GH0.tar.gz) = 10867
+SHA256 (eclipse-paho.mqtt.golang-v1.3.5_GH0.tar.gz) = 9cfb8872e5f6347ec5e669791f28339a9f404f65ec7ad6bee341ce5b399065b9
+SIZE (eclipse-paho.mqtt.golang-v1.3.5_GH0.tar.gz) = 95927
+SHA256 (go-kit-kit-v0.10.0_GH0.tar.gz) = c0fac2e37b981e4c18e4f210b92e1393bd59dadd7c7fc043ec46d1c9834eba85
+SIZE (go-kit-kit-v0.10.0_GH0.tar.gz) = 274801
+SHA256 (go-yaml-yaml-v2.4.0_GH0.tar.gz) = d8e94679e5fff6bd1a35e10241543929a5f3da44f701755babf99b3daf0faac0
+SIZE (go-yaml-yaml-v2.4.0_GH0.tar.gz) = 73209
+SHA256 (gorilla-websocket-v1.4.2_GH0.tar.gz) = 91937a36bc9e0da3c895c73d4cb74b2cdb1aff54ab21b0d0724000e7b5b85b84
+SIZE (gorilla-websocket-v1.4.2_GH0.tar.gz) = 54101
+SHA256 (patrickmn-go-cache-v2.1.0_GH0.tar.gz) = 3ab025f2f580f8818a5357db52596fef1b0ad5945816a022c8b805ba46dc93be
+SIZE (patrickmn-go-cache-v2.1.0_GH0.tar.gz) = 13572
+SHA256 (pkg-errors-v0.9.1_GH0.tar.gz) = 56bfd893023daa498508bfe161de1be83299fcf15376035e7df79cbd7d6fa608
+SIZE (pkg-errors-v0.9.1_GH0.tar.gz) = 13415
+SHA256 (prometheus-client_golang-v1.7.0_GH0.tar.gz) = 580946814972dd8df686ea8ac034aa2f009c13f69d67c923f5d9de0b09ae9743
+SIZE (prometheus-client_golang-v1.7.0_GH0.tar.gz) = 159940
+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.15.0_GH0.tar.gz) = f0957de56c09431076239d27bb85e07841bb832d0c99210087bc6da63a0b2cb6
+SIZE (prometheus-common-v0.15.0_GH0.tar.gz) = 124369
+SHA256 (prometheus-exporter-toolkit-v0.5.1_GH0.tar.gz) = 721740ad90ac0d32e51c94d05b67a276cbed2c138e9af16587f98e8664750220
+SIZE (prometheus-exporter-toolkit-v0.5.1_GH0.tar.gz) = 50475
+SHA256 (prometheus-procfs-v0.6.0_GH0.tar.gz) = 6ad7a23cf4db9fa5dbf2c5d8fbd0fbf5ffe48e3ddb7bf15f9359813d764ce73c
+SIZE (prometheus-procfs-v0.6.0_GH0.tar.gz) = 169898
+SHA256 (uber-go-zap-v1.16.0_GH0.tar.gz) = 098ceed0ab0aea975c1b816f222ac815b3c6a60940329f914709c47a4edda4f7
+SIZE (uber-go-zap-v1.16.0_GH0.tar.gz) = 131768
+SHA256 (thedevsaddam-gojsonq-v2.5.2_GH0.tar.gz) = e6fc5f519e7b72e63e1408c55db1abbf8abce9d53b46a09d5948fb7ff6d761c5
+SIZE (thedevsaddam-gojsonq-v2.5.2_GH0.tar.gz) = 141251
+SHA256 (golang-net-4c5254603344_GH0.tar.gz) = 5957e628f2676d9e6c9517890bdcec334e8cac53d0f000b42ed6364a0550e152
+SIZE (golang-net-4c5254603344_GH0.tar.gz) = 1177478
+SHA256 (cespare-xxhash-v2.1.1_GH0.tar.gz) = 0ee31178d2c5a1249be4e26294a2f428008dc4e1ecbbfbe47f74e41026df1148
+SIZE (cespare-xxhash-v2.1.1_GH0.tar.gz) = 9292
+SHA256 (golang-protobuf-v1.4.2_GH0.tar.gz) = a1e486b3ed6f502c43e10cb28bde4e8f020a420ef9958d3fbe61801492c07c87
+SIZE (golang-protobuf-v1.4.2_GH0.tar.gz) = 171778
+SHA256 (golang-crypto-5f87f3452ae9_GH0.tar.gz) = 8e905a4ce396416a8c8afd8075b93da404f77a9ec1475ad2814d289a1e21a0ee
+SIZE (golang-crypto-5f87f3452ae9_GH0.tar.gz) = 1721681
+SHA256 (uber-go-atomic-v1.6.0_GH0.tar.gz) = 34abb632809f28d4106660d0211dfa624968c4d021717a2e16e1c6bf2606f34a
+SIZE (uber-go-atomic-v1.6.0_GH0.tar.gz) = 9678
+SHA256 (uber-go-multierr-v1.5.0_GH0.tar.gz) = 15fdd69d5f35e1c5c472d02b58fe3e229795d930398f9017c6c43a108504eaf1
+SIZE (uber-go-multierr-v1.5.0_GH0.tar.gz) = 12336
+SHA256 (go-logfmt-logfmt-v0.5.0_GH0.tar.gz) = 76727000951c187d058289d8e83d3e2ad480a5d44c7c83b025b78b7eb6bf0258
+SIZE (go-logfmt-logfmt-v0.5.0_GH0.tar.gz) = 11745
+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 (mwitkow-go-conntrack-2f068394615f_GH0.tar.gz) = 5bb72eaf9a4ffd7d0353fa6944951d244df89d879ac36d4b9860fd159162dd81
+SIZE (mwitkow-go-conntrack-2f068394615f_GH0.tar.gz) = 17140
+SHA256 (golang-sys-47abb6519492_GH0.tar.gz) = c52177674b0381f88e1ec97ba6dac5e8cac3f1b1fe159c0c30d01d87015090c9
+SIZE (golang-sys-47abb6519492_GH0.tar.gz) = 1218592
+SHA256 (golang-text-v0.3.2_GH0.tar.gz) = 0b9309698f5708531c5377ab1e29b423a6d9e20c55a8d386c3b8283428212f22
+SIZE (golang-text-v0.3.2_GH0.tar.gz) = 7168069
+SHA256 (jpillora-backoff-v1.0.0_GH0.tar.gz) = 611b29ce95acfa2997e3449762a3df68fcaa773db045535f26eb5c686106351f
+SIZE (jpillora-backoff-v1.0.0_GH0.tar.gz) = 3507
+SHA256 (protocolbuffers-protobuf-go-v1.23.0_GH0.tar.gz) = e7266bedaa4f110216fce52ae533dc5eba475d3829bb0592e8876684e202ae1f
+SIZE (protocolbuffers-protobuf-go-v1.23.0_GH0.tar.gz) = 1214648
diff --git a/net-mgmt/mqtt2prometheus/pkg-descr b/net-mgmt/mqtt2prometheus/pkg-descr
new file mode 100644
index 000000000000..9bf229d970bf
--- /dev/null
+++ b/net-mgmt/mqtt2prometheus/pkg-descr
@@ -0,0 +1,11 @@
+This exporter translates from MQTT topics to prometheus metrics.
+The core design is that clients send arbitrary JSON messages on the topics.
+The translation between the MQTT representation and prometheus metrics is
+configured in the mqtt2prometheus exporter since we often can not change
+the IoT devices sending the messages.
+Clients can push metrics via MQTT to an MQTT Broker.
+This exporter subscribes to the broker and expose the received messages
+as prometheus metrics.
+Currently, the exporter supports only MQTT 3.1.
+
+WWW: https://github.com/hikhvar/mqtt2prometheus/
diff --git a/net-mgmt/mqtt2prometheus/pkg-plist b/net-mgmt/mqtt2prometheus/pkg-plist
new file mode 100644
index 000000000000..fa14c64345ae
--- /dev/null
+++ b/net-mgmt/mqtt2prometheus/pkg-plist
@@ -0,0 +1,2 @@
+bin/mqtt2prometheus
+@sample %%ETCDIR%%/config.yaml.dist %%ETCDIR%%/config.yaml