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