commit:     91fa43ef348cec7e91751f4fe05dc3ec280750c5
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 02:15:22 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 02:22:35 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91fa43ef

net-analyzer/prometheus-redis_exporter: new package

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 net-analyzer/prometheus-redis_exporter/Manifest    |  1 +
 .../files/prometheus-redis_exporter.confd          | 30 +++++++++++++
 .../files/prometheus-redis_exporter.initd          | 19 ++++++++
 .../files/prometheus-redis_exporter.logrotated     |  7 +++
 .../files/prometheus-redis_exporter.service        | 16 +++++++
 .../prometheus-redis_exporter/metadata.xml         | 11 +++++
 .../prometheus-redis_exporter-0.15.0.ebuild        | 52 ++++++++++++++++++++++
 7 files changed, 136 insertions(+)

diff --git a/net-analyzer/prometheus-redis_exporter/Manifest 
b/net-analyzer/prometheus-redis_exporter/Manifest
new file mode 100644
index 00000000000..1cdcc45ab03
--- /dev/null
+++ b/net-analyzer/prometheus-redis_exporter/Manifest
@@ -0,0 +1 @@
+DIST prometheus-redis_exporter-0.15.0.tar.gz 1232990 BLAKE2B 
ade899ef0f21594d3bb59c379f44d941e2a42f06a5c2ba5b304cc0b8b83def12eb036e6011a7d88abe7d97104ae663cb025ca60287ec9aba7be93a734d84c959
 SHA512 
8892306500943ec18d8fa5110fc6f4954ec886fca4d0023cdc2134ee2498c6f39ab06bec8f998ecde796cc2053b66103146503b76a185db3da5cbab81ebd9f2a

diff --git 
a/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.confd 
b/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.confd
new file mode 100644
index 00000000000..8573aef3540
--- /dev/null
+++ 
b/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.confd
@@ -0,0 +1,30 @@
+# -check-keys string
+#      Comma separated list of keys to export value and length/size
+# -debug
+#      Output verbose debug information
+# -log-format string
+#      Log format, valid options are txt and json (default "txt")
+# -namespace string
+#      Namespace for metrics (default "redis")
+# -redis-only-metrics
+#      Whether to export go runtime metrics also
+# -redis.addr string
+#      Address of one or more redis nodes, separated by separator
+# -redis.alias string
+#      Redis instance alias for one or more redis nodes, separated by separator
+# -redis.file string
+#      Path to file containing one or more redis nodes, separated by newline. 
NOTE: mutually exclusive with redis.addr
+# -redis.password string
+#      Password for one or more redis nodes, separated by separator
+# -separator string
+#      separator used to split redis.addr, redis.password and redis.alias into 
several elements. (default ",")
+# -use-cf-bindings
+#      Use Cloud Foundry service bindings
+# -version
+#      Show version information and exit
+# -web.listen-address string
+#      Address to listen on for web interface and telemetry. (default ":9121")
+# -web.telemetry-path string
+#      Path under which to expose metrics. (default "/metrics")
+
+#command_args="--web.listen-address=:9121 --redis.addr=localhost:6379"

diff --git 
a/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.initd 
b/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.initd
new file mode 100644
index 00000000000..741a0b4e468
--- /dev/null
+++ 
b/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_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 Exporter for Redis Metrics"
+pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
+user=${user:-${RC_SVCNAME}}
+group=${group:-${RC_SVCNAME}}
+
+command="/usr/bin/redis_exporter"
+command_args="${command_args:---web.listen-address=:9121 
--redis.addr=localhost:6379}"
+command_background="true"
+start_stop_daemon_args="--user ${user} --group ${group} \
+       --stdout /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log \
+       --stderr /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"
+
+depend() {
+       after net
+}

diff --git 
a/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.logrotated
 
