pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

telegraf: An open-source, plugin-driven server agent for collecting & reporting metrics



Module Name:	pkgsrc-wip
Committed By:	Bill Welliver <bill%welliver.org@localhost>
Pushed By:	hww3
Date:		Fri Jan 25 21:35:18 2019 -0500
Changeset:	b2e9bad02cc07ad8328c61ff93fef2c5970426ef

Added Files:
	telegraf/DESCR
	telegraf/Makefile
	telegraf/PLIST
	telegraf/distinfo
	telegraf/files/smf/manifest.xml
	telegraf/files/telegraf.sh
	telegraf/patches/patch-docker_docker_client_unix.go
	telegraf/patches/patch-vendor_github.com_docker_docker_hack_dockerfile_install_containerd.installer

Log Message:
telegraf: An open-source, plugin-driven server agent for collecting & reporting metrics

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b2e9bad02cc07ad8328c61ff93fef2c5970426ef

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 telegraf/DESCR                                     |   1 +
 telegraf/Makefile                                  | 115 +++++++++++++++++++++
 telegraf/PLIST                                     |   9 ++
 telegraf/distinfo                                  |  12 +++
 telegraf/files/smf/manifest.xml                    |  30 ++++++
 telegraf/files/telegraf.sh                         |  23 +++++
 .../patches/patch-docker_docker_client_unix.go     |  10 ++
 ...er_hack_dockerfile_install_containerd.installer |  13 +++
 8 files changed, 213 insertions(+)

