summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin/metricbeat')
-rw-r--r--app-admin/metricbeat/Manifest1
-rw-r--r--app-admin/metricbeat/files/metricbeat.confd15
-rw-r--r--app-admin/metricbeat/files/metricbeat.initd43
-rw-r--r--app-admin/metricbeat/files/metricbeat.service12
-rw-r--r--app-admin/metricbeat/metricbeat-6.2.4.ebuild62
5 files changed, 133 insertions, 0 deletions
diff --git a/app-admin/metricbeat/Manifest b/app-admin/metricbeat/Manifest
new file mode 100644
index 0000000..5926eff
--- /dev/null
+++ b/app-admin/metricbeat/Manifest
@@ -0,0 +1 @@
+DIST metricbeat-6.2.4.tar.gz 19466271 BLAKE2B 417f1db19b7fdd9bcf66f2c3dcdf2aaa6be9ba5edff1c97a0b8f4a5d7953ef27bcbd860e097fb40e67b3b42b795b684dabb2995eee572243831f749a7184b625 SHA512 49293e28e4ca769a88f7b889ea888a559ae7e142698714e24bf5519d00c2030237cac591590aa284f17792906a6137333173716ddf5db4496217f8b5a054b19c
diff --git a/app-admin/metricbeat/files/metricbeat.confd b/app-admin/metricbeat/files/metricbeat.confd
new file mode 100644
index 0000000..30cbbd3
--- /dev/null
+++ b/app-admin/metricbeat/files/metricbeat.confd
@@ -0,0 +1,15 @@
+# Run metricbeat under this user/group
+#METRICBEAT_USER=""
+#METRICBEAT_GROUP=""
+
+# Configuration path
+#METRICBEAT_CONFIG=""
+
+# Path to data directory
+#METRICBEAT_DATADIR=""
+
+# Path to log directory
+#METRICBEAT_LOGDIR=""
+
+# Additional arguments passed to metricbeat
+#METRICBEAT_OPTS=""
diff --git a/app-admin/metricbeat/files/metricbeat.initd b/app-admin/metricbeat/files/metricbeat.initd
new file mode 100644
index 0000000..5e47a07
--- /dev/null
+++ b/app-admin/metricbeat/files/metricbeat.initd
@@ -0,0 +1,43 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+METRICBEAT_USER="${METRICBEAT_USER:-root}"
+METRICBEAT_GROUP="${METRICBEAT_GROUP:-root}"
+METRICBEAT_CONFIG="${METRICBEAT_CONFIG:-/etc/metricbeat/metricbeat.yml}"
+METRICBEAT_DATADIR="${METRICBEAT_DATADIR:-/var/lib/metricbeat}"
+METRICBEAT_LOGDIR="${METRICBEAT_LOGDIR:-/var/log/metricbeat}"
+METRICBEAT_OPTS="${METRICBEAT_OPTS:-}"
+
+command="/usr/bin/METRICBEAT"
+command_args="-c ${METRICBEAT_CONFIG} ${METRICBEAT_OPTS} -path.config $(dirname $METRICBEAT_CONFIG) \
+ -path.data ${METRICBEAT_DATADIR} -path.home ${METRICBEAT_DATADIR} -path.logs ${METRICBEAT_LOGDIR}"
+command_background="true"
+command_user="${METRICBEAT_USER}:${METRICBEAT_GROUP}"
+extra_commands="checkconfig"
+pidfile="/run/metricbeat.pid"
+retry="TERM/5/KILL/5"
+start_stop_daemon_args="--chdir ${METRICBEAT_DATADIR}"
+
+depend() {
+ use net
+ after elasticsearch
+}
+
+checkconfig() {
+ if [ ! -e ${METRICBEAT_CONFIG} ]; then
+ eend "Please create a configuration file at ${METRICBEAT_CONFIG}"
+ return 1
+ fi
+
+ ebegin "Checking your configuration"
+ ${command} ${command_args} test config
+ eend $? "Configuration error. Please fix your configuration files."
+}
+
+start_pre() {
+ checkconfig || return 1
+
+ checkpath -d -o "${METRICBEAT_USER}":"${METRICBEAT_GROUP}" -m750 "${METRICBEAT_DATADIR}"
+ checkpath -d -o "${METRICBEAT_USER}":"${METRICBEAT_GROUP}" -m750 "${METRICBEAT_LOGDIR}"
+}
diff --git a/app-admin/metricbeat/files/metricbeat.service b/app-admin/metricbeat/files/metricbeat.service
new file mode 100644
index 0000000..d463df7
--- /dev/null
+++ b/app-admin/metricbeat/files/metricbeat.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Metricbeat Service
+After=network.target
+
+[Service]
+Restart=always
+RemainAfterExit=yes
+WorkingDirectory=/var/log/metricbeat
+ExecStart=/usr/bin/metricbeat -c /etc/metricbeat/metricbeat.yml -path.config /etc/metricbeat -path.data /var/lib/metricbeat -path.home /var/lib/metricbeat -path.logs /var/log/metricbeat
+
+[Install]
+WantedBy=multi-user.target
diff --git a/app-admin/metricbeat/metricbeat-6.2.4.ebuild b/app-admin/metricbeat/metricbeat-6.2.4.ebuild
new file mode 100644
index 0000000..74f5243
--- /dev/null
+++ b/app-admin/metricbeat/metricbeat-6.2.4.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eapi7-ver systemd
+
+DESCRIPTION="Lightweight log shipper for Logstash and Elasticsearch"
+HOMEPAGE="https://www.elastic.co/products/beats"
+SRC_URI="https://github.com/elastic/beats/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+RESTRICT="test"
+
+DEPEND=">=dev-lang/go-1.9.2"
+
+S="${WORKDIR}/src/github.com/elastic/beats"
+
+src_unpack() {
+ mkdir -p "${S%/*}" || die
+ default
+ mv beats-${PV} "${S}" || die
+}
+
+src_compile() {
+ GOPATH="${WORKDIR}" emake -C "${S}/metricbeat"
+}
+
+src_install() {
+ keepdir /var/{lib,log}/${PN}
+
+ fperms 0750 /var/{lib,log}/${PN}
+
+ newconfd "${FILESDIR}/${PN}.confd" ${PN}
+ newinitd "${FILESDIR}/${PN}.initd" ${PN}
+ systemd_dounit "${FILESDIR}/${PN}.service"
+
+ dobin metricbeat/metricbeat
+
+ docinto examples
+ dodoc ${PN}/{metricbeat.yml,metricbeat.reference.yml}
+
+ insinto "/etc/${PN}"
+ doins ${PN}/metricbeat.yml
+ insinto "/etc/${PN}/module"
+ doins -r ${PN}/module/*
+ insinto "/etc/${PN}/modules.d"
+ doins -r ${PN}/modules.d/*
+}
+
+pkg_postinst() {
+ if [[ -n "${REPLACING_VERSIONS}" ]]; then
+ elog "Please read the migration guide at:"
+ elog "https://www.elastic.co/guide/en/beats/libbeat/$(ver_cut 1-2)/upgrading.html"
+ elog ""
+ fi
+
+ elog "Example configurations:"
+ elog "${EROOT%/}/usr/share/doc/${PF}/examples"
+}