app-metrics/collectd: arm stable wrt bug #704342
[gentoo.git] / app-metrics / bind_exporter / bind_exporter-0.2.0_p20190226.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit user golang-build golang-vcs-snapshot
6
7 EGO_PN="github.com/digitalocean/bind_exporter"
8 EXPORTER_COMMIT="9289b40af62a455ebd587ed4701dd543f4cc5877"
9 ARCHIVE_URI="https://${EGO_PN}/archive/${EXPORTER_COMMIT}.tar.gz -> ${P}.tar.gz"
10 KEYWORDS="~amd64"
11
12 DESCRIPTION="Prometheus exporter for BIND"
13 HOMEPAGE="https://github.com/digitalocean/bind_exporter"
14 SRC_URI="${ARCHIVE_URI}"
15 LICENSE="Apache-2.0 BSD MIT"
16 SLOT="0"
17 IUSE=""
18
19 DEPEND="dev-util/promu"
20
21 pkg_setup() {
22         enewgroup ${PN}
23         enewuser ${PN} -1 -1 -1 ${PN}
24 }
25
26 src_prepare() {
27         default
28         sed -i -e "/-s$/d" -e "s/{{.Revision}}/${EXPORTER_COMMIT}/" src/${EGO_PN}/.promu.yml || die
29 }
30
31 src_compile() {
32         pushd src/${EGO_PN} || die
33         mkdir -p bin || die
34         GOPATH="${S}" promu build -v --prefix bin || die
35         popd || die
36 }
37
38 src_install() {
39         pushd src/${EGO_PN} || die
40         dobin bin/${PN}
41         dodoc {README,CHANGELOG}.md
42         popd || die
43         keepdir /var/log/${PN}
44         fowners ${PN}:${PN} /var/log/${PN}
45         newinitd "${FILESDIR}"/${PN}.initd ${PN}
46         newconfd "${FILESDIR}"/${PN}.confd ${PN}
47 }
48
49 pkg_postinst() {
50         elog "Make sure BIND was built with libxml2 support. You can check with the"
51         elog "following command: named -V | grep libxml2."
52         elog "Configure BIND to open a statistics channel. It's recommended to run"
53         elog "the bind_exporter next to BIND, so it's only necessary to open a port"
54         elog "locally."
55         elog ""
56         elog "statistics-channels {"
57         elog "inet 127.0.0.1 port 8053 allow { 127.0.0.1; };"
58         elog "};"
59 }