diff options
Diffstat (limited to 'app-metrics/prometheus-lvm-exporter')
6 files changed, 202 insertions, 0 deletions
diff --git a/app-metrics/prometheus-lvm-exporter/Manifest b/app-metrics/prometheus-lvm-exporter/Manifest new file mode 100644 index 000000000000..b944cddb2233 --- /dev/null +++ b/app-metrics/prometheus-lvm-exporter/Manifest @@ -0,0 +1,4 @@ +DIST prometheus-lvm-exporter-0.3.2-vendor.tar.xz 1390560 BLAKE2B ab6fe8febeb972bf2a65dd05c6060bb584638dc4250f221353b7fcc3714cd5f56b8ef69c36fae67103bf57d66ca8000c70212fa3f82ed54ad7bcf0eaae63c822 SHA512 e320cdbe27841f69fad201e52a6b5a9acdd919b57c7e067506e6829e3cf11936a0ab21e817dedc6fa0c277ddae891412a10565d6dac8f859669e1a37cc760e86 +DIST prometheus-lvm-exporter-0.3.2.tar.gz 60790 BLAKE2B f6b79627e9114140cab72d34744e5667e1174dd2bc720866d398d48be03067a29e03305e8a22ef4d706b2261083ec6f108e6c8578b9e717bf7915f2412b3da41 SHA512 75f3cc65fc9196faff0796e9df85ea8f7e5d15a97e7e46d635802049ad11e499bc5f0fd0b6833d1028dc23435fb8d0c2523e7333fb76e291f3ff16e297c37973 +DIST prometheus-lvm-exporter-0.3.3-deps.tar.xz 8813080 BLAKE2B 3fad55a4a57bd34ca29b27d2a3812f5e3f1bb4b2315bd9a10d4cb264cbacb13e3aa0385da117bc193cea12c9ea1245aa80e74a49339d25c7ed277cd681ff38ad SHA512 df93b13bc389d87d9d33bb637ca13af13cff02c411e4ba16159dd9be560e15b1f107c593a95ecb72f0d92ce5124439c42673562e5da5016b726512e5cd32c7f4 +DIST prometheus-lvm-exporter-0.3.3.tar.gz 47239 BLAKE2B 5e91e9a06090843f1637624bcde9dcf5af771fb03467d3c09affed20ccc7f8f565bcbd4b7cf97df3be5d06dbfaaeacf76af43b635b5e887cfaa4cfe7a601fc78 SHA512 84315d248310c4cd2e2a51e57026561beb813d4cdc621f545b8b285804ecc6faba28644e19fb2435fefe77552385f04fc1e604d543675ccc002f1984d92c8c21 diff --git a/app-metrics/prometheus-lvm-exporter/files/prometheus-lvm-exporter.confd b/app-metrics/prometheus-lvm-exporter/files/prometheus-lvm-exporter.confd new file mode 100644 index 000000000000..6bcabc1df256 --- /dev/null +++ b/app-metrics/prometheus-lvm-exporter/files/prometheus-lvm-exporter.confd @@ -0,0 +1,26 @@ +# /etc/conf.d/prometheus-lvm-exporter + +# PID file +#EXPORTER_PIDFILE="/run/${RC_SVCNAME}.pid" + +# The termination timeout (start-stop-daemon parameter "retry") ensures +# that the service will be terminated within a given time (60 + 5 seconds +# per default) when you are stopping the service. +#EXPORTER_TERMTIMEOUT="TERM/60/KILL/5" + +# User to run exporter as +#EXPORTER_USER="prometheus-lvm-exporter" + +# User group to run exporter as +#EXPORTER_GROUP="prometheus-lvm-exporter" + +# You can use this configuration option to pass additional options to the +# start-stop-daemon, see start-stop-daemon(8) for more details. +# Per default we wait 1000ms after we have started the service to ensure +# that the daemon is really up and running. +#EXPORTER_SSDARGS="--wait 1000" + +# Exporter flags +# See `prometheus-lvm-exporter --help` for more details +EXPORTER_FLAGS="--log.level=info" +#EXPORTER_FLAGS="${EXPORTER_FLAGS} --yourAdditionalFlag" diff --git a/app-metrics/prometheus-lvm-exporter/files/prometheus-lvm-exporter.initd b/app-metrics/prometheus-lvm-exporter/files/prometheus-lvm-exporter.initd new file mode 100644 index 000000000000..1fa73569ac7b --- /dev/null +++ b/app-metrics/prometheus-lvm-exporter/files/prometheus-lvm-exporter.initd @@ -0,0 +1,49 @@ +#!/sbin/openrc-run +# Copyright 2016-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Prometheus exporter for LVM metrics" + +EXPORTER_FLAGS=${EXPORTER_FLAGS:-""} +#EXPORTER_USER=${EXPORTER_USER:-"prometheus-lvm-exporter"} +#EXPORTER_GROUP=${EXPORTER_GROUP:-"prometheus-lvm-exporter"} +EXPORTER_PIDFILE=${EXPORTER_PIDFILE:-"/run/${RC_SVCNAME}.pid"} +EXPORTER_SSDARGS=${EXPORTER_SSDARGS:-"--wait 1000"} +EXPORTER_TERMTIMEOUT=${EXPORTER_TERMTIMEOUT:-"TERM/60/KILL/5"} + +command="/usr/bin/prometheus-lvm-exporter" +command_args="${EXPORTER_FLAGS}" +command_background="true" +start_stop_daemon_args="${EXPORTER_SSDARGS}" +start_stop_daemon_args="${start_stop_daemon_args} ${EXPORTER_USER:+--user }${EXPORTER_USER}" +start_stop_daemon_args="${start_stop_daemon_args} ${EXPORTER_GROUP:+--group }${EXPORTER_GROUP}" + +getconfig() { + local key="$1" + local value_default="$2" + local value= + + if service_started; then + value="$(service_get_value "${key}")" + fi + + if [ -z "${value}" ]; then + # Value not explicitly set + echo "${value_default}" + else + echo "${value}" + fi + + return 0 +} + +pidfile="$(getconfig pidfile ${EXPORTER_PIDFILE})" +retry="$(getconfig retry ${EXPORTER_TERMTIMEOUT})" + +depend() { + after net lvm lvm-monitoring +} + +start_post() { + service_set_value retry "${EXPORTER_TERMTIMEOUT}" +} diff --git a/app-metrics/prometheus-lvm-exporter/metadata.xml b/app-metrics/prometheus-lvm-exporter/metadata.xml new file mode 100644 index 000000000000..1b74e7a99779 --- /dev/null +++ b/app-metrics/prometheus-lvm-exporter/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>robbat2@gentoo.org</email> + </maintainer> + <upstream> + <remote-id type="github">hansmi/prometheus-lvm-exporter</remote-id> + </upstream> +</pkgmetadata> diff --git a/app-metrics/prometheus-lvm-exporter/prometheus-lvm-exporter-0.3.2.ebuild b/app-metrics/prometheus-lvm-exporter/prometheus-lvm-exporter-0.3.2.ebuild new file mode 100644 index 000000000000..0edb7138c79d --- /dev/null +++ b/app-metrics/prometheus-lvm-exporter/prometheus-lvm-exporter-0.3.2.ebuild @@ -0,0 +1,64 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit go-module +# uncomment the first setting of MY_PV for a normal release +# MY_PV="v${PV/_rc/-rc.}" +# set MY_PV to the full commit hash for a snapshot release +MY_PV_HASH= +HOMEPAGE="https://github.com/hansmi/prometheus-lvm-exporter" +if [[ -n "${MY_PV_HASH}" ]]; then + MY_PV=${MY_PV_HASH} + MYSQLD_EXPORTER_COMMIT=${MY_PV_HASH:0:8} + SRC_URI_UPSTREAM="${HOMEPAGE}/archive/${MY_PV}.tar.gz" +else + MY_PV=${PV} + MYSQLD_EXPORTER_COMMIT= + SRC_URI_UPSTREAM="${HOMEPAGE}/archive/refs/tags/v${PV}.tar.gz" +fi +MY_P=${PN}-${MY_PV} +SRC_URI_VENDOR="https://dev.gentoo.org/~robbat2/distfiles/${MY_P}-vendor.tar.xz" + +DESCRIPTION="Prometheus exporter for LVM metrics" +SRC_URI=" + ${SRC_URI_UPSTREAM} -> ${P}.tar.gz + ${SRC_URI_VENDOR} + " + +LICENSE="Apache-2.0 BSD MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" +BDEPEND="" +DEPEND="" +# lvm is explicitly not included here; this could be installed before it safely. +RDEPEND="" +S="${WORKDIR}/${PN}-${MY_PV}" + +PATCHES=( ) + +src_prepare() { + default + sed -i -e '/kingpin.Flag.*\<command\>.*/s,/usr/sbin/lvm,/sbin/lvm,g' "${S}"/main.go || die +} + +src_compile() { + default + go build . +} + +src_install() { + default + dobin ${PN} + dodoc README.md + + # TODO: more secure config would be a dedicated user AND a sudo command, so + # the daemon can run 'sudo lvm ...'. + newinitd "${FILESDIR}"/${PN}.initd ${PN} + newconfd "${FILESDIR}"/${PN}.confd ${PN} +} + +src_test() { + go test . +} diff --git a/app-metrics/prometheus-lvm-exporter/prometheus-lvm-exporter-0.3.3.ebuild b/app-metrics/prometheus-lvm-exporter/prometheus-lvm-exporter-0.3.3.ebuild new file mode 100644 index 000000000000..28809292d70e --- /dev/null +++ b/app-metrics/prometheus-lvm-exporter/prometheus-lvm-exporter-0.3.3.ebuild @@ -0,0 +1,49 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit go-module systemd + +DESCRIPTION="Prometheus exporter for LVM metrics" +HOMEPAGE="https://github.com/hansmi/prometheus-lvm-exporter" +SRC_URI=" + https://github.com/hansmi/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~arthurzam/distfiles/app-metrics/${PN}/${P}-deps.tar.xz +" + +LICENSE="Apache-2.0 BSD MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +# lvm is explicitly not included here; this could be installed before it safely. +# RDEPEND="" + +src_prepare() { + default + sed -i -e '/kingpin.Flag.*\<command\>.*/s,/usr/sbin/lvm,/sbin/lvm,g' "${S}"/main.go || die +} + +src_compile() { + default + ego build . +} + +src_test() { + ego test . +} + +src_install() { + default + dobin ${PN} + dodoc README.md + + systemd_dounit contrib/systemd/${PN}.service + insinto /etc/default + newins contrib/systemd/${PN}.default ${PN} + + # TODO: more secure config would be a dedicated user AND a sudo command, so + # the daemon can run 'sudo lvm ...'. + newinitd "${FILESDIR}"/${PN}.initd ${PN} + newconfd "${FILESDIR}"/${PN}.confd ${PN} +} |