public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-metrics/prometheus-lvm-exporter/, app-metrics/prometheus-lvm-exporter/files/
@ 2022-12-26 23:04 Robin H. Johnson
  0 siblings, 0 replies; only message in thread
From: Robin H. Johnson @ 2022-12-26 23:04 UTC (permalink / raw
  To: gentoo-commits

commit:     f93a88f60cfe2809e33a5f340855b0458d5f38c7
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 26 23:03:52 2022 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Dec 26 23:04:34 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f93a88f6

app-metrics/prometheus-lvm-exporter: new package

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 app-metrics/prometheus-lvm-exporter/Manifest       |  2 +
 .../files/prometheus-lvm-exporter.confd            | 26 ++++++++++
 .../files/prometheus-lvm-exporter.initd            | 49 ++++++++++++++++++
 app-metrics/prometheus-lvm-exporter/metadata.xml   | 10 ++++
 .../prometheus-lvm-exporter-0.3.2.ebuild           | 59 ++++++++++++++++++++++
 5 files changed, 146 insertions(+)

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 .
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-26 23:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-26 23:04 [gentoo-commits] repo/gentoo:master commit in: app-metrics/prometheus-lvm-exporter/, app-metrics/prometheus-lvm-exporter/files/ Robin H. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox