git: 0263ada87bdd - main - net-mgmt/smartctl_exporter: New port.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 Jan 2023 07:18:13 UTC
The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/ports/commit/?id=0263ada87bdd51f921c742622baa4671a647953d commit 0263ada87bdd51f921c742622baa4671a647953d Author: Xin LI <delphij@FreeBSD.org> AuthorDate: 2023-01-30 07:18:07 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2023-01-30 07:18:08 +0000 net-mgmt/smartctl_exporter: New port. smartctl_exporter is an exporter that exports smartctl json statistics to Prometheus. --- net-mgmt/Makefile | 1 + net-mgmt/smartctl_exporter/Makefile | 59 ++++++++++++++++++++ net-mgmt/smartctl_exporter/distinfo | 63 ++++++++++++++++++++++ .../smartctl_exporter/files/smartctl_exporter.in | 48 +++++++++++++++++ net-mgmt/smartctl_exporter/pkg-descr | 1 + 5 files changed, 172 insertions(+) diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile index 344dc99a3b50..9b43d56e4087 100644 --- a/net-mgmt/Makefile +++ b/net-mgmt/Makefile @@ -373,6 +373,7 @@ SUBDIR += sendip SUBDIR += sipcalc SUBDIR += sjitter + SUBDIR += smartctl_exporter SUBDIR += smokeping SUBDIR += snmp4nagios SUBDIR += snmptt diff --git a/net-mgmt/smartctl_exporter/Makefile b/net-mgmt/smartctl_exporter/Makefile new file mode 100644 index 000000000000..ccf1270ee0fb --- /dev/null +++ b/net-mgmt/smartctl_exporter/Makefile @@ -0,0 +1,59 @@ +PORTNAME= smartctl_exporter +PORTVERSION= 0.9.1 +DISTVERSIONPREFIX= v +CATEGORIES= net-mgmt + +MAINTAINER= delphij@FreeBSD.org +COMMENT= Prometheus metrics exporter for smartctl +WWW= https://github.com/prometheus-community/smartctl_exporter + +LICENSE= LGPL3 + +USES= go:modules +USE_GITHUB= yes +GH_ACCOUNT= prometheus-community + +USE_RC_SUBR= smartctl_exporter +RUN_DEPENDS+= smartctl:sysutils/smartmontools +GO_MODULES= github.com/prometheus-community/smartctl_exporter +GO_TARGET= ${PORTNAME}:${PREFIX}/libexec/${PORTNAME} +PLIST_FILES= libexec/${PORTNAME} + +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:b94a6e3cc137:alecthomas_units/vendor/github.com/alecthomas/units \ + beorn7:perks:v1.0.1:beorn7_perks/vendor/github.com/beorn7/perks \ + cespare:xxhash:v2.1.2:cespare_xxhash_v2/vendor/github.com/cespare/xxhash/v2 \ + coreos:go-systemd:v22.4.0:coreos_go_systemd_v22/vendor/github.com/coreos/go-systemd/v22 \ + go-kit:log:v0.2.1:go_kit_log/vendor/github.com/go-kit/log \ + go-logfmt:logfmt:v0.5.1:go_logfmt_logfmt/vendor/github.com/go-logfmt/logfmt \ + go-yaml:yaml:v2.4.0:go_yaml_yaml/vendor/gopkg.in/yaml.v2 \ + go-yaml:yaml:v3.0.1:go_yaml_yaml_1/vendor/gopkg.in/yaml.v3 \ + golang:appengine:v1.6.7:golang_appengine/vendor/google.golang.org/appengine \ + golang:crypto:v0.1.0:golang_crypto/vendor/golang.org/x/crypto \ + golang:net:v0.1.0:golang_net/vendor/golang.org/x/net \ + golang:oauth2:v0.1.0:golang_oauth2/vendor/golang.org/x/oauth2 \ + golang:protobuf:v1.5.2:golang_protobuf/vendor/github.com/golang/protobuf \ + golang:sync:v0.1.0:golang_sync/vendor/golang.org/x/sync \ + golang:sys:v0.1.0:golang_sys/vendor/golang.org/x/sys \ + golang:text:v0.4.0:golang_text/vendor/golang.org/x/text \ + jpillora:backoff:v1.0.0:jpillora_backoff/vendor/github.com/jpillora/backoff \ + matttproud:golang_protobuf_extensions:v1.0.1:matttproud_golang_protobuf_extensions/vendor/github.com/matttproud/golang_protobuf_extensions \ + mwitkow:go-conntrack:2f068394615f:mwitkow_go_conntrack/vendor/github.com/mwitkow/go-conntrack \ + prometheus:client_golang:v1.13.1: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.37.0:prometheus_common/vendor/github.com/prometheus/common \ + prometheus:exporter-toolkit:v0.8.1:prometheus_exporter_toolkit/vendor/github.com/prometheus/exporter-toolkit \ + prometheus:procfs:v0.8.0:prometheus_procfs/vendor/github.com/prometheus/procfs \ + protocolbuffers:protobuf-go:v1.28.1:protocolbuffers_protobuf_go/vendor/google.golang.org/protobuf \ + tidwall:gjson:v1.14.3:tidwall_gjson/vendor/github.com/tidwall/gjson \ + tidwall:match:v1.1.1:tidwall_match/vendor/github.com/tidwall/match \ + tidwall:pretty:v1.2.0:tidwall_pretty/vendor/github.com/tidwall/pretty + +pre-patch: + ${REINPLACE_CMD} -i '' -e 's|/usr/sbin/smartctl|${LOCALBASE}/sbin/smartctl|g' \ + ${WRKSRC}/README.md ${WRKSRC}/main.go \ + ${WRKSRC}/gentoo/app-metrics/smartctl_exporter/files/smartctl_exporter.yaml + +.include <bsd.port.mk> diff --git a/net-mgmt/smartctl_exporter/distinfo b/net-mgmt/smartctl_exporter/distinfo new file mode 100644 index 000000000000..69e7abb75f28 --- /dev/null +++ b/net-mgmt/smartctl_exporter/distinfo @@ -0,0 +1,63 @@ +TIMESTAMP = 1674106190 +SHA256 (prometheus-community-smartctl_exporter-v0.9.1_GH0.tar.gz) = 1a65c6f5fd17f3e905d314ac48e387888c7eb656a19a7fafae88fbcdd5cf399a +SIZE (prometheus-community-smartctl_exporter-v0.9.1_GH0.tar.gz) = 41276 +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-b94a6e3cc137_GH0.tar.gz) = 85363142a53436bea696d297e5b5fcda6bc6a8104b1d7ba0db88ffee455b72e2 +SIZE (alecthomas-units-b94a6e3cc137_GH0.tar.gz) = 6012 +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.2_GH0.tar.gz) = 471399cfcf0b1bd188add8d34435b91e7011cedbfe76e29687803a9d74320352 +SIZE (cespare-xxhash-v2.1.2_GH0.tar.gz) = 11244 +SHA256 (coreos-go-systemd-v22.4.0_GH0.tar.gz) = a3ca62e2344ba0f6cb0df4cb0c6ffb62c3e24f894844fe87cfacdea6460129c3 +SIZE (coreos-go-systemd-v22.4.0_GH0.tar.gz) = 73248 +SHA256 (go-kit-log-v0.2.1_GH0.tar.gz) = b37718967f9cbdb3eea4aa2fa9420b7d329b6bab7f9b85f970db197257226152 +SIZE (go-kit-log-v0.2.1_GH0.tar.gz) = 30579 +SHA256 (go-logfmt-logfmt-v0.5.1_GH0.tar.gz) = a9a93f7cbb92a53a587fda196bc040264a625e76064495e95cb3e907f9a93499 +SIZE (go-logfmt-logfmt-v0.5.1_GH0.tar.gz) = 12115 +SHA256 (go-yaml-yaml-v2.4.0_GH0.tar.gz) = d8e94679e5fff6bd1a35e10241543929a5f3da44f701755babf99b3daf0faac0 +SIZE (go-yaml-yaml-v2.4.0_GH0.tar.gz) = 73209 +SHA256 (go-yaml-yaml-v3.0.1_GH0.tar.gz) = cf05411540d3e6ef8f1fd88434b34f94cedaceb540329031d80e23b74540c4e5 +SIZE (go-yaml-yaml-v3.0.1_GH0.tar.gz) = 91173 +SHA256 (golang-appengine-v1.6.7_GH0.tar.gz) = c623d81235f7c9699e299b328191d813337dd57dcc800d7afdb5130e8c321a8f +SIZE (golang-appengine-v1.6.7_GH0.tar.gz) = 333007 +SHA256 (golang-crypto-v0.1.0_GH0.tar.gz) = 46d11e87a4df7825186ac5e4d6ac70959411906e899bcf261b2775e52a57c5b7 +SIZE (golang-crypto-v0.1.0_GH0.tar.gz) = 1633075 +SHA256 (golang-net-v0.1.0_GH0.tar.gz) = 084d67e34b660f3ea4f156d37b8baa04a8af30cfb4358eea9b7920af2e7808b1 +SIZE (golang-net-v0.1.0_GH0.tar.gz) = 1239627 +SHA256 (golang-oauth2-v0.1.0_GH0.tar.gz) = 03ed08fa2aafb581514af40375f5c2485859735f3f18220530fa70114469ae68 +SIZE (golang-oauth2-v0.1.0_GH0.tar.gz) = 104824 +SHA256 (golang-protobuf-v1.5.2_GH0.tar.gz) = 088cc0f3ba18fb8f9d00319568ff0af5a06d8925a6e6cb983bb837b4efb703b3 +SIZE (golang-protobuf-v1.5.2_GH0.tar.gz) = 171702 +SHA256 (golang-sync-v0.1.0_GH0.tar.gz) = 81056c07b5dc1077f2d6ac0f7ce3d4ef199a3ff85c319ab03dcff22fa9ba2183 +SIZE (golang-sync-v0.1.0_GH0.tar.gz) = 19356 +SHA256 (golang-sys-v0.1.0_GH0.tar.gz) = f36f3ce1a3adf2d9acc9dfff112a98c695ab320ae696ee6ffafe1608b0caff73 +SIZE (golang-sys-v0.1.0_GH0.tar.gz) = 1409774 +SHA256 (golang-text-v0.4.0_GH0.tar.gz) = 71988b75b6da29772aa1feb65727aa7de3698d2f718f9ea073cd3613e280f5f5 +SIZE (golang-text-v0.4.0_GH0.tar.gz) = 8361656 +SHA256 (jpillora-backoff-v1.0.0_GH0.tar.gz) = 611b29ce95acfa2997e3449762a3df68fcaa773db045535f26eb5c686106351f +SIZE (jpillora-backoff-v1.0.0_GH0.tar.gz) = 3507 +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 (prometheus-client_golang-v1.13.1_GH0.tar.gz) = 4c19032fb90f4c866f80ef72a452e6a5a7b2c8b848bb7632118bc0dc51cd0629 +SIZE (prometheus-client_golang-v1.13.1_GH0.tar.gz) = 219545 +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.37.0_GH0.tar.gz) = 0ad5a62cb421952d92c97645d2aba8987d2a0de44c9c1fff607c016dca87b768 +SIZE (prometheus-common-v0.37.0_GH0.tar.gz) = 148934 +SHA256 (prometheus-exporter-toolkit-v0.8.1_GH0.tar.gz) = 2a939c6e1b6374da21def4eb8ab04021c8d524da5683515b4afb778dd677ec97 +SIZE (prometheus-exporter-toolkit-v0.8.1_GH0.tar.gz) = 62005 +SHA256 (prometheus-procfs-v0.8.0_GH0.tar.gz) = bb99fc8ee03c40374bd2f78b7907f1353bd57bd34fd080a9664d99983f24aeed +SIZE (prometheus-procfs-v0.8.0_GH0.tar.gz) = 194809 +SHA256 (protocolbuffers-protobuf-go-v1.28.1_GH0.tar.gz) = df0b3dceeff0e1b6d029e60f076edd0d852cb8f3c2fe4fe3fe40164f16ec9b6b +SIZE (protocolbuffers-protobuf-go-v1.28.1_GH0.tar.gz) = 1280756 +SHA256 (tidwall-gjson-v1.14.3_GH0.tar.gz) = 652d6427185c488d3612e4c0dabb186c7b2f9014f1b58f09fd5b5205db89e818 +SIZE (tidwall-gjson-v1.14.3_GH0.tar.gz) = 58414 +SHA256 (tidwall-match-v1.1.1_GH0.tar.gz) = 1fc2ff17ecdd82c7ba739b4f373b9df731a8e42517c70285c8bbf24dd9b3f2f0 +SIZE (tidwall-match-v1.1.1_GH0.tar.gz) = 5931 +SHA256 (tidwall-pretty-v1.2.0_GH0.tar.gz) = fda514a386aff71cf7a4639a8fb8e1133bf8f583eba902b3c844a176401fad7d +SIZE (tidwall-pretty-v1.2.0_GH0.tar.gz) = 11224 diff --git a/net-mgmt/smartctl_exporter/files/smartctl_exporter.in b/net-mgmt/smartctl_exporter/files/smartctl_exporter.in new file mode 100644 index 000000000000..255d01c78134 --- /dev/null +++ b/net-mgmt/smartctl_exporter/files/smartctl_exporter.in @@ -0,0 +1,48 @@ +#!/bin/sh + +# PROVIDE: smartctl_exporter +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# smartctl_exporter_enable (bool): Set to YES to enable smartctl_exporter, default is NO +# smartctl_exporter_user (string): Set user to run as, default is root +# smartctl_exporter_syslog (bool): Set to YES to use syslog, default is NO +# +# Use the following variables to override smartctl_exporter's defaults: +# +# smartctl_exporter_listen_address (string): Set address to listen on, default is localhost:9633 +# smartctl_exporter_devices (string): Shell glob (like /dev/ada[0-9]) for all devices +# smartctl_exporter_log_level (string): Only log messages with the given severity or above. One of: [debug, info, warn, error] +# smartctl_exporter_log_format (string): Output format of log messages. One of: [logfmt, json] + +. /etc/rc.subr + +name=smartctl_exporter +rcvar=smartctl_exporter_enable + +load_rc_config $name + +: ${smartctl_exporter_enable:="NO"} +: ${smartctl_exporter_user:="root"} +: ${smartctl_exporter_listen_address:="localhost:9633"} +: ${smartctl_exporter_devices:="$(geom disk status -s | cut -f1 -d\ | sed -e s,^,/dev/,g)"} +: ${smartctl_exporter_log_level:=""} +: ${smartctl_exporter_log_format:=""} + +pidfile=/var/run/smartctl_exporter.pid +command=/usr/sbin/daemon +command_args="-c -f -P ${pidfile} \ + ${smartctl_exporter_user:+-u "${smartctl_exporter_user}"} \ + ${smartctl_exporter_syslog:+-S} \ + ${smartctl_exporter_daemon} \ + %%PREFIX%%/libexec/smartctl_exporter \ + ${smartctl_exporter_listen_address:+--web.listen-address="${smartctl_exporter_listen_address}"} \ + ${smartctl_exporter_devices:+$(for diskdev in $(echo "${smartctl_exporter_devices}"); do echo --smartctl.device="${diskdev}"; done | xargs )} \ + ${smartctl_exporter_log_level:+--log.level="${smartctl_exporter_log_level}"} \ + ${smartctl_exporter_log_format:+--log.format="${smartctl_exporter_log_format}"} \ + ${smartctl_exporter_args}" + +run_rc_command "$1" diff --git a/net-mgmt/smartctl_exporter/pkg-descr b/net-mgmt/smartctl_exporter/pkg-descr new file mode 100644 index 000000000000..b726652209df --- /dev/null +++ b/net-mgmt/smartctl_exporter/pkg-descr @@ -0,0 +1 @@ +smartctl_exporter exports smartctl json metrics to Prometheus.