1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit linux-info systemd user
9 if [[ ${PV} == "9999" ]] ; then
10 EGIT_REPO_URI="git://github.com/firehol/${PN}.git"
11 inherit git-r3 autotools
15 SRC_URI="http://firehol.org/download/${PN}/releases/v${PV}/${P}.tar.xz"
16 KEYWORDS="~amd64 ~x86"
20 DESCRIPTION="Linux real time system monitoring, done right!"
21 HOMEPAGE="https://github.com/firehol/netdata http://netdata.firehol.org/"
23 LICENSE="GPL-3+ MIT BSD"
25 IUSE="+compression nfacct nodejs"
27 # most unconditional dependencies are for plugins.d/charts.d.plugin:
33 compression? ( sys-libs/zlib )
45 # check for Kernel-Samepage-Merging (CONFIG_KSM)
50 : ${NETDATA_USER:=netdata}
56 enewuser ${PN} -1 -1 / ${PN}
61 [[ ${PV} == "9999" ]] && eautoreconf
66 --localstatedir=/var \
67 --with-user=${NETDATA_USER} \
68 $(use_enable nfacct plugin-nfacct) \
69 $(use_with compression zlib)
75 fowners ${NETDATA_USER} /var/log/netdata
77 chown -Rc ${NETDATA_USER} "${ED}"/usr/share/${PN} || die
79 cat >> "${T}"/${PN}-sysctl <<- EOF
81 kernel.mm.ksm.sleep_millisecs = 1000
84 dodoc "${T}"/${PN}-sysctl
86 newinitd system/netdata-openrc ${PN}
87 systemd_dounit system/netdata.service
91 if [[ -e "/sys/kernel/mm/ksm/run" ]]; then
94 elog "I see you have kernel memory de-duper (called Kernel Same-page Merging,"
95 elog "or KSM) available, but it is not currently enabled."
97 elog "To enable it run:"
99 elog "echo 1 >/sys/kernel/mm/ksm/run"
100 elog "echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs"
102 elog "If you enable it, you will save 20-60% of netdata memory."
106 elog "I see you do not have kernel memory de-duper (called Kernel Same-page"
107 elog "Merging, or KSM) available."
109 elog "To enable it, you need a kernel built with CONFIG_KSM=y"
111 elog "If you can have it, you will save 20-60% of netdata memory."