From c8dc5dbdeb77e86f31196c180d77ca71abc9fc93 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 9 Dec 2018 11:33:36 -0500 Subject: [PATCH] Add prometheus-node-exporter package --- prometheus/prometheus-node-exporter/APKBUILD | 37 +++++++++++++++++++ .../prometheus-node-exporter.initd | 21 +++++++++++ 2 files changed, 58 insertions(+) create mode 100644 prometheus/prometheus-node-exporter/APKBUILD create mode 100644 prometheus/prometheus-node-exporter/prometheus-node-exporter.initd diff --git a/prometheus/prometheus-node-exporter/APKBUILD b/prometheus/prometheus-node-exporter/APKBUILD new file mode 100644 index 0000000..3821634 --- /dev/null +++ b/prometheus/prometheus-node-exporter/APKBUILD @@ -0,0 +1,37 @@ +# Maintainer: Drew DeVault +pkgname=prometheus-node-exporter +pkgver=0.17.0 +pkgrel=0 +pkgdesc="prometheus exporter for machine metrics" +url="https://github.com/prometheus/node_exporter" +arch="all" +license="Apache-2.0" +makedepends="go" +source=" + $pkgname-$pkgver.tar.gz::https://github.com/prometheus/node_exporter/archive/v$pkgver.tar.gz + prometheus-node-exporter.initd +" +subpackages="$pkgname-openrc" +builddir="$srcdir/node_exporter-$pkgver" + +build() { + cd "$builddir" + go build +} + +check() { + cd "$builddir" + go test +} + +package() { + cd "$builddir" + mkdir -p "$pkgdir"/usr/bin + mkdir -p "$pkgdir"/etc/init.d + install -Dm755 node_exporter "$pkgdir"/usr/bin/prometheus_node_exporter + install -Dm755 "$srcdir"/prometheus-node-exporter.initd \ + "$pkgdir"/etc/init.d/prometheus-node-exporter +} + +sha512sums="8650fa24014f317b23cdbe2a6f12da0912ffc74cab815d1c94fdc0a3dc01ac1dff42a454af2ebbd4d402b7834d227bcf91ebdefa630ebe997cfd478e05ee01e5 prometheus-node-exporter-0.17.0.tar.gz +ac5dd257333b9b40923d2541f68e4caac5583aee861833c8179621e290b56b686e9b58131fd7ce6ebaadb929351b65a95af7005c074fec00546813b285071abe prometheus-node-exporter.initd" diff --git a/prometheus/prometheus-node-exporter/prometheus-node-exporter.initd b/prometheus/prometheus-node-exporter/prometheus-node-exporter.initd new file mode 100644 index 0000000..4a306bc --- /dev/null +++ b/prometheus/prometheus-node-exporter/prometheus-node-exporter.initd @@ -0,0 +1,21 @@ +#!/sbin/openrc-run +name="prometheus-node-exporter" +description="prometheus node exporter" + +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 $? +} -- 2.45.2