netdata.spec.in 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. # SPDX-License-Identifier: GPL-3.0+
  2. %global contentdir %{_datadir}/netdata
  3. # This is temporary and should eventually be resolved. This bypasses
  4. # the default rhel __os_install_post which throws a python compile
  5. # error.
  6. %global __os_install_post %{nil}
  7. #
  8. # Conditional build:
  9. %bcond_without systemd # systemd
  10. %bcond_with nfacct # build with nfacct plugin
  11. %bcond_with freeipmi # build with freeipmi plugin
  12. %bcond_with netns # build with netns support (cgroup-network)
  13. %if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1140
  14. %else
  15. %undefine with_systemd
  16. %undefine with_netns
  17. %endif
  18. %if %{with systemd}
  19. %if 0%{?suse_version}
  20. %global netdata_initd_buildrequires \
  21. BuildRequires: systemd-rpm-macros \
  22. %{nil}
  23. %global netdata_initd_requires \
  24. %{?systemd_requires} \
  25. %{nil}
  26. %global netdata_init_post %service_add_post netdata.service
  27. %global netdata_init_preun %service_del_preun netdata.service
  28. %global netdata_init_postun %service_del_postun netdata.service
  29. %else
  30. %global netdata_initd_buildrequires \
  31. BuildRequires: systemd
  32. %global netdata_initd_requires \
  33. Requires(preun): systemd-units \
  34. Requires(postun): systemd-units \
  35. Requires(post): systemd-units \
  36. %{nil}
  37. %global netdata_init_post %systemd_post netdata.service
  38. %global netdata_init_preun %systemd_preun netdata.service
  39. %global netdata_init_postun %systemd_postun_with_restart netdata.service
  40. %endif
  41. %else
  42. %global netdata_initd_buildrequires %{nil}
  43. %global netdata_initd_requires \
  44. Requires(post): chkconfig \
  45. %{nil}
  46. %global netdata_init_post \
  47. /sbin/chkconfig --add netdata \
  48. %{nil}
  49. %global netdata_init_preun %{nil} \
  50. if [ $1 = 0 ]; then \
  51. /sbin/service netdata stop > /dev/null 2>&1 \
  52. /sbin/chkconfig --del netdata \
  53. fi \
  54. %{nil}
  55. %global netdata_init_postun %{nil} \
  56. if [ $1 != 0 ]; then \
  57. /sbin/service netdata condrestart 2>&1 > /dev/null \
  58. fi \
  59. %{nil}
  60. %endif
  61. %if 0%{?_fedora}
  62. %global netdata_recommends \
  63. Recommends: curl \
  64. Recommends: iproute-tc \
  65. Recommends: lm_sensors \
  66. Recommends: nmap-ncat \
  67. Recommends: nodejs \
  68. Recommends: python \
  69. Recommends: PyYAML \
  70. Recommends: python2-PyMySQL \
  71. Recommends: python2-psycopg2 \
  72. %{nil}
  73. %else
  74. %global netdata_recommends %{nil}
  75. %endif
  76. Summary: Real-time performance monitoring, done right
  77. Name: @PACKAGE_NAME@
  78. Version: @PACKAGE_RPM_VERSION@
  79. Release: 1%{?dist}
  80. License: GPLv3+
  81. Group: Applications/System
  82. Source0: https://github.com/firehol/%{name}/releases/download/v@PACKAGE_VERSION@/%{name}-@PACKAGE_VERSION@.tar.xz
  83. URL: http://my-netdata.io
  84. BuildRequires: pkgconfig
  85. BuildRequires: xz
  86. BuildRequires: zlib-devel
  87. BuildRequires: libuuid-devel
  88. Requires: zlib
  89. Requires: libuuid
  90. # Packages can be found in the EPEL repo
  91. %if %{with nfacct}
  92. BuildRequires: libmnl-devel
  93. BuildRequires: libnetfilter_acct-devel
  94. Requires: libmnl
  95. Requires: libnetfilter_acct
  96. %endif
  97. %if %{with freeipmi}
  98. BuildRequires: freeipmi-devel
  99. Requires: freeipmi
  100. %endif
  101. Requires(pre): /usr/sbin/groupadd
  102. Requires(pre): /usr/sbin/useradd
  103. Requires(post): libcap
  104. %{netdata_initd_buildrequires}
  105. %{netdata_recommends}
  106. %{netdata_initd_requires}
  107. %description
  108. netdata is the fastest way to visualize metrics. It is a resource
  109. efficient, highly optimized system for collecting and visualizing any
  110. type of realtime timeseries data, from CPU usage, disk activity, SQL
  111. queries, API calls, web site visitors, etc.
  112. netdata tries to visualize the truth of now, in its greatest detail,
  113. so that you can get insights of what is happening now and what just
  114. happened, on your systems and applications.
  115. %prep
  116. %setup -q -n @PACKAGE_NAME@-@PACKAGE_VERSION@
  117. %build
  118. %configure \
  119. --with-zlib \
  120. --with-math \
  121. %{?with_nfacct:--enable-plugin-nfacct} \
  122. %{?with_freeipmi:--enable-plugin-freeipmi} \
  123. --with-user=netdata
  124. %{__make} %{?_smp_mflags}
  125. %install
  126. rm -rf "${RPM_BUILD_ROOT}"
  127. %{__make} %{?_smp_mflags} DESTDIR="${RPM_BUILD_ROOT}" install
  128. find "${RPM_BUILD_ROOT}" -name .keep -delete
  129. install -m 644 -p system/netdata.conf "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}"
  130. install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d"
  131. install -m 644 -p system/netdata.logrotate "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}"
  132. %if %{with systemd}
  133. install -m 755 -d "${RPM_BUILD_ROOT}%{_unitdir}"
  134. install -m 644 -p system/netdata.service "${RPM_BUILD_ROOT}%{_unitdir}/netdata.service"
  135. %else
  136. # install SYSV init stuff
  137. install -d "${RPM_BUILD_ROOT}/etc/rc.d/init.d"
  138. install -m 755 system/netdata-init-d \
  139. "${RPM_BUILD_ROOT}/etc/rc.d/init.d/netdata"
  140. %endif
  141. %pre
  142. getent group netdata >/dev/null || groupadd -r netdata
  143. getent group docker >/dev/null || groupadd -r docker
  144. getent passwd netdata >/dev/null || \
  145. useradd -r -g netdata -G docker -s /sbin/nologin \
  146. -d %{contentdir} -c "netdata" netdata
  147. %post
  148. %{netdata_init_post}
  149. %preun
  150. %{netdata_init_preun}
  151. %postun
  152. %{netdata_init_postun}
  153. %clean
  154. rm -rf "${RPM_BUILD_ROOT}"
  155. %files
  156. %doc README.md
  157. %defattr(-,root,root)
  158. %dir %{_sysconfdir}/%{name}
  159. %config(noreplace) %{_sysconfdir}/%{name}/*.conf
  160. %config(noreplace) %{_sysconfdir}/%{name}/charts.d/*.conf
  161. %config(noreplace) %{_sysconfdir}/%{name}/health.d/*.conf
  162. #%%config(noreplace) %{_sysconfdir}/%{name}/node.d/*.conf
  163. %config(noreplace) %{_sysconfdir}/%{name}/python.d/*.conf
  164. %config(noreplace) %{_sysconfdir}/%{name}/statsd.d/*.conf
  165. %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
  166. # To be eventually moved to %%_defaultdocdir
  167. %{_sysconfdir}/%{name}/node.d/*.md
  168. %{_libexecdir}/%{name}
  169. %{_sbindir}/%{name}
  170. %caps(cap_dac_read_search,cap_sys_ptrace=ep) %attr(0550,root,netdata) %{_libexecdir}/%{name}/plugins.d/apps.plugin
  171. %if %{with netns}
  172. # cgroup-network detects the network interfaces of CGROUPs
  173. # it must be able to use setns() and run cgroup-network-helper.sh as root
  174. # the helper script reads /proc/PID/fdinfo/* files, runs virsh, etc.
  175. %caps(cap_setuid=ep) %attr(4550,root,netdata) %{_libexecdir}/%{name}/plugins.d/cgroup-network
  176. %attr(0550,root,root) %{_libexecdir}/%{name}/plugins.d/cgroup-network-helper.sh
  177. %endif
  178. %if %{with freeipmi}
  179. %caps(cap_setuid=ep) %attr(4550,root,netdata) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin
  180. %endif
  181. %attr(0770,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
  182. %attr(0770,netdata,netdata) %dir %{_localstatedir}/log/%{name}
  183. %attr(0770,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
  184. %dir %{_datadir}/%{name}
  185. %dir %{_sysconfdir}/%{name}/health.d
  186. %dir %{_sysconfdir}/%{name}/python.d
  187. %dir %{_sysconfdir}/%{name}/charts.d
  188. %dir %{_sysconfdir}/%{name}/node.d
  189. %if %{with systemd}
  190. %{_unitdir}/netdata.service
  191. %else
  192. %{_sysconfdir}/rc.d/init.d/netdata
  193. %endif
  194. # Enforce 0644 for files and 0755 for directories
  195. # for the netdata web directory
  196. %defattr(0644,root,netdata,0755)
  197. %{_datadir}/%{name}/web
  198. %changelog
  199. * Tue Mar 27 2018 Costa Tsaousis <costa@tsaousis.gr> - 1.10.0-1
  200. Please check full changelog at github.
  201. https://github.com/firehol/netdata/releases
  202. * Sun Dec 17 2017 Costa Tsaousis <costa@tsaousis.gr> - 1.9.0-1
  203. Please check full changelog at github.
  204. https://github.com/firehol/netdata/releases
  205. * Sun Sep 17 2017 Costa Tsaousis <costa@tsaousis.gr> - 1.8.0-1
  206. This is mainly a bugfix release.
  207. Please check full changelog at github.
  208. * Sun Jul 16 2017 Costa Tsaousis <costa@tsaousis.gr> - 1.7.0-1
  209. - netdata is now a fully featured statsd server
  210. - new installation options
  211. - metrics streaming and replication improvements
  212. - backends improvements - prometheus support rewritten
  213. - netdata now monitors ZFS (on Linux and FreeBSD)
  214. - netdata now monitors ElasticSearch
  215. - netdata now monitors RabbitMQ
  216. - netdata now monitors Go applications (via expvar)
  217. - netdata now monitors ipfw (on FreeBSD 11)
  218. - netdata now monitors samba
  219. - netdata now monitors squid logs
  220. - netdata dashboard loading times have been improved significantly
  221. - netdata alarms now support custom hooks
  222. - dozens more improvements and bug fixes
  223. * Mon Mar 20 2017 Costa Tsaousis <costa@tsaousis.gr> - 1.6.0-1
  224. - central netdata
  225. - monitoring ephemeral nodes
  226. - monitoring ephemeral containers and VM guests
  227. - apps.plugin ported for FreeBSD
  228. - web_log plugin
  229. - JSON backends
  230. - IPMI monitoring
  231. - several new and improved plugins
  232. - several new and improved alarms and notifications
  233. - dozens more improvements and bug fixes
  234. * Sun Jan 22 2017 Costa Tsaousis <costa@tsaousis.gr> - 1.5.0-1
  235. - FreeBSD, MacOS, FreeNAS
  236. - Backends support
  237. - dozens of new and improved plugins
  238. - dozens of new and improved alarms and notification methods
  239. * Tue Oct 4 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.4.0-1
  240. - the fastest netdata ever (with a better look too)!
  241. - improved IoT and containers support!
  242. - alarms improved in almost every way!
  243. - Several more improvements, new features and bugfixes.
  244. * Sun Aug 28 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.3.0-1
  245. - netdata now has health monitoring
  246. - netdata now generates badges
  247. - netdata now has python plugins
  248. - Several more improvements, new features and bugfixes.
  249. * Tue Jul 26 2016 Jason Barnett <J@sonBarnett.com> - 1.2.0-2
  250. - Added support for EL6
  251. - Corrected several Requires statements
  252. - Changed default to build without nfacct
  253. - Removed --docdir from configure
  254. * Mon May 16 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.2.0-1
  255. - netdata is now 30% faster.
  256. - netdata now has a registry (my-netdata menu on the dashboard).
  257. - netdata now monitors Linux containers.
  258. - Several more improvements, new features and bugfixes.
  259. * Wed Apr 20 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.1.0-1
  260. - Several new features (IPv6, SYNPROXY, Users, Users Groups).
  261. - A lot of bug fixes and optimizations.
  262. * Tue Mar 22 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.0.0-1
  263. - First public release.
  264. * Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1
  265. - Initial add.