net-analyzer/kapacitor: New package
authorWilliam Hubbs <williamh@gentoo.org>
Mon, 26 Mar 2018 02:54:11 +0000 (21:54 -0500)
committerWilliam Hubbs <williamh@gentoo.org>
Mon, 26 Mar 2018 02:55:38 +0000 (21:55 -0500)
This is a framework for processing, monitoring and alerting on time series data.

Package-Manager: Portage-2.3.24, Repoman-2.3.6

net-analyzer/kapacitor/Manifest [new file with mode: 0644]
net-analyzer/kapacitor/files/kapacitor.confd [new file with mode: 0644]
net-analyzer/kapacitor/files/kapacitor.rc [new file with mode: 0644]
net-analyzer/kapacitor/kapacitor-1.4.1.ebuild [new file with mode: 0644]
net-analyzer/kapacitor/metadata.xml [new file with mode: 0644]

diff --git a/net-analyzer/kapacitor/Manifest b/net-analyzer/kapacitor/Manifest
new file mode 100644 (file)
index 0000000..f2322b6
--- /dev/null
@@ -0,0 +1 @@
+DIST kapacitor-1.4.1.tar.gz 7543899 BLAKE2B 142ea7899be3728d2e857a83beebb8ff32dae6b7a71097de1474878a1728c6597937d03a828746af2464d6406ae80796b11579a10baacb66843bd535f971d940 SHA512 315e01e97f6a89afbbd0e36c17ee64d2744bc8ccce2e318f17ad5fba75599fdc55c303069c32aed07ba73c8ba9cdbacdb76c7ffe0c81681c1ef0be0ba405802e
diff --git a/net-analyzer/kapacitor/files/kapacitor.confd b/net-analyzer/kapacitor/files/kapacitor.confd
new file mode 100644 (file)
index 0000000..d58906a
--- /dev/null
@@ -0,0 +1,12 @@
+#The convention in this file is to show the default setting commented
+#out.
+#To change the setting, uncomment it then change the value.
+
+#This is the kapacitor error log:
+#error_log="/var/log/kapacitor/kapacitor.log"
+
+#This is the kapacitor output log:
+#output_log="/dev/null"
+
+# Extra options to pass to kapacitord:
+#kapacitor_opts=""
diff --git a/net-analyzer/kapacitor/files/kapacitor.rc b/net-analyzer/kapacitor/files/kapacitor.rc
new file mode 100644 (file)
index 0000000..8ee907f
--- /dev/null
@@ -0,0 +1,31 @@
+#!/sbin/openrc-run
+
+config=/etc/kapacitor/kapacitor.conf
+pidfile=/var/run/kapacitord.pid
+command=/usr/bin/kapacitord
+command_args="-config ${config} ${kapacitor_opts}"
+command_background=yes
+make_pidfile=yes
+command_user="kapacitor:kapacitor"
+
+# Logging
+error_log="${error_log:-/var/log/influxdb/influxd.log}"
+output_log="${output_log:-/dev/null}"
+
+# Max open files
+rc_ulimit="-n 65536"
+
+start_pre() {
+       # Check if config file exist
+       if [ ! -r ${config} ]; then
+               eerror "config file ${config} doesn't exist"
+           return 1
+       fi
+       if [ ! -f "$error_log" ]; then
+               mkdir -p "$(dirname $error_log)"
+       fi
+       if [ ! -f "$output_log" ]; then
+               mkdir -p "$(dirname $output_log)"
+       fi
+       return 0
+}
diff --git a/net-analyzer/kapacitor/kapacitor-1.4.1.ebuild b/net-analyzer/kapacitor/kapacitor-1.4.1.ebuild
new file mode 100644 (file)
index 0000000..dd49948
--- /dev/null
@@ -0,0 +1,48 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+EGO_PN=github.com/influxdata/kapacitor
+
+inherit golang-build golang-vcs-snapshot systemd user
+
+DESCRIPTION="Monitoring, processing and alerting on time series data"
+HOMEPAGE="https://www.influxdata.com"
+SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+pkg_setup() {
+       enewgroup kapacitor
+       enewuser kapacitor -1 -1 /var/lib/kapacitor kapacitor
+}
+
+src_compile() {
+       pushd "src/${EGO_PN}" > /dev/null || die
+       set -- env GOPATH="${S}" go build -v -work -x ./...
+       echo "$@"
+       "$@" || die "compile failed"
+       popd > /dev/null
+}
+
+src_install() {
+       pushd "src/${EGO_PN}" > /dev/null || die
+       set -- env GOPATH="${S}" go install -v -work -x ./...
+       echo "$@"
+       "$@" || die
+       dobin "${S}"/bin/kapacitor{,d}
+       insinto /etc/kapacitor
+doins etc/kapacitor/kapacitor.conf
+keepdir /etc/kapacitor/load
+       insinto /etc/logrotate.d
+       doins etc/logrotate.d/kapacitor
+       systemd_dounit scripts/kapacitor.service
+       keepdir /var/log/kapacitor
+       fowners kapacitor:kapacitor /var/log/kapacitor
+       newconfd "${FILESDIR}"/kapacitor.confd kapacitor
+       newinitd "${FILESDIR}"/kapacitor.rc kapacitor
+       popd > /dev/null || die
+}
diff --git a/net-analyzer/kapacitor/metadata.xml b/net-analyzer/kapacitor/metadata.xml
new file mode 100644 (file)
index 0000000..ed7262b
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>williamh@gentoo.org</email>
+               <name>William Hubbs</name>
+       </maintainer>
+       <longdescription lang="en">
+               Open source framework for processing, monitoring and alerting on
+               time series data.
+       </longdescription>
+</pkgmetadata>