Skip to content

Commit d8ffed8

Browse files
committed
pgbackrest_exporter: add new package
1 parent c4ab409 commit d8ffed8

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DIST pgbackrest_exporter-0.22.0-deps.tar.xz 95152316 BLAKE2B 441ea3da2d4aebb285389f5ce636884e0fe5c85f2706cae9a7b9fe72be5c0cb543528d4d566a81aac7f18c00d6ee355fdba8cb8eb012ddeacff307d59cd6b649 SHA512 6c3d7c9fc9e71af15c1ad76341f4b959cf03627c6dbc512db1d44daf71a8238bd75f0d3d6628fab7e0d75484919153fdb8350caba8b8cf9b5b6fedfc192dde6b
2+
DIST pgbackrest_exporter-0.22.0.tar.gz 3364770 BLAKE2B 837c73842fb999cdd81830d8c9207dfb13236edb670e3000ee3adf54b4430133bf29a594708305909da419cb90541526ca9d74e5f6afbed35c63c549781b4297 SHA512 d72228fe4270d63d2095c945bf22ddfa26b501926459db273f9ee2361e0624256cfd5d0dab7c0b6bc8d1fa34be123a844dcd09408dee9737b25fde1ec4f2e9fc
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# PGBackrest exporter default args
2+
PGBACKREST_USER=postgres
3+
PGBACKREST_GROUP=postgres
4+
EXPORTER_ARGS="--web.telemetry-path=/metrics --web.listen-address=:9854 --collect.interval=600"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/sbin/openrc-run
2+
# Copyright 2024 Gentoo Authors
3+
# Distributed under the terms of the GNU General Public License v2
4+
5+
EXPORTER_USER="${PGBACKREST_USER}"
6+
EXPORTER_GROUP="${PGBACKREST_GROUP}"
7+
8+
name="PGBackrest Exporter daemon"
9+
description="The metrics are collected based on result of pgbackrest info --output json command"
10+
11+
command="/usr/bin/pgbackrest_exporter"
12+
command_args="${EXPORTER_ARGS}"
13+
pidfile="/run/${SVCNAME}.pid"
14+
output_log="/var/log/${SVCNAME}/${SVCNAME}.log"
15+
error_log="/var/log/${SVCNAME}/${SVCNAME}.log"
16+
start_stop_daemon_args="--background --make-pidfile --pidfile ${pidfile}
17+
--user ${EXPORTER_USER} --group ${EXPORTER_GROUP}"
18+
19+
depend() {
20+
need net
21+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2024 @Belha
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=8
5+
6+
inherit go-module
7+
8+
DESCRIPTION="Prometheus exporter for PGBackrest metrics."
9+
HOMEPAGE="https://github.com/woblerr/pgbackrest_exporter"
10+
SRC_URI="
11+
${HOMEPAGE}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
12+
https://files.adjust.com/${P}.tar.xz -> ${P}-deps.tar.xz
13+
"
14+
15+
LICENSE="MIT"
16+
SLOT="0"
17+
KEYWORDS="~amd64"
18+
IUSE="doc"
19+
20+
DEPEND="
21+
>=dev-lang/go-1.24.0
22+
acct-group/postgres
23+
acct-user/postgres"
24+
25+
RDEPEND="${DEPEND}"
26+
BDEPEND="
27+
dev-build/make
28+
"
29+
SRC_DIR="${WORKDIR}/${P}"
30+
31+
src_unpack() {
32+
default
33+
}
34+
35+
src_prepare() {
36+
default
37+
}
38+
39+
src_compile() {
40+
export GOPATH="${SRC_DIR}"
41+
cd "${SRC_DIR}"
42+
emake build
43+
}
44+
45+
src_test() {
46+
cd "${SRC_DIR}"
47+
emake test
48+
}
49+
50+
src_install() {
51+
dobin "${PN}"
52+
newinitd "${FILESDIR}/${PN}.initd" ${PN}
53+
newconfd "${FILESDIR}/${PN}.confd" ${PN}
54+
# Create log directory and file
55+
keepdir /var/log/${PN}
56+
# Change ownership of the log file to sql_exporter
57+
fowners postgres:postgres /var/log/${PN}
58+
}

0 commit comments

Comments
 (0)