~dricottone/huttese-apk

c8dc5dbdeb77e86f31196c180d77ca71abc9fc93 — Drew DeVault 5 years ago 601e65a
Add prometheus-node-exporter package
A prometheus/prometheus-node-exporter/APKBUILD => prometheus/prometheus-node-exporter/APKBUILD +37 -0
@@ 0,0 1,37 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
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"

A prometheus/prometheus-node-exporter/prometheus-node-exporter.initd => prometheus/prometheus-node-exporter/prometheus-node-exporter.initd +21 -0
@@ 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 $?
}