summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2022-12-26 15:03:52 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2022-12-26 15:04:34 -0800
commitf93a88f60cfe2809e33a5f340855b0458d5f38c7 (patch)
treebf88815d538b48fa1e462b6cabc076fb3d974f39 /app-metrics/prometheus-lvm-exporter
parentsys-cluster/openmpi: drop 4.1.2 (diff)
downloadgentoo-f93a88f60cfe2809e33a5f340855b0458d5f38c7.tar.gz
gentoo-f93a88f60cfe2809e33a5f340855b0458d5f38c7.tar.bz2
gentoo-f93a88f60cfe2809e33a5f340855b0458d5f38c7.zip
app-metrics/prometheus-lvm-exporter: new package
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'app-metrics/prometheus-lvm-exporter')
-rw-r--r--app-metrics/prometheus-lvm-exporter/Manifest2
-rw-r--r--app-metrics/prometheus-lvm-exporter/files/prometheus-lvm-exporter.confd26
-rw-r--r--app-metrics/prometheus-lvm-exporter/files/prometheus-lvm-exporter.initd49
-rw-r--r--app-metrics/prometheus-lvm-exporter/metadata.xml10
-rw-r--r--app-metrics/prometheus-lvm-exporter/prometheus-lvm-exporter-0.3.2.ebuild59
5 files changed, 146 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..d4c18baa4f35
--- /dev/null
+++ b/app-metrics/prometheus-lvm-exporter/Manifest
@@ -0,0 +1,2 @@
+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
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..a5f32875955c
--- /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..03455ab5fa66
--- /dev/null
+++ b/app-metrics/prometheus-lvm-exporter/prometheus-lvm-exporter-0.3.2.ebuild
@@ -0,0 +1,59 @@
+# 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_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 .
+}