From nobody Wed Dec 28 16:31:31 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NhxqR6ZwTz2cL08; Wed, 28 Dec 2022 16:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NhxqR5cKqz3pLj; Wed, 28 Dec 2022 16:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672245091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c3McOtksyEtnzjQ3VjFqEJqzNyBid4zO1+niBmsQ30g=; b=Q2kjdQWreHd8Gssgy6ptYhquz0gnmNAwyXX15PWMnhACvu2OhsoGb1JE3HaCpl1tRNbS8G uQh3jov6v7xqNYHIMxdqdt1CCMC6Rw42RXMhkkduZdYKG8iWDzXBxWu+Vk9tOjJOYqSpQr uatKRNJSO+SZSuwfmmPF94cJn5qhTtSSIBBTmwFnEPAwClwyVcEmT1xTTn+X4QdDM6Rirk XIDJl/s/M39tNzMw+fudt2UrcA2WFGTN0B6SRSuXN+Gyjk2R0LgLmsSmdFdJoNoLdzzyLB 5EZnbYZr3kR37DVT1i+qI9W2XHGrSkG2LKQ3yqLyteIsS2GAzcAKYcRCg9Madg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672245091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c3McOtksyEtnzjQ3VjFqEJqzNyBid4zO1+niBmsQ30g=; b=AL9cBA+8K0o0kfnC9rReR1ySMg8Gn0K7AZE+YmbbhL7xLfqI7jY+PUF3Q5s3Sfi16OH7Wn yOtdIpnTy6Lo7BiGc/X8RNtjdi59rx7mb25YsIimhOW6XF9AcMs8DUit77giOEspP3ly9Q Vy8MXEg8P0lpRBD1SnZchg6M4CvCrXhSsGjE2VQ+UbdDVU4FomMJIWj4xAWDbJZ0EHbRk1 NhqF0lIwrA6sq4VwZpteH/ONfnFuvYAzT7ohM+7Jd6bgj73lk2RTXo5UO74NNNTRldpUlI ExJwpEhc8h4kqC00gsxBx/PK+xCRMSm2zJaW+2Ns02StaieWDgSHdmJbCcwb3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672245091; a=rsa-sha256; cv=none; b=NyFFnriMx5E35fJENGO1Y+qND0lXYRjkbkaxCuRQ4b1i2dYGWt1s5Y8R8NviPTPiyv3nXr +vTS/Gd8rTa3Uc4Gh4Yf2fo4+74k7qfYZyUek/rPBZbrEFu/tZ0jdK4Gf+7t0m3dVxo8ka 9wqp/g1QYRoyhiPVitEf5As18pMPHAKjSFh6ZcffXfPiL6hsKUNQMoiNeFK608GUKy89fo B4aBccGq0ZAnmJ1S3X12beftYsQa2MADucjambB3H6XSCFGs6Tgzl7lSX8cANCk6yY7K+I n5GMkqivyHfa0F5BITryiH7p2CE4FG6eEVAPVHWqWhDTxWojB0jkq7yqV90eGA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NhxqR4j4lzwk3; Wed, 28 Dec 2022 16:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BSGVVwQ003186; Wed, 28 Dec 2022 16:31:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BSGVV8P003185; Wed, 28 Dec 2022 16:31:31 GMT (envelope-from git) Date: Wed, 28 Dec 2022 16:31:31 GMT Message-Id: <202212281631.2BSGVV8P003185@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Ronald Klop Subject: git: f9b0b82aa759 - main - sysutils/nut_exporter: new port List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ronald X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9b0b82aa7592800fed91b535cab58c02f911316 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ronald: URL: https://cgit.FreeBSD.org/ports/commit/?id=f9b0b82aa7592800fed91b535cab58c02f911316 commit f9b0b82aa7592800fed91b535cab58c02f911316 Author: Jony Hudson AuthorDate: 2022-12-27 14:16:26 +0000 Commit: Ronald Klop CommitDate: 2022-12-28 16:31:05 +0000 sysutils/nut_exporter: new port Add a port for https://github.com/DRuggeri/nut_exporter which is a Prometheus (net-mgmt/prometheus2) exporter for the "Network UPS tools" (sysutils/nut). PR: 267485 Approved by: pkubaj (mentor) Differential Revision: https://reviews.freebsd.org/D37883 --- sysutils/Makefile | 1 + sysutils/nut_exporter/Makefile | 38 +++++++++++++++ sysutils/nut_exporter/distinfo | 37 +++++++++++++++ sysutils/nut_exporter/files/nut_exporter.in | 73 +++++++++++++++++++++++++++++ sysutils/nut_exporter/pkg-descr | 4 ++ 5 files changed, 153 insertions(+) diff --git a/sysutils/Makefile b/sysutils/Makefile index 4cd767fcd00e..47749e02700f 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -829,6 +829,7 @@ SUBDIR += ntpstat SUBDIR += nut SUBDIR += nut-devel + SUBDIR += nut_exporter SUBDIR += nvclock SUBDIR += nvimpager SUBDIR += nvme-cli diff --git a/sysutils/nut_exporter/Makefile b/sysutils/nut_exporter/Makefile new file mode 100644 index 000000000000..8d38fa288e0a --- /dev/null +++ b/sysutils/nut_exporter/Makefile @@ -0,0 +1,38 @@ +PORTNAME= nut_exporter +DISTVERSIONPREFIX= v +DISTVERSION= 2.5.0 +CATEGORIES= sysutils + +MAINTAINER= bsd@j-star.org +COMMENT= Prometheus exporter for the Network UPS Tools server +WWW= https://github.com/DRuggeri/nut_exporter + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go:modules +USE_GITHUB= yes +GH_ACCOUNT= DRuggeri +GH_TUPLE= \ + alecthomas:kingpin:v2.2.6:alecthomas_kingpin/vendor/gopkg.in/alecthomas/kingpin.v2 \ + alecthomas:template:fb15b899a751:alecthomas_template/vendor/github.com/alecthomas/template \ + alecthomas:units:f65c72e2690d:alecthomas_units/vendor/github.com/alecthomas/units \ + beorn7:perks:v1.0.1:beorn7_perks/vendor/github.com/beorn7/perks \ + cespare:xxhash:v2.1.1:cespare_xxhash_v2/vendor/github.com/cespare/xxhash/v2 \ + go-kit:log:v0.2.0:go_kit_log/vendor/github.com/go-kit/log \ + go-logfmt:logfmt:v0.5.1:go_logfmt_logfmt/vendor/github.com/go-logfmt/logfmt \ + golang:protobuf:v1.4.3:golang_protobuf/vendor/github.com/golang/protobuf \ + golang:sys:ebe580a85c40:golang_sys/vendor/golang.org/x/sys \ + matttproud:golang_protobuf_extensions:v1.0.1:matttproud_golang_protobuf_extensions/vendor/github.com/matttproud/golang_protobuf_extensions \ + pkg:errors:v0.9.1:pkg_errors/vendor/github.com/pkg/errors \ + prometheus:client_golang:v1.11.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.32.1:prometheus_common/vendor/github.com/prometheus/common \ + prometheus:procfs:v0.6.0:prometheus_procfs/vendor/github.com/prometheus/procfs \ + protocolbuffers:protobuf-go:v1.26.0-rc.1:protocolbuffers_protobuf_go/vendor/google.golang.org/protobuf \ + robbiet480:go.nut:bd8f121e1fa1:robbiet480_go_nut/vendor/github.com/robbiet480/go.nut + +USE_RC_SUBR= nut_exporter +PLIST_FILES= bin/nut_exporter + +.include diff --git a/sysutils/nut_exporter/distinfo b/sysutils/nut_exporter/distinfo new file mode 100644 index 000000000000..9c15907679fa --- /dev/null +++ b/sysutils/nut_exporter/distinfo @@ -0,0 +1,37 @@ +TIMESTAMP = 1671310398 +SHA256 (DRuggeri-nut_exporter-v2.5.0_GH0.tar.gz) = 676591c3ea30dd716aac9697ced083d49f9bc6350cdeeb1e8e03819bebacd8a2 +SIZE (DRuggeri-nut_exporter-v2.5.0_GH0.tar.gz) = 200768 +SHA256 (alecthomas-kingpin-v2.2.6_GH0.tar.gz) = 4624eae43489de8a71ea60efaf6744c581b6bd62909f7514c484c1ea0efaba5a +SIZE (alecthomas-kingpin-v2.2.6_GH0.tar.gz) = 44383 +SHA256 (alecthomas-template-fb15b899a751_GH0.tar.gz) = 2e2a44375eca48ce941182504b5d13aa98182b9a3f64ace33bfda52208bd0f5e +SIZE (alecthomas-template-fb15b899a751_GH0.tar.gz) = 55339 +SHA256 (alecthomas-units-f65c72e2690d_GH0.tar.gz) = ece06024b01821e013bd7158dfe8ec8cc697f586ce8d3cfaa22edde8c2f022c3 +SIZE (alecthomas-units-f65c72e2690d_GH0.tar.gz) = 4925 +SHA256 (beorn7-perks-v1.0.1_GH0.tar.gz) = 98db84bb0224a26094e6adba91b7ee7a1a7ace28cb648d818f8e779e6a19f825 +SIZE (beorn7-perks-v1.0.1_GH0.tar.gz) = 10867 +SHA256 (cespare-xxhash-v2.1.1_GH0.tar.gz) = 0ee31178d2c5a1249be4e26294a2f428008dc4e1ecbbfbe47f74e41026df1148 +SIZE (cespare-xxhash-v2.1.1_GH0.tar.gz) = 9292 +SHA256 (go-kit-log-v0.2.0_GH0.tar.gz) = 5dfaf2a831debe95b84ce6e9c889a9cff162720a73fd0ab61cb151d2cc649b5c +SIZE (go-kit-log-v0.2.0_GH0.tar.gz) = 29069 +SHA256 (go-logfmt-logfmt-v0.5.1_GH0.tar.gz) = a9a93f7cbb92a53a587fda196bc040264a625e76064495e95cb3e907f9a93499 +SIZE (go-logfmt-logfmt-v0.5.1_GH0.tar.gz) = 12115 +SHA256 (golang-protobuf-v1.4.3_GH0.tar.gz) = 5736f943f8647362f5559689df6154f3c85d261fb088867c8a68494e2a767610 +SIZE (golang-protobuf-v1.4.3_GH0.tar.gz) = 171969 +SHA256 (golang-sys-ebe580a85c40_GH0.tar.gz) = b70e2301ad08c3ae255b004b8160f866798b95c0c1f88f12641343ed81ce523b +SIZE (golang-sys-ebe580a85c40_GH0.tar.gz) = 1197502 +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 (pkg-errors-v0.9.1_GH0.tar.gz) = 56bfd893023daa498508bfe161de1be83299fcf15376035e7df79cbd7d6fa608 +SIZE (pkg-errors-v0.9.1_GH0.tar.gz) = 13415 +SHA256 (prometheus-client_golang-v1.11.0_GH0.tar.gz) = a3bc3312bde4182e507042ca0e7ca88aac6656bbf8d516d732e34c3f14bb612a +SIZE (prometheus-client_golang-v1.11.0_GH0.tar.gz) = 168706 +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.32.1_GH0.tar.gz) = de06f354e24dec3bfeba9a3bd43bd3170b4231dfff3cd338b688a6e8c8050af6 +SIZE (prometheus-common-v0.32.1_GH0.tar.gz) = 146585 +SHA256 (prometheus-procfs-v0.6.0_GH0.tar.gz) = 6ad7a23cf4db9fa5dbf2c5d8fbd0fbf5ffe48e3ddb7bf15f9359813d764ce73c +SIZE (prometheus-procfs-v0.6.0_GH0.tar.gz) = 169898 +SHA256 (protocolbuffers-protobuf-go-v1.26.0-rc.1_GH0.tar.gz) = a2b3581fb291ffdfe080cc16eb7b0b13295105a441fc0554a105368b7e208e66 +SIZE (protocolbuffers-protobuf-go-v1.26.0-rc.1_GH0.tar.gz) = 1270311 +SHA256 (robbiet480-go.nut-bd8f121e1fa1_GH0.tar.gz) = 1f8427de879e5d5804292b54d97ffce5c8c5eb94669a4447380cb90a7539a64d +SIZE (robbiet480-go.nut-bd8f121e1fa1_GH0.tar.gz) = 6790 diff --git a/sysutils/nut_exporter/files/nut_exporter.in b/sysutils/nut_exporter/files/nut_exporter.in new file mode 100644 index 000000000000..ddd72731cf05 --- /dev/null +++ b/sysutils/nut_exporter/files/nut_exporter.in @@ -0,0 +1,73 @@ +#!/bin/sh + +# PROVIDE: nut_exporter +# REQUIRE: LOGIN +# KEYWORD: shutdown + +# Add the following lines to /etc/rc.conf to enable nut_exporter: +# nut_exporter_enable="YES" +# +# nut_exporter_enable (bool): +# Set it to YES to enable nut_exporter. +# Set to NO by default. +# nut_exporter_listen_address (string): +# IP address and port to listen on. +# Default is ":9199". +# nut_exporter_user (string): +# User to run as. +# Default is "www". +# nut_exporter_metrics_namespace (string): +# Metrics namespace. +# Default is "network_ups_tools". +# nut_exporter_tls_cert_file (string): +# Path to a file that contains the TLS certificate (PEM format). +# Default is "". +# nut_exporter_tls_key_file (string): +# Path to a file that contains the TLS private key (PEM format). +# Default is "". + +. /etc/rc.subr + +name=nut_exporter +rcvar=nut_exporter_enable + +load_rc_config $name + +nut_exporter_enable=${nut_exporter_enable:-"NO"} +nut_exporter_listen_address=${nut_exporter_listen_address:-":9199"} +nut_exporter_user=${nut_exporter_user:-"www"} +nut_exporter_metrics_namespace=${nut_exporter_metrics_namespace:-"network_ups_tools"} +nut_exporter_tls_cert_file=${nut_exporter_tls_cert_file:-""} +nut_exporter_tls_key_file=${nut_exporter_tls_key_file:-""} + +pidfile="/var/run/${name}/${name}.pid" + +if [ -z ${nut_exporter_tls_cert_file} ] ; then + cert_arg="" +else + cert_arg="--web.tls.cert_file=${nut_exporter_tls_cert_file}" +fi +if [ -z ${nut_exporter_tls_key_file} ] ; then + key_arg="" +else + key_arg="--web.tls.key_file=${nut_exporter_tls_key_file}" +fi + +procname=%%PREFIX%%/bin/nut_exporter +command=/usr/sbin/daemon +command_args="-p ${pidfile} -t ${name} -T ${name} ${procname} \ + --web.listen-address=${nut_exporter_listen_address} \ + --metrics.namespace=${nut_exporter_metrics_namespace} \ + ${cert_arg} ${key_arg}" + +start_precmd=start_precmd +start_precmd() +{ + if [ ! -e "/var/run/${name}" ] ; then + # Note that ownership of the pidfile determines the user daemon runs under. + install -d -o ${nut_exporter_user} /var/run/${name}; + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/sysutils/nut_exporter/pkg-descr b/sysutils/nut_exporter/pkg-descr new file mode 100644 index 000000000000..e70d77f476fb --- /dev/null +++ b/sysutils/nut_exporter/pkg-descr @@ -0,0 +1,4 @@ +A Prometheus exporter for the Network UPS Tools server. +The exporter is written in a way to permit an administrator to scrape one or +many UPS devices visible to a NUT client as well as one or all NUT variables. +A single instance of this exporter can scrape one or many NUT servers.