diffs:
diff --git a/telegraf/DESCR b/telegraf/DESCR
new file mode 100644
index 0000000000..8470333254
--- /dev/null
+++ b/telegraf/DESCR
@@ -0,0 +1 @@
+telegraf: An open-source, plugin-driven server agent for collecting & reporting metrics
diff --git a/telegraf/Makefile b/telegraf/Makefile
new file mode 100644
index 0000000000..3579bcc423
--- /dev/null
+++ b/telegraf/Makefile
@@ -0,0 +1,115 @@
+# $NetBSD$
+
+GITHUB_PROJECT=	telegraf
+PKGVERSION_NOREV= 1.9.2
+DISTNAME=       telegraf-1.9.2
+GITHUB_TAG=	${PKGVERSION_NOREV}
+CATEGORIES=	sysutils
+MASTER_SITES=	${MASTER_SITE_GITHUB:=influxdata/}
+MAINTAINER=	william%welliver.org@localhost
+HOMEPAGE=	https://www.influxdata.com/
+COMMENT=	Plugin-driven server agent for collecting & reporting metrics
+LICENSE=	mit
+
+# despite being the default value, this explicit declaration is required for things
+# to build properly.
+EXTRACT_SUFX=	.tar.gz
+TELEGRAF_DEPENDENCIES_DIR=	telegraf-dependencies-${PKGVERSION_NOREV}
+TELEGRAF_DEPENDENCIES=	${TELEGRAF_DEPENDENCIES_DIR}${EXTRACT_SUFX}
+TELEGRAF_DISTNAME=	${DISTNAME}${EXTRACT_SUFX}
+DISTFILES=	${TELEGRAF_DISTNAME}
+
+.if !defined(BOOTSTRAP)
+DISTFILES+=	${TELEGRAF_DEPENDENCIES}
+SITES.${TELEGRAF_DEPENDENCIES}= https://bitbucket.org/hww3/influxdb/downloads/
+.endif
+
+USE_TOOLS+=	gmake curl
+
+BUILD_DEPENDS+=			go110-1.10.*:../../lang/go110
+
+# go language executables don't have SSP support
+CHECK_SSP_SKIP=	bin/*
+
+PKGSRC_MAKE_ENV+=		GOPATH=${WRKDIR}
+
+PKG_SYSCONFSUBDIR=	telegraf
+
+DATADIR=	${VARBASE}/lib/telegraf
+LOGDIR=		${VARBASE}/log/telegraf
+
+BUILD_DEFS+=		TELEGRAF_USER TELEGRAF_GROUP VARBASE
+FILES_SUBST+=		TELEGRAF_USER=${TELEGRAF_USER:Q}
+FILES_SUBST+=		TELEGRAF_GROUP=${TELEGRAF_GROUP:Q}
+FILES_SUBST+=		DATADIR=${DATADIR:Q}
+FILES_SUBST+=		LOGDIR=${LOGDIR:Q}
+
+TELEGRAF_USER?=		telegraf
+TELEGRAF_GROUP?=	telegraf
+OWN_DIRS_PERMS+=	${DATADIR} ${TELEGRAF_USER} ${TELEGRAF_GROUP} 0700
+OWN_DIRS_PERMS+=	${LOGDIR} ${TELEGRAF_USER} ${TELEGRAF_GROUP} 0700
+PKG_USERS_VARS+=	TELEGRAF_USER
+PKG_GROUPS_VARS+=	TELEGRAF_GROUP
+PKG_GROUPS=		${TELEGRAF_GROUP}
+PKG_USERS=		${TELEGRAF_USER}:${TELEGRAF_GROUP}
+RCD_SCRIPTS=		telegraf
+
+INSTALLATION_DIRS+=	bin etc/telegraf etc/logrotate.d share/doc/telegraf share/examples/telegraf share/examples/telegraf/logrotate.d
+
+DOC_FILES+=	LICENSE README.md CHANGELOG.md
+BIN_FILES+=	telegraf
+CONF_FILES+=	${PREFIX}/share/examples/${PKGBASE}/telegraf.conf ${PKG_SYSCONFDIR}/telegraf.conf
+CONF_FILES+=	${PREFIX}/share/examples/${PKGBASE}/logrotate.d/telegraf ${PKG_SYSCONFDIR}/../logrotate.d/telegraf
+
+WRKSRC=	${WRKDIR}/src/github.com/influxdata/telegraf
+GO_BIN=	${PREFIX}/go110/bin/go
+
+# TODO: figure out how to properly depend on the extract target
+# fetch the additional dependencies that telegraf requires to compile and prepare a tarball containing them for use later.
+.PHONY: 	_fetch_dependencies
+_fetch_dependencies: extract
+	cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV}  ${GO_BIN} get -u github.com/golang/dep/cmd/dep
+	cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV}  ${GO_BIN} install github.com/golang/dep/cmd/dep
+	cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV}  ${WRKDIR}/bin/dep ensure -vendor-only
+	cd ${WRKSRC}/vendor && ${SETENV} ${PKGSRC_MAKE_ENV} find . -type d -name \.git -exec rm -rf {} \;
+	cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV} tar czvf ${TELEGRAF_DEPENDENCIES}  vendor
+	cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV} mv ${TELEGRAF_DEPENDENCIES} /data/pkgsrc/wip/telegraf
+
+# upload the dependency tarball somewhere that others can access.
+# this should probably be someplace more "official".
+.PHONY: 	_upload_dependencies
+_upload_dependencies: 	_fetch_dependencies
+	curl -u $$BITBUCKET_USERNAME:$$BITBUCKET_PASSWORD -s -X POST https://api.bitbucket.org/2.0/repositories/$$BITBUCKET_USERNAME/influxdb/downloads -F files=@${TELEGRAF_DEPENDENCIES}
+
+# we should probably guard this code to make sure it's not done twice.
+pre-extract:
+	${MKDIR} ${WRKDIR}/src/github.com/influxdata/
+
+post-extract:
+	ls -l ${WRKDIR}
+	${MV} ${WRKDIR}/${DISTNAME} ${WRKSRC}
+.if !defined(BOOTSTRAP)
+	${MV} ${WRKDIR}/vendor ${WRKSRC}/
+.endif
+
+do-build:
+	cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV}  ${GO_BIN} get -ldflags "-X main.version=${PKGVERSION_NOREV} -X main.commit=${GITHUB_TAG} -X main.buildstamp=pkgsrc" ./...
+	cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV}  ${GO_BIN} install ./...
+
+do-install:
+.for idir in ${INSTALLATION_DIRS}
+	${MKDIR}  ${DESTDIR}${PREFIX}/${idir}
+.endfor
+.for x in ${BIN_FILES}
+	${INSTALL} ${WRKDIR}/bin/${x}	\
+	  ${DESTDIR}${PREFIX}/bin/${x}
+.endfor
+.for x in ${DOC_FILES}
+	${INSTALL_DATA} ${WRKSRC}/${x} \
+	  ${DESTDIR}${PREFIX}/share/doc/telegraf/${x}
+.endfor
+	${INSTALL_DATA} ${WRKSRC}/etc/telegraf.conf ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/
+	${INSTALL_DATA} ${WRKSRC}/etc/logrotate.d/telegraf ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/logrotate.d/telegraf
+
+#.include "../../lang/go19/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/telegraf/PLIST b/telegraf/PLIST
new file mode 100644
index 0000000000..07f659472f
--- /dev/null
+++ b/telegraf/PLIST
@@ -0,0 +1,9 @@
+@comment $NetBSD$
+bin/telegraf
+share/doc/telegraf/CHANGELOG.md
+share/doc/telegraf/LICENSE
+share/doc/telegraf/README.md
+share/examples/telegraf/logrotate.d/telegraf
+share/examples/telegraf/telegraf.conf
+@pkgdir etc/telegraf
+@pkgdir etc/logrotate.d
diff --git a/telegraf/distinfo b/telegraf/distinfo
new file mode 100644
index 0000000000..769cfcd96b
--- /dev/null
+++ b/telegraf/distinfo
@@ -0,0 +1,12 @@
+$NetBSD$
+
+SHA1 (telegraf-1.9.2.tar.gz) = 756136e5439953e84ae072a008d8404418af8f4c
+RMD160 (telegraf-1.9.2.tar.gz) = dd1c8c8265aaf87022d35b2b585b817c0cdb601a
+SHA512 (telegraf-1.9.2.tar.gz) = 2787d564f95108acce48341911c8f4298233f3d31b00c4d3eba07bcaef6bded8dcc6b0741acdc1ade600bfd09878b04fba576099415d690465e90088fdcec13f
+Size (telegraf-1.9.2.tar.gz) = 1279918 bytes
+SHA1 (telegraf-dependencies-1.9.2.tar.gz) = dc375e7b2bc0837fcc538f352a35d2f1ede60481
+RMD160 (telegraf-dependencies-1.9.2.tar.gz) = ebe1157aadbdf9e3be8e1e01445cb0e9d59f5dcd
+SHA512 (telegraf-dependencies-1.9.2.tar.gz) = 021815c69c21d5e3f5430735233bc0a7e2cc6a1d73c9ad9cea1efc69f1a2026a0859f94ccb53b511ff82e322066c54b9df2ed9401a273e15dd23ce19a33c5edc
+Size (telegraf-dependencies-1.9.2.tar.gz) = 66435980 bytes
+SHA1 (patch-docker_docker_client_unix.go) = 19f354d83e187aff18f09fc1d2088e65524214ef
+SHA1 (patch-vendor_github.com_docker_docker_hack_dockerfile_install_containerd.installer) = edd27e8d070b61ae4e83dc83463c5bdab9ceaa98
diff --git a/telegraf/files/smf/manifest.xml b/telegraf/files/smf/manifest.xml
new file mode 100644
index 0000000000..9dd295f42e
--- /dev/null
+++ b/telegraf/files/smf/manifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type='manifest' name='@SMF_NAME@:default'>
+  <service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
+    <create_default_instance enabled='false' />
+    <single_instance />
+    <dependency name='network' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/milestone/network:default' />
+    </dependency>
+    <dependency name='fs-local' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/system/filesystem/local:default' />
+    </dependency>
+    <method_context working_directory="@DATADIR@">
+      <method_credential user='@TELEGRAF_USER@' group='@TELEGRAF_GROUP@' />
+    </method_context>
+    <exec_method type='method' name='start'
+      exec='@PREFIX@/bin/telegraf --config @PKG_SYSCONFDIR@/telegraf.conf --pidfile @DATADIR@/telegraf.pid 2>> @LOGDIR@/telegraf.log &amp;'
+      timeout_seconds="60" />
+    <exec_method type='method' name='stop' exec=':kill' timeout_seconds="60" />
+    <template>
+      <common_name>
+        <loctext xml:lang='C'>InfluxDB Time Series database</loctext>
+      </common_name>
+      <documentation>
+        <manpage title='telegraf' section='1' manpath='/@PREFIX@/man' />
+        <doc_link name='homepage' uri='https://docs.influxdata.com/telegraf/' />
+      </documentation>
+    </template>
+  </service>
+</service_bundle>
diff --git a/telegraf/files/telegraf.sh b/telegraf/files/telegraf.sh
new file mode 100644
index 0000000000..cb43174d7c
--- /dev/null
+++ b/telegraf/files/telegraf.sh
@@ -0,0 +1,23 @@
+#!@RCD_SCRIPTS_SHELL@
+
+# PROVIDE: telegraf
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+if [ -f /etc/rc.subr ]
+then
+        . /etc/rc.subr
+fi
+
+name="telegraf"
+rcvar=$name
+influxdb_user="@TELEGRAF_USER@"
+influxdb_group="@TELEGRAF_GROUP@"
+influxdb_chdir="@VARBASE@/lib/telegraf"
+pidfile="@VARBASE@/lib/telegraf/data/telegraf.pid"
+STDERR="@LOGDIR@/telegraf.log"
+command="@PREFIX@/bin/telegraf"
+command_args="--config @PREFIX@/etc/telegraf/telegraf.conf --pidfile ${pidfile} 1>/dev/null 2>> $STDERR &"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/telegraf/patches/patch-docker_docker_client_unix.go b/telegraf/patches/patch-docker_docker_client_unix.go
new file mode 100644
index 0000000000..581df696d0
--- /dev/null
+++ b/telegraf/patches/patch-docker_docker_client_unix.go
@@ -0,0 +1,10 @@
+$NetBSD$
+Docker broke building their client on solaris
+--- vendor/github.com/docker/docker/client/client_unix.go.orig	2019-01-16 23:06:36.532171754 +0000
++++ vendor/github.com/docker/docker/client/client_unix.go
+@@ -1,4 +1,4 @@
+-// +build linux freebsd openbsd darwin
++// +build linux freebsd openbsd darwin solaris
+ 
+ package client // import "github.com/docker/docker/client"
+ 
diff --git a/telegraf/patches/patch-vendor_github.com_docker_docker_hack_dockerfile_install_containerd.installer b/telegraf/patches/patch-vendor_github.com_docker_docker_hack_dockerfile_install_containerd.installer
new file mode 100644
index 0000000000..abe99de265
--- /dev/null
+++ b/telegraf/patches/patch-vendor_github.com_docker_docker_hack_dockerfile_install_containerd.installer
@@ -0,0 +1,13 @@
+$NetBSD$
+Fix a bashism
+--- vendor/github.com/docker/docker/hack/dockerfile/install/containerd.installer.orig	2019-01-17 03:38:47.000000000 +0000
++++ vendor/github.com/docker/docker/hack/dockerfile/install/containerd.installer
+@@ -19,7 +19,7 @@ install_containerd() {
+ 		export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
+ 
+ 		# Reset build flags to nothing if we want a dynbinary
+-		if [ "$1" == "dynamic" ]; then
++		if [ "$1" = "dynamic" ]; then
+ 			export BUILDTAGS=''
+ 			export EXTRA_FLAGS=''
+ 			export EXTRA_LDFLAGS=''


Home | Main Index | Thread Index | Old Index