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}
51 : ${NETDATA_GROUP:=netdata}
57 enewuser ${PN} -1 -1 / ${PN}
62 [[ ${PV} == "9999" ]] && eautoreconf
67 --localstatedir=/var \
68 --with-user=${NETDATA_USER} \
69 $(use_enable nfacct plugin-nfacct) \
70 $(use_with compression zlib)
76 fowners ${NETDATA_USER}:${NETDATA_GROUP} /var/log/netdata
77 fowners ${NETDATA_USER}:${NETDATA_GROUP} /var/cache/netdata
79 chown -Rc ${NETDATA_USER}:${NETDATA_GROUP} "${ED}"/usr/share/${PN} || die
81 cat >> "${T}"/${PN}-sysctl <<- EOF
83 kernel.mm.ksm.sleep_millisecs = 1000
86 dodoc "${T}"/${PN}-sysctl
88 newinitd system/netdata-openrc ${PN}
89 systemd_dounit system/netdata.service
93 if [[ -e "/sys/kernel/mm/ksm/run" ]]; then
96 elog "I see you have kernel memory de-duper (called Kernel Same-page Merging,"
97 elog "or KSM) available, but it is not currently enabled."
99 elog "To enable it run:"
101 elog "echo 1 >/sys/kernel/mm/ksm/run"
102 elog "echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs"
104 elog "If you enable it, you will save 20-60% of netdata memory."
108 elog "I see you do not have kernel memory de-duper (called Kernel Same-page"
109 elog "Merging, or KSM) available."
111 elog "To enable it, you need a kernel built with CONFIG_KSM=y"
113 elog "If you can have it, you will save 20-60% of netdata memory."