summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Rüger <mrueg@gentoo.org>2018-03-30 16:39:32 +0200
committerManuel Rüger <mrueg@gentoo.org>2018-03-30 16:39:32 +0200
commitcd4e233eaddb7de0a652ff21870c906dc1d30ae8 (patch)
tree7f7408282751e7798523b0e7b316e9e6e16bd266 /app-metrics/snmp_exporter
parentapp-metrics/blackbox_exporter: Move package from net-analyzer/prometheus-blac... (diff)
downloadgentoo-cd4e233eaddb7de0a652ff21870c906dc1d30ae8.tar.gz
gentoo-cd4e233eaddb7de0a652ff21870c906dc1d30ae8.tar.bz2
gentoo-cd4e233eaddb7de0a652ff21870c906dc1d30ae8.zip
app-metrics/snmp_exporter: Move package from net-analyzer/prometheus-snmp_exporter
Diffstat (limited to 'app-metrics/snmp_exporter')
-rw-r--r--app-metrics/snmp_exporter/Manifest1
-rw-r--r--app-metrics/snmp_exporter/files/snmp_exporter.confd2
-rw-r--r--app-metrics/snmp_exporter/files/snmp_exporter.initd19
-rw-r--r--app-metrics/snmp_exporter/metadata.xml11
-rw-r--r--app-metrics/snmp_exporter/snmp_exporter-0.9.0.ebuild50
5 files changed, 83 insertions, 0 deletions
diff --git a/app-metrics/snmp_exporter/Manifest b/app-metrics/snmp_exporter/Manifest
new file mode 100644
index 000000000000..654466fae8ed
--- /dev/null
+++ b/app-metrics/snmp_exporter/Manifest
@@ -0,0 +1 @@
+DIST snmp_exporter-0.9.0.tar.gz 3257207 BLAKE2B 3e7e91d7e66b32e3f84c9e53061f54ffc10116913b91598edfa011663daf2c67314661dbe6cd5b2c20b30968833bd64a48bdd5dd06694e76f1e787d59ad63933 SHA512 eb287f4519f2174a9ce80414c2b7a698bc50e1bcb2303a8190164002af088e0694e01233314cfe2bd89b2cd751f2fd6f8447eb641541701b7bd481373ce084b1
diff --git a/app-metrics/snmp_exporter/files/snmp_exporter.confd b/app-metrics/snmp_exporter/files/snmp_exporter.confd
new file mode 100644
index 000000000000..c5e56a67e15e
--- /dev/null
+++ b/app-metrics/snmp_exporter/files/snmp_exporter.confd
@@ -0,0 +1,2 @@
+# arguments for prometheus snmp exporter
+command_args="--config.file=/etc/snmp_exporter/snmp.yml"
diff --git a/app-metrics/snmp_exporter/files/snmp_exporter.initd b/app-metrics/snmp_exporter/files/snmp_exporter.initd
new file mode 100644
index 000000000000..b214422704e2
--- /dev/null
+++ b/app-metrics/snmp_exporter/files/snmp_exporter.initd
@@ -0,0 +1,19 @@
+#!/sbin/openrc-run
+# Copyright 2016-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Prometheus snmp exporter"
+pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
+user=${user:-${RC_SVCNAME}}
+group=${group:-${RC_SVCNAME}}
+
+command="/usr/bin/snmp_exporter"
+command_args="${command_args:---config.file=/etc/snmp_exporter/snmp.yml}"
+command_background="true"
+start_stop_daemon_args="--user ${user} --group ${group} \
+ --stdout /var/log/snmp_exporter/${RC_SVCNAME}.log \
+ --stderr /var/log/snmp_exporter/${RC_SVCNAME}.log"
+
+depend() {
+ after net
+}
diff --git a/app-metrics/snmp_exporter/metadata.xml b/app-metrics/snmp_exporter/metadata.xml
new file mode 100644
index 000000000000..9ea37fba673a
--- /dev/null
+++ b/app-metrics/snmp_exporter/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>mrueg@gentoo.org</email>
+ <name>Manuel Rüger</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">prometheus/snmp_exporter</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-metrics/snmp_exporter/snmp_exporter-0.9.0.ebuild b/app-metrics/snmp_exporter/snmp_exporter-0.9.0.ebuild
new file mode 100644
index 000000000000..c81866ee8510
--- /dev/null
+++ b/app-metrics/snmp_exporter/snmp_exporter-0.9.0.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit user golang-build golang-vcs-snapshot
+
+EGO_PN="github.com/prometheus/snmp_exporter"
+EGIT_COMMIT="v${PV/_rc/-rc.}"
+SNMP_EXPORTER_COMMIT="abb143a"
+ARCHIVE_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="~amd64"
+
+DESCRIPTION="Prometheus exporter for snmp metrics"
+HOMEPAGE="https://github.com/prometheus/snmp_exporter"
+SRC_URI="${ARCHIVE_URI}"
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE=""
+
+DEPEND="dev-util/promu"
+
+pkg_setup() {
+ enewgroup ${PN}
+ enewuser ${PN} -1 -1 -1 ${PN}
+}
+
+src_prepare() {
+ default
+ sed -i -e "s/{{.Revision}}/${SNMP_EXPORTER_COMMIT}/" src/${EGO_PN}/.promu.yml || die
+}
+
+src_compile() {
+ pushd src/${EGO_PN} || die
+ mkdir -p bin || die
+ GOPATH="${S}" promu build -v --prefix bin || die
+ popd || die
+}
+
+src_install() {
+ pushd src/${EGO_PN} || die
+ dobin bin/snmp_exporter
+ dodoc {README,CONTRIBUTING}.md
+ insinto /etc/snmp_exporter
+ newins snmp.yml snmp.yml.example
+ popd || die
+ keepdir /var/lib/snmp_exporter /var/log/snmp_exporter
+ fowners ${PN}:${PN} /var/lib/snmp_exporter /var/log/snmp_exporter
+ newinitd "${FILESDIR}"/${PN}.initd ${PN}
+ newconfd "${FILESDIR}"/${PN}.confd ${PN}
+}