aboutsummaryrefslogtreecommitdiffstats
path: root/testing/prometheus-node-exporter
diff options
context:
space:
mode:
authorTiago Ilieve <tiago.myhro@gmail.com>2019-01-25 14:56:07 +0100
committerAndy Postnikov <apostnikov@gmail.com>2019-01-27 04:42:12 +0200
commitcbeabb778913c4f610bf6d7acae21464e3225414 (patch)
treebe7dcc35cc6ab97d10ed3cabab4d478a7e5ace5c /testing/prometheus-node-exporter
parentf2d584a17a087944ceb8f78a0c5e027d9e18f4ce (diff)
downloadaports-cbeabb778913c4f610bf6d7acae21464e3225414.tar.bz2
aports-cbeabb778913c4f610bf6d7acae21464e3225414.tar.xz
testing/prometheus-node-exporter: new aport
Diffstat (limited to 'testing/prometheus-node-exporter')
-rw-r--r--testing/prometheus-node-exporter/APKBUILD46
-rw-r--r--testing/prometheus-node-exporter/disable-go-race-detector.patch33
-rw-r--r--testing/prometheus-node-exporter/fix-go-sum.patch27
-rw-r--r--testing/prometheus-node-exporter/node-exporter.confd7
-rwxr-xr-xtesting/prometheus-node-exporter/node-exporter.initd22
-rwxr-xr-xtesting/prometheus-node-exporter/prometheus-node-exporter.pre-install6
l---------testing/prometheus-node-exporter/prometheus-node-exporter.pre-upgrade1
7 files changed, 142 insertions, 0 deletions
diff --git a/testing/prometheus-node-exporter/APKBUILD b/testing/prometheus-node-exporter/APKBUILD
new file mode 100644
index 0000000000..5db3e3ad7f
--- /dev/null
+++ b/testing/prometheus-node-exporter/APKBUILD
@@ -0,0 +1,46 @@
+# Contributor: Tiago Ilieve <tiago.myhro@gmail.com>
+# Maintainer: Tiago Ilieve <tiago.myhro@gmail.com>
+pkgname=prometheus-node-exporter
+_pkgname=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>=1.11 bash sed"
+install="$pkgname.pre-install $pkgname.pre-upgrade"
+subpackages="$pkgname-openrc"
+source="$_pkgname-$pkgver.tar.gz::https://github.com/prometheus/node_exporter/archive/v$pkgver.tar.gz
+ disable-go-race-detector.patch
+ fix-go-sum.patch
+ node-exporter.confd
+ node-exporter.initd"
+builddir="$srcdir/$_pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+
+ go build -v -ldflags "-s -w -X github.com/prometheus/common/version.Version=$pkgver" -o node_exporter
+}
+
+check() {
+ cd "$builddir"
+
+ make test
+ ./node_exporter --version
+}
+
+package() {
+ cd "$builddir"
+
+ install -Dm755 "$srcdir/node-exporter.confd" "$pkgdir"/etc/conf.d/node-exporter
+ install -Dm755 "$srcdir/node-exporter.initd" "$pkgdir"/etc/init.d/node-exporter
+ install -Dm755 ./node_exporter "$pkgdir"/usr/bin/node_exporter
+}
+
+sha512sums="8650fa24014f317b23cdbe2a6f12da0912ffc74cab815d1c94fdc0a3dc01ac1dff42a454af2ebbd4d402b7834d227bcf91ebdefa630ebe997cfd478e05ee01e5 node_exporter-0.17.0.tar.gz
+82511dfe2d4d12a10d6c367225066e23a52d6389d977ecad6ceb26567f67a69b427b52e58c403d89e6f8f2ebb88879002b2ef7280f675e188a64421947b21ea0 disable-go-race-detector.patch
+2bafe0433583f14d5e99502e11ac9a9ee75c99f8f466480e569b7ef15a95529f799a3c87348020df07ff8103a4bcc42d6f4274c842d44b97620d6d6337c2b541 fix-go-sum.patch
+592d3f17a3cf487d97a14c803dded07d2dfb112b159ab1a3575310fc0176fc3255ddad6657f16a8d6d3c161bfb03c203a6271ec6e6395b75716a14b0de8baced node-exporter.confd
+df006b184c3b2d5e773044838db7143dc3a64e621f4da6b106f41915a07d5cef32933ab9bb44464f10c132f86997ae7753ae19627afd4ba6cfb125161786dfe0 node-exporter.initd"
diff --git a/testing/prometheus-node-exporter/disable-go-race-detector.patch b/testing/prometheus-node-exporter/disable-go-race-detector.patch
new file mode 100644
index 0000000000..99c146d037
--- /dev/null
+++ b/testing/prometheus-node-exporter/disable-go-race-detector.patch
@@ -0,0 +1,33 @@
+From 3c66e043f16c833214a10b3aaf36a16c7c1af834 Mon Sep 17 00:00:00 2001
+From: Tiago Ilieve <tiago.myhro@gmail.com>
+Date: Fri, 25 Jan 2019 14:50:25 +0100
+Subject: [PATCH] Disable Go race detector
+
+Go race detector is not supported on musl[1].
+
+[1]: https://github.com/golang/go/issues/14481
+---
+ Makefile | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index d6d138c..b61484b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -33,13 +33,6 @@ else
+ OS_detected := $(shell uname -s)
+ endif
+
+-ifeq ($(GOHOSTARCH),amd64)
+- ifeq ($(OS_detected),$(filter $(OS_detected),Linux FreeBSD Darwin Windows))
+- # Only supported on amd64
+- test-flags := -race
+- endif
+-endif
+-
+ ifeq ($(OS_detected), Linux)
+ test-e2e := test-e2e
+ else
+--
+2.18.1
+
diff --git a/testing/prometheus-node-exporter/fix-go-sum.patch b/testing/prometheus-node-exporter/fix-go-sum.patch
new file mode 100644
index 0000000000..45c35fa162
--- /dev/null
+++ b/testing/prometheus-node-exporter/fix-go-sum.patch
@@ -0,0 +1,27 @@
+From 2fdbf50c525a0ac7ed169b8ca838327ba70c89a4 Mon Sep 17 00:00:00 2001
+From: Tiago Ilieve <tiago.myhro@gmail.com>
+Date: Fri, 25 Jan 2019 14:34:25 +0100
+Subject: [PATCH] Fix 'go.sum' hashes
+
+'github.com/soundcloud/go-runit' was failing with a 'checksum mismatch'
+error message.
+---
+ go.sum | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/go.sum b/go.sum
+index 5a60f0a..2de8dba 100644
+--- a/go.sum
++++ b/go.sum
+@@ -47,7 +47,7 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d h1:GoAlyOgbOEIFd
+ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+ github.com/sirupsen/logrus v1.1.1 h1:VzGj7lhU7KEB9e9gMpAV/v5XT2NVSvLJhJLCWbnkgXg=
+ github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A=
+-github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a h1:TGsOnmXp0mo82KbjaDcsTibGxWIdZNXbKJB18gFn1RM=
++github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a h1:os5OBNhwOwybXZMNLqT96XqtjdTtwRFw2w08uluvNeI=
+ github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a/go.mod h1:LeFCbQYJ3KJlPs/FvPz2dy1tkpxyeNESVyCNNzRXFR0=
+ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+--
+2.18.1
+
diff --git a/testing/prometheus-node-exporter/node-exporter.confd b/testing/prometheus-node-exporter/node-exporter.confd
new file mode 100644
index 0000000000..39c80a46be
--- /dev/null
+++ b/testing/prometheus-node-exporter/node-exporter.confd
@@ -0,0 +1,7 @@
+# /etc/conf.d/node-exporter
+
+# Custom arguments can be specified like:
+#
+# ARGS="--web.listen-address=':9100'"
+
+ARGS=""
diff --git a/testing/prometheus-node-exporter/node-exporter.initd b/testing/prometheus-node-exporter/node-exporter.initd
new file mode 100755
index 0000000000..5bd9839fe8
--- /dev/null
+++ b/testing/prometheus-node-exporter/node-exporter.initd
@@ -0,0 +1,22 @@
+#!/sbin/openrc-run
+
+command="/usr/bin/node_exporter"
+command_args="$ARGS"
+command_background="yes"
+group="prometheus"
+user="prometheus"
+
+logdir="/var/log/prometheus"
+logfile="$logdir/${SVCNAME}.log"
+pidfile="/var/run/${SVCNAME}.pid"
+start_stop_daemon_args="--stderr $logfile --user $user --group $group"
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath -d -o $user:$group -m755 $logdir
+ checkpath -f -o $user:$group -m644 $logfile
+}
diff --git a/testing/prometheus-node-exporter/prometheus-node-exporter.pre-install b/testing/prometheus-node-exporter/prometheus-node-exporter.pre-install
new file mode 100755
index 0000000000..120995cf35
--- /dev/null
+++ b/testing/prometheus-node-exporter/prometheus-node-exporter.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S prometheus 2>/dev/null
+adduser -S -D -h /var/lib/prometheus -s /sbin/nologin -G prometheus -g prometheus prometheus 2>/dev/null
+
+exit 0
diff --git a/testing/prometheus-node-exporter/prometheus-node-exporter.pre-upgrade b/testing/prometheus-node-exporter/prometheus-node-exporter.pre-upgrade
new file mode 120000
index 0000000000..b87af95334
--- /dev/null
+++ b/testing/prometheus-node-exporter/prometheus-node-exporter.pre-upgrade
@@ -0,0 +1 @@
+prometheus-node-exporter.pre-install \ No newline at end of file