Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app-metrics/pgbackrest_exporter/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DIST pgbackrest_exporter-0.22.0-deps.tar.xz 95152316 BLAKE2B 441ea3da2d4aebb285389f5ce636884e0fe5c85f2706cae9a7b9fe72be5c0cb543528d4d566a81aac7f18c00d6ee355fdba8cb8eb012ddeacff307d59cd6b649 SHA512 6c3d7c9fc9e71af15c1ad76341f4b959cf03627c6dbc512db1d44daf71a8238bd75f0d3d6628fab7e0d75484919153fdb8350caba8b8cf9b5b6fedfc192dde6b
DIST pgbackrest_exporter-0.22.0.tar.gz 3364770 BLAKE2B 837c73842fb999cdd81830d8c9207dfb13236edb670e3000ee3adf54b4430133bf29a594708305909da419cb90541526ca9d74e5f6afbed35c63c549781b4297 SHA512 d72228fe4270d63d2095c945bf22ddfa26b501926459db273f9ee2361e0624256cfd5d0dab7c0b6bc8d1fa34be123a844dcd09408dee9737b25fde1ec4f2e9fc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# PGBackrest exporter default args
PGBACKREST_USER=postgres
PGBACKREST_GROUP=postgres
EXPORTER_ARGS="--web.telemetry-path=/metrics --web.listen-address=:9854 --collect.interval=600"
21 changes: 21 additions & 0 deletions app-metrics/pgbackrest_exporter/files/pgbackrest_exporter.initd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/sbin/openrc-run
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EXPORTER_USER="${PGBACKREST_USER}"
EXPORTER_GROUP="${PGBACKREST_GROUP}"

name="PGBackrest Exporter daemon"
description="The metrics are collected based on result of pgbackrest info --output json command"

command="/usr/bin/pgbackrest_exporter"
command_args="${EXPORTER_ARGS}"
pidfile="/run/${SVCNAME}.pid"
output_log="/var/log/${SVCNAME}/${SVCNAME}.log"
error_log="/var/log/${SVCNAME}/${SVCNAME}.log"
start_stop_daemon_args="--background --make-pidfile --pidfile ${pidfile}
--user ${EXPORTER_USER} --group ${EXPORTER_GROUP}"

depend() {
need net
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2024 @Belha
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go-module

DESCRIPTION="Prometheus exporter for PGBackrest metrics."
HOMEPAGE="https://github.com/woblerr/pgbackrest_exporter"
SRC_URI="
${HOMEPAGE}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
https://files.adjust.com/${P}.tar.xz -> ${P}-deps.tar.xz
"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc"

DEPEND="
>=dev-lang/go-1.24.0
acct-group/postgres
acct-user/postgres
"

RDEPEND="${DEPEND}"
BDEPEND="
dev-build/make
"
SRC_DIR="${WORKDIR}/${P}"

src_unpack() {
default
}

src_prepare() {
default
}

src_compile() {
export GOPATH="${SRC_DIR}"
cd "${SRC_DIR}"
emake build
}

src_test() {
cd "${SRC_DIR}"
emake test
}

src_install() {
dobin "${PN}"
newinitd "${FILESDIR}/${PN}.initd" ${PN}
newconfd "${FILESDIR}/${PN}.confd" ${PN}
# Create log directory and file
keepdir /var/log/${PN}
# Change ownership of the log file to sql_exporter
fowners postgres:postgres /var/log/${PN}
}