netdata.spec.in 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. %define contentdir %{_datadir}/netdata
  2. # This is temporary and should eventually be resolved. This bypasses
  3. # the default rhel __os_install_post which throws a python compile
  4. # error.
  5. %define __os_install_post %{nil}
  6. #
  7. # Conditional build:
  8. %bcond_without systemd # systemd
  9. %bcond_with nfacct # build with nfacct plugin
  10. %if 0%{?fedora} || 0%{?rhel} >= 7
  11. %else
  12. %undefine with_systemd
  13. %endif
  14. Summary: Real-time performance monitoring, done right
  15. Name: @PACKAGE_NAME@
  16. Version: @PACKAGE_RPM_VERSION@
  17. Release: 1%{?dist}
  18. License: GPL v3+
  19. Group: Applications/System
  20. Source0: http://firehol.org/download/netdata/releases/v@PACKAGE_VERSION@/%{name}-@PACKAGE_VERSION@.tar.xz
  21. URL: http://my-netdata.io/
  22. BuildRequires: pkgconfig
  23. BuildRequires: xz
  24. BuildRequires: zlib-devel
  25. BuildRequires: libuuid-devel
  26. Requires: zlib
  27. Requires: libuuid
  28. # Packages can be found in the EPEL repo
  29. %if %{with nfacct}
  30. BuildRequires: libmnl-devel
  31. BuildRequires: libnetfilter_acct-devel
  32. Requires: libmnl
  33. Requires: libnetfilter_acct
  34. %endif
  35. Requires(pre): /usr/sbin/groupadd
  36. Requires(pre): /usr/sbin/useradd
  37. %if %{with systemd}
  38. Requires(preun): systemd-units
  39. Requires(postun): systemd-units
  40. Requires(post): systemd-units
  41. %else
  42. Requires(post): chkconfig
  43. %endif
  44. BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
  45. %description
  46. netdata is the fastest way to visualize metrics. It is a resource
  47. efficient, highly optimized system for collecting and visualizing any
  48. type of realtime timeseries data, from CPU usage, disk activity, SQL
  49. queries, API calls, web site visitors, etc.
  50. netdata tries to visualize the truth of now, in its greatest detail,
  51. so that you can get insights of what is happening now and what just
  52. happened, on your systems and applications.
  53. %prep
  54. %setup -q -n %{name}-@PACKAGE_VERSION@
  55. %build
  56. %configure \
  57. --with-zlib \
  58. --with-math \
  59. %{?with_nfacct:--enable-plugin-nfacct} \
  60. --with-user=netdata
  61. %{__make} %{?_smp_mflags}
  62. %install
  63. rm -rf $RPM_BUILD_ROOT
  64. %{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
  65. find $RPM_BUILD_ROOT -name .keep -print0 | xargs --null --no-run-if-empty rm
  66. install -m 644 -p system/netdata.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
  67. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
  68. install -m 644 -p system/netdata.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
  69. %if %{with systemd}
  70. install -d $RPM_BUILD_ROOT%{_unitdir}
  71. install -m 644 -p system/netdata.service $RPM_BUILD_ROOT%{_unitdir}/netdata.service
  72. %else
  73. # install SYSV init stuff
  74. mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
  75. install -m755 system/netdata-init-d \
  76. $RPM_BUILD_ROOT/etc/rc.d/init.d/netdata
  77. %endif
  78. %if %{with systemd}
  79. %pre
  80. # Add the "netdata" user
  81. /usr/sbin/groupadd -r netdata 2> /dev/null || :
  82. /usr/sbin/useradd -c "netdata" -g netdata \
  83. -s /sbin/nologin -r -d %{contentdir} netdata 2> /dev/null || :
  84. %post
  85. %systemd_post netdata.service
  86. %preun
  87. %systemd_preun netdata.service
  88. %postun
  89. %systemd_postun_with_restart netdata.service
  90. %else
  91. %pre
  92. # Add the "netdata" user
  93. getent group netdata >/dev/null || groupadd -r netdata
  94. getent passwd netdata >/dev/null || \
  95. useradd -r -g netdata -s /sbin/nologin \
  96. -d %{contentdir} -c "netdata" netdata
  97. exit 0
  98. %post
  99. # Register the netdata service
  100. /sbin/chkconfig --add netdata
  101. # Only gets run on initial install (not upgrades or uninstalls)
  102. if [ $1 = 1 ]; then
  103. # Start the netdata service
  104. /sbin/service netdata start
  105. fi
  106. exit 0
  107. %preun
  108. # Only gets run on uninstall (not upgrades)
  109. if [ $1 = 0 ]; then
  110. /sbin/service netdata stop > /dev/null 2>&1
  111. /sbin/chkconfig --del netdata
  112. fi
  113. exit 0
  114. %postun
  115. # Only gets run on upgrade (not uninstalls)
  116. if [ $1 != 0 ]; then
  117. /sbin/service netdata condrestart 2>&1 > /dev/null
  118. fi
  119. exit 0
  120. %endif
  121. %clean
  122. rm -rf $RPM_BUILD_ROOT
  123. %files
  124. %defattr(-,root,root)
  125. %dir %{_sysconfdir}/%{name}
  126. %config(noreplace) %{_sysconfdir}/%{name}/*.conf
  127. #%config(noreplace) %{_sysconfdir}/%{name}/charts.d/*.conf
  128. %config(noreplace) %{_sysconfdir}/%{name}/health.d/*.conf
  129. #%config(noreplace) %{_sysconfdir}/%{name}/node.d/*.conf
  130. %config(noreplace) %{_sysconfdir}/%{name}/python.d/*.conf
  131. %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
  132. # node.js config files are JSON (which do not support comments)
  133. # so, we only supply markdown files
  134. %{_sysconfdir}/%{name}/node.d/*.md
  135. %{_libexecdir}/%{name}
  136. %{_sbindir}/%{name}
  137. %attr(0700,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
  138. %attr(0700,netdata,netdata) %dir %{_localstatedir}/log/%{name}
  139. %attr(0700,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
  140. %dir %{_datadir}/%{name}
  141. %if %{with systemd}
  142. %{_unitdir}/netdata.service
  143. %else
  144. %{_sysconfdir}/rc.d/init.d/netdata
  145. %endif
  146. # Enforce 0644 for files and 0755 for directories
  147. # for the netdata web directory
  148. %defattr(0644,root,netdata,0755)
  149. %{_datadir}/%{name}/web
  150. %changelog
  151. * Tue Oct 4 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.4.0-1
  152. - the fastest netdata ever (with a better look too)!
  153. - improved IoT and containers support!
  154. - alarms improved in almost every way!
  155. - Several more improvements, new features and bugfixes.
  156. * Sun Aug 28 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.3.0-1
  157. - netdata now has health monitoring
  158. - netdata now generates badges
  159. - netdata now has python plugins
  160. - Several more improvements, new features and bugfixes.
  161. * Tue Jul 26 2016 Jason Barnett <J@sonBarnett.com> - 1.2.0-2
  162. - Added support for EL6
  163. - Corrected several Requires statements
  164. - Changed default to build without nfacct
  165. - Removed --docdir from configure
  166. * Mon May 16 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.2.0-1
  167. - netdata is now 30% faster.
  168. - netdata now has a registry (my-netdata menu on the dashboard).
  169. - netdata now monitors Linux containers.
  170. - Several more improvements, new features and bugfixes.
  171. * Wed Apr 20 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.1.0-1
  172. - Several new features (IPv6, SYNPROXY, Users, Users Groups).
  173. - A lot of bug fixes and optimizations.
  174. * Tue Mar 22 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.0.0-1
  175. - First public release.
  176. * Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1
  177. - Initial add.