1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-12 03:00:28 +00:00

Unbound_exporter connects to Unbounds TLS control socket and sends the

stats_noreset command, causing Unbound to return metrics as key-value
pairs. The metrics exporter converts Unbound metric names to Prometheus
metric names and labels by using a set of regular expressions.

WWW: https://github.com/kumina/unbound_exporter

PR:		218197
Submitted by:	Athanasios Douitsis <aduitsis@cpan.org>
This commit is contained in:
Boris Samorodov 2017-07-17 22:26:33 +00:00
parent 948534935c
commit 085c30c7d0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=446121
5 changed files with 146 additions and 0 deletions

View File

@ -349,6 +349,7 @@
SUBDIR += telegraf
SUBDIR += tornova
SUBDIR += torrus
SUBDIR += unbound_exporter
SUBDIR += unifi5
SUBDIR += victorops-nagios
SUBDIR += vidalia

View File

@ -0,0 +1,53 @@
# Created by: Athanasios Douitsis <aduitsis@cpan.org>
# $FreeBSD$
PORTNAME= unbound_exporter
PORTVERSION= 0.1
DISTVERSIONPREFIX= v
CATEGORIES= net-mgmt
MAINTAINER= aduitsis@cpan.org
COMMENT= Prometheus metrics exporter for the Unbound DNS resolver
LICENSE= APACHE20
USES= go
GH_ACCOUNT= kumina
USE_GITHUB= yes
GH_TUPLE= prometheus:client_golang:08fd2e1:client_golang \
prometheus:client_model:6f38060:client_model \
prometheus:common:49fee29:common \
prometheus:procfs:a1dba9c:procfs \
beorn7:perks:4c0e845:perks \
golang:protobuf:2bba060:protobuf \
matttproud:golang_protobuf_extensions:c12348c:extensions
GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME}
USE_RC_SUBR= unbound_exporter
USERS= unbound
GROUPS= unbound
STRIP=
PLIST_FILES= bin/unbound_exporter
pre-build:
echo ${WRKSRC_client_golang}
${MKDIR} ${GO_WRKDIR_SRC}/github.com/prometheus
${MKDIR} ${GO_WRKDIR_SRC}/github.com/beorn7
${MKDIR} ${GO_WRKDIR_SRC}/github.com/golang
${MKDIR} ${GO_WRKDIR_SRC}/github.com/matttproud
${MV} ${WRKSRC_client_golang} ${GO_WRKDIR_SRC}/github.com/prometheus/client_golang
${MV} ${WRKSRC_client_model} ${GO_WRKDIR_SRC}/github.com/prometheus/client_model
${MV} ${WRKSRC_common} ${GO_WRKDIR_SRC}/github.com/prometheus/common
${MV} ${WRKSRC_procfs} ${GO_WRKDIR_SRC}/github.com/prometheus/procfs
${MV} ${WRKSRC_perks} ${GO_WRKDIR_SRC}/github.com/beorn7/perks
${MV} ${WRKSRC_protobuf} ${GO_WRKDIR_SRC}/github.com/golang/protobuf
${MV} ${WRKSRC_extensions} ${GO_WRKDIR_SRC}/github.com/matttproud/golang_protobuf_extensions
do-install:
${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/unbound_exporter ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

View File

@ -0,0 +1,17 @@
TIMESTAMP = 1491608926
SHA256 (kumina-unbound_exporter-v0.1_GH0.tar.gz) = 13e3517cf06dbdea0239ff55193b6ff82f9f279b68ecbd53b889b505c7834386
SIZE (kumina-unbound_exporter-v0.1_GH0.tar.gz) = 7415
SHA256 (prometheus-client_golang-08fd2e1_GH0.tar.gz) = e82b53d03a2439b3c645dc9f4fb250a626c5307e41a8ac67b68ee4ade7278c6e
SIZE (prometheus-client_golang-08fd2e1_GH0.tar.gz) = 83314
SHA256 (prometheus-client_model-6f38060_GH0.tar.gz) = 6b4cc049a4588d8e93b7acf6cffa6a53034d5410128ae3752263f2bacf9e606c
SIZE (prometheus-client_model-6f38060_GH0.tar.gz) = 54645
SHA256 (prometheus-common-49fee29_GH0.tar.gz) = c38dd9ce34f65921f8e7604e6be471f4a49626b63e7312db21f98d65085a7be6
SIZE (prometheus-common-49fee29_GH0.tar.gz) = 59151
SHA256 (prometheus-procfs-a1dba9c_GH0.tar.gz) = 1702ef1142513b687bd544962828432f88195e12bbb079cbd68670b00c3e2d18
SIZE (prometheus-procfs-a1dba9c_GH0.tar.gz) = 31615
SHA256 (beorn7-perks-4c0e845_GH0.tar.gz) = 2d0c7784d2695b09c87710bc8c3c3d5b88ffeece31a650ed901763d215615478
SIZE (beorn7-perks-4c0e845_GH0.tar.gz) = 10593
SHA256 (golang-protobuf-2bba060_GH0.tar.gz) = ae917f15fd7de724cdce087b451326e6f364a898f03dc453a912ed7918e87742
SIZE (golang-protobuf-2bba060_GH0.tar.gz) = 245284
SHA256 (matttproud-golang_protobuf_extensions-c12348c_GH0.tar.gz) = da165c9275b77a0994b815bc7d761dcb2e4799a90fe49eec08d8bdff3a683f48
SIZE (matttproud-golang_protobuf_extensions-c12348c_GH0.tar.gz) = 37200

View File

@ -0,0 +1,69 @@
#!/bin/sh
#
# $FreeBSD$
# PROVIDE: unbound_exporter
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# unbound_exporter_enable (bool): Set to NO by default
# Set it to YES to enable unbound_exporter
# unbound_exporter_user (string): Set user to run unbound_exporter
# Default is "%%USERS%%"
# unbound_exporter_group (string): Set group to run unbound_exporter
# Default is "%%GROUPS%%"
# unbound_exporter_log_file (string): Set file that unbound_exporter will log to
# Default is "/var/log/unbound_exporter.log"
# unbound_exporter_ca (string): Set unbound ca filename
# Default is /usr/local/etc/unbound/unbound_server.pem
# unbound_exporter_cert (string): Set unbound control cert filename
# Default is /usr/local/etc/unbound/unbound_control.pem
# unbound_exporter_key (string): Set unbound control key filename
# Default is /usr/local/etc/unbound/unbound_control.key
# unbound_exporter_bind (string): Set address to listen on
# Default is :9167
# unbound_exporter_args (string): Set additional command line arguments
# Default is ""
. /etc/rc.subr
name=unbound_exporter
rcvar=unbound_exporter_enable
load_rc_config $name
: ${unbound_exporter_enable:=NO}
: ${unbound_exporter_user:=unbound}
: ${unbound_exporter_group:=unbound}
: ${unbound_exporter_log_file=/var/log/unbound_exporter.log}
: ${unbound_exporter_ca=%%PREFIX%%/etc/unbound/unbound_server.pem}
: ${unbound_exporter_cert=%%PREFIX%%/etc/unbound/unbound_control.pem}
: ${unbound_exporter_key=%%PREFIX%%/etc/unbound/unbound_control.key}
: ${unbound_exporter_bind=:9167}
pidfile=/var/run/unbound_exporter.pid
command=/usr/sbin/daemon
procname="%%PREFIX%%/bin/unbound_exporter"
command_args="-p ${pidfile} /usr/bin/env ${procname} \
-unbound.ca ${unbound_exporter_ca} \
-unbound.cert ${unbound_exporter_cert} \
-unbound.key ${unbound_exporter_key} \
-web.listen-address ${unbound_exporter_bind} \
${unbound_exporter_args} > ${unbound_exporter_log_file} 2>&1"
start_precmd=unbound_exporter_startprecmd
unbound_exporter_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${unbound_exporter_user} -g ${unbound_exporter_group} /dev/null ${pidfile};
fi
if [ ! -f "${unbound_exporter_log_file}" ]; then
install -o ${unbound_exporter_user} -g ${unbound_exporter_group} -m 640 /dev/null ${unbound_exporter_log_file};
fi
}
run_rc_command "$1"

View File

@ -0,0 +1,6 @@
Unbound_exporter connects to Unbounds TLS control socket and sends the
stats_noreset command, causing Unbound to return metrics as key-value
pairs. The metrics exporter converts Unbound metric names to Prometheus
metric names and labels by using a set of regular expressions.
WWW: https://github.com/kumina/unbound_exporter