net-analyzer/netdata: Add mongodb, prometheus, kinesis, and jsonc USE flags
authorCraig Andrews <candrews@gentoo.org>
Sun, 5 Jan 2020 20:28:48 +0000 (15:28 -0500)
committerCraig Andrews <candrews@gentoo.org>
Sun, 5 Jan 2020 21:23:31 +0000 (16:23 -0500)
Closes: https://bugs.gentoo.org/704804
Closes: https://bugs.gentoo.org/704806
Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Craig Andrews <candrews@gentoo.org>
net-analyzer/netdata/files/netdata-1.19.0-prometheus-spelling.patch [new file with mode: 0644]
net-analyzer/netdata/metadata.xml
net-analyzer/netdata/netdata-1.19.0-r2.ebuild [new file with mode: 0644]
net-analyzer/netdata/netdata-9999.ebuild

diff --git a/net-analyzer/netdata/files/netdata-1.19.0-prometheus-spelling.patch b/net-analyzer/netdata/files/netdata-1.19.0-prometheus-spelling.patch
new file mode 100644 (file)
index 0000000..25c8dd4
--- /dev/null
@@ -0,0 +1,20 @@
+https://github.com/netdata/netdata/pull/7674
+
+From d19b834d0011485759604ecfa095a898b597d8e0 Mon Sep 17 00:00:00 2001
+From: Craig Andrews <candrews@integralblue.com>
+Date: Sun, 5 Jan 2020 16:13:18 -0500
+Subject: [PATCH] Fix spelling of Prometheus (#7673)
+
+diff --git a/configure.ac b/configure.ac
+index 00927ba8b1..8b2facb966 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -999,7 +999,7 @@ test "${enable_backend_prometheus_remote_write}" = "yes" -a "${have_CXX_compiler
+     AC_MSG_ERROR([C++ compiler required but not found. try installing g++])
+ AC_MSG_CHECKING([if prometheus remote write backend should be enabled])
+-if test "${enable_backend_prometeus_remote_write}" != "no" -a "${have_libprotobuf}" = "yes" -a "${have_libsnappy}" = "yes" \
++if test "${enable_backend_prometheus_remote_write}" != "no" -a "${have_libprotobuf}" = "yes" -a "${have_libsnappy}" = "yes" \
+                                                            -a "${have_protoc}" = "yes" -a "${have_CXX_compiler}" = "yes"; then
+     enable_backend_prometheus_remote_write="yes"
+     AC_DEFINE([ENABLE_PROMETHEUS_REMOTE_WRITE], [1], [Prometheus remote write API usability])
index a160e06f36577957a5b9758e1a1ffe5cce8ffc03..70b99cd52f398d61db2f9bfa8e64ac91d7df05d6 100644 (file)
@@ -9,8 +9,12 @@
     <flag name="compression">Enable compression via zlib</flag>
     <flag name="dbengine">Enable the Netdata database engine</flag>
     <flag name="ipmi">Install <pkg>sys-apps/ipmitool</pkg> required for monitoring IPMI sensors.</flag>
+    <flag name="jsonc">Enable optimization of JSON using <pkg>dev-libs/json-c</pkg></flag>
+    <flag name="kinesis">Enable support for Amazon Kenesis as a backend</flag>
+    <flag name="mongodb">Enable support for the mongodb backend</flag>
     <flag name="nfacct">Enable the nfacct plugin</flag>
     <flag name="nodejs">Enable use of nodejs (which some plugins use)</flag>
+    <flag name="prometheus">Enable support for the Prometheus remote write backend</flag>
     <flag name="tor">Enable monitoring of tor</flag>
     <flag name="xen">Enable monitoring of xen</flag>
   </use>
diff --git a/net-analyzer/netdata/netdata-1.19.0-r2.ebuild b/net-analyzer/netdata/netdata-1.19.0-r2.ebuild
new file mode 100644 (file)
index 0000000..9ba4f31
--- /dev/null
@@ -0,0 +1,145 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} )
+
+inherit autotools fcaps linux-info python-r1 systemd
+
+if [[ ${PV} == *9999 ]] ; then
+       EGIT_REPO_URI="https://github.com/netdata/${PN}.git"
+       inherit git-r3
+else
+       SRC_URI="https://github.com/netdata/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+       KEYWORDS="~amd64 ~x86"
+fi
+
+DESCRIPTION="Linux real time system monitoring, done right!"
+HOMEPAGE="https://github.com/netdata/netdata https://my-netdata.io/"
+
+LICENSE="GPL-3+ MIT BSD"
+SLOT="0"
+IUSE="caps +compression cpu_flags_x86_sse2 cups +dbengine ipmi +jsonc kinesis mongodb mysql nfacct nodejs postgres prometheus +python tor xen"
+REQUIRED_USE="
+       mysql? ( python )
+       python? ( ${PYTHON_REQUIRED_USE} )
+       tor? ( python )"
+
+# most unconditional dependencies are for plugins.d/charts.d.plugin:
+RDEPEND="
+       acct-group/netdata
+       acct-user/netdata
+       app-misc/jq
+       >=app-shells/bash-4:0
+       || (
+               net-analyzer/openbsd-netcat
+               net-analyzer/netcat
+       )
+       net-misc/curl
+       net-misc/wget
+       sys-apps/util-linux
+       virtual/awk
+       caps? ( sys-libs/libcap )
+       cups? ( net-print/cups )
+       dbengine? (
+               dev-libs/libuv
+               app-arch/lz4
+               dev-libs/judy
+               dev-libs/openssl:=
+       )
+       compression? ( sys-libs/zlib )
+       ipmi? ( sys-libs/freeipmi )
+       jsonc? ( dev-libs/json-c )
+       kinesis? ( dev-libs/aws-sdk-cpp )
+       mongodb? ( dev-libs/mongo-c-driver )
+       nfacct? (
+               net-firewall/nfacct
+               net-libs/libmnl
+       )
+       nodejs? ( net-libs/nodejs )
+       prometheus? (
+               dev-libs/protobuf:=
+               app-arch/snappy
+       )
+       python? (
+               ${PYTHON_DEPS}
+               dev-python/pyyaml[${PYTHON_USEDEP}]
+               mysql? (
+                       || (
+                               dev-python/mysqlclient[${PYTHON_USEDEP}]
+                               dev-python/mysql-python[${PYTHON_USEDEP}]
+                       )
+               )
+               postgres? ( dev-python/psycopg:2[${PYTHON_USEDEP}] )
+               tor? ( net-libs/stem[${PYTHON_USEDEP}] )
+       )
+       xen? (
+               app-emulation/xen-tools
+               dev-libs/yajl
+       )"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig"
+
+FILECAPS=(
+       'cap_dac_read_search,cap_sys_ptrace+ep' 'usr/libexec/netdata/plugins.d/apps.plugin'
+)
+
+PATCHES=(
+       "${FILESDIR}/${P}-prometheus-spelling.patch"
+)
+
+pkg_setup() {
+       linux-info_pkg_setup
+}
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               --localstatedir="${EPREFIX}"/var \
+               --with-user=netdata \
+               $(use_enable jsonc) \
+               $(use_enable cups plugin-cups) \
+               $(use_enable dbengine) \
+               $(use_enable nfacct plugin-nfacct) \
+               $(use_enable ipmi plugin-freeipmi) \
+               $(use_enable kinesis backend-kinesis) \
+               $(use_enable mongodb backend-mongodb) \
+               $(use_enable prometheus backend-prometheus-remote-write) \
+               $(use_enable xen plugin-xenstat) \
+               $(use_enable cpu_flags_x86_sse2 x86-sse) \
+               $(use_with compression zlib)
+}
+
+src_install() {
+       default
+
+       rm -rf "${D}/var/cache" || die
+
+       # Remove unneeded .keep files
+       find "${ED}" -name ".keep" -delete || die
+
+       fowners -Rc netdata:netdata /var/log/netdata
+       keepdir /var/log/netdata
+       fowners -Rc netdata:netdata /var/lib/netdata
+       keepdir /var/lib/netdata
+       keepdir /var/lib/netdata/registry
+
+       fowners -Rc root:netdata /usr/share/${PN}
+
+       newinitd system/netdata-openrc ${PN}
+       systemd_dounit system/netdata.service
+       insinto /etc/netdata
+       doins system/netdata.conf
+}
+
+pkg_postinst() {
+       fcaps_pkg_postinst
+
+       if use xen ; then
+               fcaps 'cap_dac_override' 'usr/libexec/netdata/plugins.d/xenstat.plugin'
+       fi
+}
index 0443e6b587fd282252494bf2b4661fd398ab4766..6661c14a9a1955dd18d971eb1731ca56ad1c9cb5 100644 (file)
@@ -19,7 +19,7 @@ HOMEPAGE="https://github.com/netdata/netdata https://my-netdata.io/"
 
 LICENSE="GPL-3+ MIT BSD"
 SLOT="0"
