summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Rüger <mrueg@gentoo.org>2019-02-14 13:29:20 +0100
committerManuel Rüger <mrueg@gentoo.org>2019-02-14 13:30:01 +0100
commit39690245afe5515189d17439d2f1705a7ba8fd7e (patch)
tree423a4c3c123c307375499b768caef11eed599923 /app-metrics/node_exporter
parentmedia-libs/giflib: Use reallocarray() if available. (diff)
downloadgentoo-39690245afe5515189d17439d2f1705a7ba8fd7e.tar.gz
gentoo-39690245afe5515189d17439d2f1705a7ba8fd7e.tar.bz2
gentoo-39690245afe5515189d17439d2f1705a7ba8fd7e.zip
app-metrics/node_exporter: Add systemd unit
Package-Manager: Portage-2.3.59, Repoman-2.3.12 Signed-off-by: Manuel Rüger <mrueg@gentoo.org>
Diffstat (limited to 'app-metrics/node_exporter')
-rw-r--r--app-metrics/node_exporter/node_exporter-0.17.0-r1.ebuild52
1 files changed, 52 insertions, 0 deletions
diff --git a/app-metrics/node_exporter/node_exporter-0.17.0-r1.ebuild b/app-metrics/node_exporter/node_exporter-0.17.0-r1.ebuild
new file mode 100644
index 000000000000..bd80fb15c828
--- /dev/null
+++ b/app-metrics/node_exporter/node_exporter-0.17.0-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit user golang-build golang-vcs-snapshot systemd
+
+EGO_PN="github.com/prometheus/node_exporter"
+EGIT_COMMIT="v${PV/_rc/-rc.}"
+NODE_EXPORTER_COMMIT="f6f6194"
+ARCHIVE_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="~amd64"
+
+DESCRIPTION="Prometheus exporter for machine metrics"
+HOMEPAGE="https://github.com/prometheus/node_exporter"
+SRC_URI="${ARCHIVE_URI}"
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=dev-lang/go-1.11
+ dev-util/promu"
+
+pkg_setup() {
+ enewgroup ${PN}
+ enewuser ${PN} -1 -1 -1 ${PN}
+}
+
+src_prepare() {
+ default
+ sed -i -e "s/{{.Revision}}/${NODE_EXPORTER_COMMIT}/" src/${EGO_PN}/.promu.yml || die
+}
+
+src_compile() {
+ pushd src/${EGO_PN} || die
+ mkdir -p bin || die
+ GO111MODULE=on GOPATH="${S}" promu build -v --prefix node_exporter || die
+ popd || die
+}
+
+src_install() {
+ pushd src/${EGO_PN} || die
+ dobin node_exporter/node_exporter
+ dodoc {README,CHANGELOG,CONTRIBUTING}.md
+ systemd_dounit examples/systemd/node_exporter.service
+ insinto /etc/sysconfig/node_exporter
+ doins examples/systemd/sysconfig.node_exporter
+ popd || die
+ keepdir /var/lib/node_exporter /var/log/node_exporter
+ fowners ${PN}:${PN} /var/lib/node_exporter /var/log/node_exporter
+ newinitd "${FILESDIR}"/${PN}-1.initd ${PN}
+ newconfd "${FILESDIR}"/${PN}.confd ${PN}
+}