b/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.logrotated
new file mode 100644
index 00000000000..b1252b3d13f
--- /dev/null
+++ 
b/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.logrotated
@@ -0,0 +1,7 @@
+/var/log/prometheus-redis_exporter/prometheus-redis_exporter.log {
+       missingok
+       size 5M
+       rotate 3
+       compress
+       copytruncate
+}

diff --git 
a/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.service
 
b/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.service
new file mode 100644
index 00000000000..9d2ba756a26
--- /dev/null
+++ 
b/net-analyzer/prometheus-redis_exporter/files/prometheus-redis_exporter.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Prometheus Exporter for Redis Metrics
+Documentation=https://github.com/oliver006/redis_exporter/
+After=network-online.target
+
+[Service]
+User=prometheus-redis_exporter
+Restart=on-failure
+Environment=REDIS_EXPORTER_ARGS="--web.listen-address=:9121 
--redis.addr=localhost:6379"
+ExecStart=/usr/bin/redis_exporter $REDIS_EXPORTER_ARGS
+ExecReload=/bin/kill -HUP $MAINPID
+TimeoutStopSec=20s
+SendSIGKILL=no
+
+[Install]
+WantedBy=multi-user.target

diff --git a/net-analyzer/prometheus-redis_exporter/metadata.xml 
b/net-analyzer/prometheus-redis_exporter/metadata.xml
new file mode 100644
index 00000000000..ad438766d9b
--- /dev/null
+++ b/net-analyzer/prometheus-redis_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>zmed...@gentoo.org</email>
+               <name>Zac Medico</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">oliver006/redis_exporter</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git 
a/net-analyzer/prometheus-redis_exporter/prometheus-redis_exporter-0.15.0.ebuild
 
b/net-analyzer/prometheus-redis_exporter/prometheus-redis_exporter-0.15.0.ebuild
new file mode 100644
index 00000000000..05ca8dce710
--- /dev/null
+++ 
b/net-analyzer/prometheus-redis_exporter/prometheus-redis_exporter-0.15.0.ebuild
@@ -0,0 +1,52 @@
+# 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 systemd
+
+EGO_PN="github.com/oliver006/redis_exporter"
+EGIT_COMMIT="a0d9e4c704b4d35cd08544d395038f417716a03a"
+ARCHIVE_URI="https://${EGO_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="~amd64"
+
+DESCRIPTION="Prometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x 
and 4.x"
+HOMEPAGE="https://github.com/oliver006/redis_exporter";
+SRC_URI="${ARCHIVE_URI}"
+LICENSE="MIT"
+SLOT="0"
+IUSE=""
+
+pkg_setup() {
+       enewgroup ${PN}
+       enewuser ${PN} -1 -1 -1 ${PN}
+}
+
+src_prepare() {
+       default
+       sed -e 
"s|\(^[[:space:]]*VERSION[[:space:]]*=[[:space:]]*\).*|\1\"${PV}\"|" \
+               -e 
"s|\(^[[:space:]]*BUILD_DATE[[:space:]]*=[[:space:]]*\).*|\1\"$(LC_ALL=C date 
-u)\"|" \
+               -e 
"s|\(^[[:space:]]*COMMIT_SHA1[[:space:]]*=[[:space:]]*\).*|\1\"${EGIT_COMMIT}\"|"
 \
+               -i src/${EGO_PN}/main.go || die
+}
+
+src_compile() {
+       pushd src/${EGO_PN} || die
+       GOPATH="${S}" \
+               go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
+       popd || die
+}
+
+src_install() {
+       dobin bin/redis_exporter
+       dodoc src/${EGO_PN}/README.md
+       local dir
+       for dir in /var/{lib,log}/${PN}; do
+               keepdir "${dir}"
+               fowners ${PN}:${PN} "${dir}"
+       done
+       newinitd "${FILESDIR}"/${PN}.initd ${PN}
+       newconfd "${FILESDIR}"/${PN}.confd ${PN}
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}/${PN}.logrotated" "${PN}"
+       systemd_dounit "${FILESDIR}/${PN}.service"
+}

Reply via email to