aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/telegraf/APKBUILD41
-rw-r--r--testing/telegraf/telegraf-makefile-ldflags.patch12
-rw-r--r--testing/telegraf/telegraf.initd39
3 files changed, 92 insertions, 0 deletions
diff --git a/testing/telegraf/APKBUILD b/testing/telegraf/APKBUILD
new file mode 100644
index 0000000000..ef8b4f8774
--- /dev/null
+++ b/testing/telegraf/APKBUILD
@@ -0,0 +1,41 @@
+# Contributor: Katie Holly <holly@fuslvz.ws>
+# Maintainer: Katie Holly <holly@fuslvz.ws>
+pkgname=telegraf
+pkgver=1.5.1
+pkgrel=0
+pkgdesc="A plugin-driven server agent for collecting & reporting metrics, part of the InfluxDB project"
+url="https://www.influxdata.com/time-series-platform/telegraf/"
+arch="x86_64 x86"
+license="MIT"
+makedepends="go"
+options="!strip"
+install=""
+source="$pkgname-$pkgver.tar.gz::https://github.com/influxdata/$pkgname/archive/$pkgver.tar.gz
+ telegraf-makefile-ldflags.patch
+ telegraf.initd
+ "
+builddir="$srcdir"/$pkgname-$pkgver
+_godir="$srcdir"/go
+_vendor=influxdata
+
+build() {
+ mkdir -p "$_godir"/bin "$_godir"/src/github.com/"$_vendor"
+ ln -sf "$builddir" "$_godir"/src/github.com/$_vendor/$pkgname
+ export GOPATH="$_godir"
+ export PATH="$PATH:$_godir"
+ cd "$_godir"/src/github.com/$_vendor/$pkgname
+ go get -d -v .
+ make PREFIX=/usr
+}
+
+package() {
+ mkdir -p "$pkgdir"/usr/bin "$pkgdir"/etc/$pkgname "$pkgdir"/etc/logrotate.d/$pkgname
+ install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -Dm755 "$builddir"/$pkgname "$pkgdir"/usr/bin/$pkgname
+ install -Dm644 "$builddir"/etc/$pkgname.conf "$pkgdir"/etc/$pkgname/$pkgname.conf
+ install -Dm644 "$builddir"/etc/logrotate.d/$pkgname "$pkgdir"/etc/logrotate.d/$pkgname
+}
+
+sha512sums="e5b723d4b2d1fa40aa08c3f4def220d9a9a6eb8ab57ca8cb03116ad86b7e43e589592e6e4dfab03f03a3c884b8cc2ccdeab19de4fcf737e32278ab1d9336055a telegraf-1.5.1.tar.gz
+f565077f3bea51937b720dab2224bc991cf39a54ec1b5089c708136aa3535ef9fd43df4d2cb138d65634d8430b9b91a0710c30321310974c3d427b99ea374c04 telegraf-makefile-ldflags.patch
+5ab5dbc5d0ab735f0909c44dc5bc9748ea724d148e1f69c9beb59a6504944a2b092597cf071d478cb06f78f52321fba68106e8cee52b104d05b031500cdec1e3 telegraf.initd"
diff --git a/testing/telegraf/telegraf-makefile-ldflags.patch b/testing/telegraf/telegraf-makefile-ldflags.patch
new file mode 100644
index 0000000000..de5e8d59e1
--- /dev/null
+++ b/testing/telegraf/telegraf-makefile-ldflags.patch
@@ -0,0 +1,12 @@
+diff -urp a/Makefile b/Makefile
+--- a/Makefile 1970-01-01 00:00:00.000000000 +0000
++++ b/Makefile 1970-01-01 00:00:00.000000000 +0000
+@@ -10,7 +10,7 @@ endif
+
+ TELEGRAF := telegraf$(shell go tool dist env | grep -q 'GOOS=.windows.' && echo .exe)
+
+-LDFLAGS := $(LDFLAGS) -X main.commit=$(COMMIT) -X main.branch=$(BRANCH)
++LDFLAGS := -X main.commit=$(COMMIT) -X main.branch=$(BRANCH)
+ ifdef VERSION
+ LDFLAGS += -X main.version=$(VERSION)
+ endif
diff --git a/testing/telegraf/telegraf.initd b/testing/telegraf/telegraf.initd
new file mode 100644
index 0000000000..9f8e0cf0c0
--- /dev/null
+++ b/testing/telegraf/telegraf.initd
@@ -0,0 +1,39 @@
+#!/sbin/openrc-run
+
+NAME=telegraf
+DAEMON=/usr/bin/$NAME
+
+# /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
+
+depend() {
+ need net
+ after firewall
+}
+
+start() {
+ ebegin "Starting ${NAME}"
+ start-stop-daemon --start --quiet --background \
+ --make-pidfile --pidfile /var/run/${NAME}.pid \
+ --exec ${DAEMON} -- ${OPTS} -config /etc/${NAME}/${NAME}.conf -config-directory /etc/${NAME}/${NAME}.d
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${NAME}"
+ start-stop-daemon --stop --quiet \
+ --exec ${DAEMON} \
+ --pidfile /var/run/${NAME}.pid \
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading ${NAME}"
+ if ! service_started "${NAME}" ; then
+ eend 1 "${NAME} is not started"
+ return 1
+ fi
+ start-stop-daemon --stop --oknodo --signal HUP \
+ --exec ${DAEMON} --pidfile /var/run/${NAME}.pid
+ eend $?
+}
+