From 8925761eae5492803640795cdcd210c6d9a3be4d Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 4 Jan 2020 19:11:29 -0500 Subject: [PATCH] prometheus-node-exporter: normalize package --- sr.ht/prometheus-node-exporter/APKBUILD | 4 ++- .../prometheus-node-exporter.confd | 4 +++ .../prometheus-node-exporter.initd | 26 +++++++------------ .../prometheus-node-exporter.pre-install | 4 +++ 4 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 sr.ht/prometheus-node-exporter/prometheus-node-exporter.confd create mode 100644 sr.ht/prometheus-node-exporter/prometheus-node-exporter.pre-install diff --git a/sr.ht/prometheus-node-exporter/APKBUILD b/sr.ht/prometheus-node-exporter/APKBUILD index 5c4c814..8d2732e 100644 --- a/sr.ht/prometheus-node-exporter/APKBUILD +++ b/sr.ht/prometheus-node-exporter/APKBUILD @@ -1,15 +1,17 @@ # Maintainer: Drew DeVault pkgname=prometheus-node-exporter pkgver=0.18.1 -pkgrel=0 +pkgrel=1 pkgdesc="prometheus exporter for machine metrics" url="https://github.com/prometheus/node_exporter" arch="all" license="Apache-2.0" +install="prometheus-node-exporter.pre-install" makedepends="go" source=" $pkgname-$pkgver.tar.gz::https://github.com/prometheus/node_exporter/archive/v$pkgver.tar.gz prometheus-node-exporter.initd + prometheus-node-exporter.confd " subpackages="$pkgname-openrc" builddir="$srcdir/node_exporter-$pkgver" diff --git a/sr.ht/prometheus-node-exporter/prometheus-node-exporter.confd b/sr.ht/prometheus-node-exporter/prometheus-node-exporter.confd new file mode 100644 index 0000000..8843b48 --- /dev/null +++ b/sr.ht/prometheus-node-exporter/prometheus-node-exporter.confd @@ -0,0 +1,4 @@ +prometheus_node_exporter_web_listen_address=127.0.0.1:9100 + +output_log=/var/log/prometheus-node-exporter.log +error_log=/var/log/prometheus-node-exporter.log diff --git a/sr.ht/prometheus-node-exporter/prometheus-node-exporter.initd b/sr.ht/prometheus-node-exporter/prometheus-node-exporter.initd index 16a2ef5..83932da 100644 --- a/sr.ht/prometheus-node-exporter/prometheus-node-exporter.initd +++ b/sr.ht/prometheus-node-exporter/prometheus-node-exporter.initd @@ -1,21 +1,13 @@ #!/sbin/openrc-run name="prometheus-node-exporter" -description="prometheus node exporter" +description="Prometheus node monitoring daemon" +supervisor=supervise-daemon +command=/usr/bin/prometheus_node_exporter +command_args="--web.listen-address=$prometheus_node_exporter_web_listen_address" -depend() { - need net -} - -start() { - ebegin "Starting $name" - start-stop-daemon -C --background --make-pidfile --pidfile /run/$name.pid \ - --exec /usr/bin/prometheus_node_exporter -- \ - --web.listen-address=127.0.0.1:9100 - eend $? -} - -stop() { - ebegin "Stopping $name" - start-stop-daemon --stop --exec /usr/bin/prometheus-node-exporter --pidfile /run/$name.pid - eend $? +start_pre() { + [ -n "$output_log" ] && checkpath -f "$output_path" \ + -m 644 -o prometheus:prometheus + [ -n "$error_log" ] && checkpath -f "$error_path" \ + -m 644 -o prometheus:prometheus } diff --git a/sr.ht/prometheus-node-exporter/prometheus-node-exporter.pre-install b/sr.ht/prometheus-node-exporter/prometheus-node-exporter.pre-install new file mode 100644 index 0000000..004fd0b --- /dev/null +++ b/sr.ht/prometheus-node-exporter/prometheus-node-exporter.pre-install @@ -0,0 +1,4 @@ +#!/bin/sh +grep '^prometheus:' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null +grep '^prometheus:' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \ + -s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null -- 2.45.2