-IUSE="caps +compression cpu_flags_x86_sse2 cups +dbengine ipmi mysql nfacct nodejs postgres +python tor xen"
+IUSE="caps +compression cpu_flags_x86_sse2 cups +dbengine ipmi +jsonc kinesis mongodb mysql nfacct nodejs postgres prometheus +python tor xen"
 REQUIRED_USE="
        mysql? ( python )
        python? ( ${PYTHON_REQUIRED_USE} )
@@ -49,11 +49,18 @@ RDEPEND="
        )
        compression? ( sys-libs/zlib )
        ipmi? ( sys-libs/freeipmi )
+       jsonc? ( dev-libs/json-c )
+       kinesis? ( dev-libs/aws-sdk-cpp )
+       mongodb? ( dev-libs/mongo-c-driver )
        nfacct? (
                net-firewall/nfacct
                net-libs/libmnl
        )
        nodejs? ( net-libs/nodejs )
+       prometheus? (
+               dev-libs/protobuf:=
+               app-arch/snappy
+       )
        python? (
                ${PYTHON_DEPS}
                dev-python/pyyaml[${PYTHON_USEDEP}]
@@ -90,11 +97,14 @@ src_configure() {
        econf \
                --localstatedir="${EPREFIX}"/var \
                --with-user=netdata \
-               --disable-jsonc \
+               $(use_enable jsonc) \
                $(use_enable cups plugin-cups) \
                $(use_enable dbengine) \
                $(use_enable nfacct plugin-nfacct) \
                $(use_enable ipmi plugin-freeipmi) \
+               $(use_enable kinesis backend-kinesis) \
+               $(use_enable mongodb backend-mongodb) \
+               $(use_enable prometheus backend-prometheus-remote-write) \
                $(use_enable xen plugin-xenstat) \
                $(use_enable cpu_flags_x86_sse2 x86-sse) \
                $(use_with compression zlib)