forked from netdata/netdata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netdata.spec.in
254 lines (216 loc) · 7.04 KB
/
netdata.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# SPDX-License-Identifier: GPL-3.0-or-later
%global contentdir %{_datadir}/netdata
# This is temporary and should eventually be resolved. This bypasses
# the default rhel __os_install_post which throws a python compile
# error.
%global __os_install_post %{nil}
#
# Conditional build:
%bcond_without systemd # systemd
%bcond_with nfacct # build with nfacct plugin
%bcond_with freeipmi # build with freeipmi plugin
%bcond_with netns # build with netns support (cgroup-network)
%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1140
%else
%undefine with_systemd
%undefine with_netns
%endif
%if %{with systemd}
%if 0%{?suse_version}
%global netdata_initd_buildrequires \
BuildRequires: systemd-rpm-macros \
%{nil}
%global netdata_initd_requires \
%{?systemd_requires} \
%{nil}
%global netdata_init_post %service_add_post netdata.service
%global netdata_init_preun %service_del_preun netdata.service
%global netdata_init_postun %service_del_postun netdata.service
%else
%global netdata_initd_buildrequires \
BuildRequires: systemd
%global netdata_initd_requires \
Requires(preun): systemd-units \
Requires(postun): systemd-units \
Requires(post): systemd-units \
%{nil}
%global netdata_init_post %systemd_post netdata.service
%global netdata_init_preun %systemd_preun netdata.service
%global netdata_init_postun %systemd_postun_with_restart netdata.service
%endif
%else
%global netdata_initd_buildrequires %{nil}
%global netdata_initd_requires \
Requires(post): chkconfig \
%{nil}
%global netdata_init_post \
/sbin/chkconfig --add netdata \
%{nil}
%global netdata_init_preun %{nil} \
if [ $1 = 0 ]; then \
/sbin/service netdata stop > /dev/null 2>&1 \
/sbin/chkconfig --del netdata \
fi \
%{nil}
%global netdata_init_postun %{nil} \
if [ $1 != 0 ]; then \
/sbin/service netdata condrestart 2>&1 > /dev/null \
fi \
%{nil}
%endif
%if 0%{?_fedora}
%global netdata_recommends \
Recommends: curl \
Recommends: iproute-tc \
Recommends: lm_sensors \
Recommends: nmap-ncat \
Recommends: nodejs \
Recommends: python \
Recommends: PyYAML \
Recommends: python2-PyMySQL \
Recommends: python2-psycopg2 \
%{nil}
%else
%global netdata_recommends %{nil}
%endif
Summary: Real-time performance monitoring, done right
Name: netdata
Version: @PACKAGE_VERSION@
Release: 1%{?dist}
License: GPLv3+
Group: Applications/System
Source0: https://github.com/netdata/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
URL: http://my-netdata.io
BuildRequires: pkgconfig
BuildRequires: xz
BuildRequires: zlib-devel
BuildRequires: libuuid-devel
BuildRequires: autoconf
BuildRequires: automake
Requires: zlib
Requires: libuuid
# Packages can be found in the EPEL repo
%if %{with nfacct}
BuildRequires: libmnl-devel
BuildRequires: libnetfilter_acct-devel
Requires: libmnl
Requires: libnetfilter_acct
%endif
%if %{with freeipmi}
BuildRequires: freeipmi-devel
Requires: freeipmi
%endif
Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/useradd
Requires(post): libcap
%{netdata_initd_buildrequires}
%{netdata_recommends}
%{netdata_initd_requires}
%description
netdata is the fastest way to visualize metrics. It is a resource
efficient, highly optimized system for collecting and visualizing any
type of realtime timeseries data, from CPU usage, disk activity, SQL
queries, API calls, web site visitors, etc.
netdata tries to visualize the truth of now, in its greatest detail,
so that you can get insights of what is happening now and what just
happened, on your systems and applications.
%prep
%setup -q -n %{name}-%{version}
%build
autoreconf -i
%configure \
--with-zlib \
--with-math \
%{?with_nfacct:--enable-plugin-nfacct} \
%{?with_freeipmi:--enable-plugin-freeipmi} \
--with-user=netdata
%{__make} %{?_smp_mflags}
%install
rm -rf "${RPM_BUILD_ROOT}"
%{__make} %{?_smp_mflags} DESTDIR="${RPM_BUILD_ROOT}" install
find "${RPM_BUILD_ROOT}" -name .keep -delete
install -m 644 -p system/netdata.conf "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}"
install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d"
install -m 644 -p system/netdata.logrotate "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}"
%if %{with systemd}
install -m 755 -d "${RPM_BUILD_ROOT}%{_unitdir}"
install -m 644 -p system/netdata.service "${RPM_BUILD_ROOT}%{_unitdir}/netdata.service"
%else
# install SYSV init stuff
install -d "${RPM_BUILD_ROOT}/etc/rc.d/init.d"
install -m 755 system/netdata-init-d \
"${RPM_BUILD_ROOT}/etc/rc.d/init.d/netdata"
%endif
%pre
getent group netdata >/dev/null || groupadd -r netdata
getent group docker >/dev/null || groupadd -r docker
getent passwd netdata >/dev/null || \
useradd -r -g netdata -G docker -s /sbin/nologin \
-d %{contentdir} -c "netdata" netdata
%post
%{netdata_init_post}
%preun
%{netdata_init_preun}
%postun
%{netdata_init_postun}
%clean
rm -rf "${RPM_BUILD_ROOT}"
%files
%doc README.md
%defattr(-,root,root)
%dir %{_sysconfdir}/%{name}
%dir %{_libdir}/%{name}
%config %{_sysconfdir}/%{name}/*.conf
#%config %{_sysconfdir}/%{name}/charts.d/*.conf
#%config %{_sysconfdir}/%{name}/health.d/*.conf
#%config %{_sysconfdir}/%{name}/node.d/*.conf
#%config %{_sysconfdir}/%{name}/python.d/*.conf
#%config %{_sysconfdir}/%{name}/statsd.d/*.conf
%config %{_sysconfdir}/logrotate.d/%{name}
%{_libdir}/%{name}
%{_libexecdir}/%{name}
%{_sbindir}/%{name}
%{_sysconfdir}/%{name}/edit-config
%caps(cap_dac_read_search,cap_sys_ptrace=ep) %attr(0550,root,netdata) %{_libexecdir}/%{name}/plugins.d/apps.plugin
%if %{with netns}
# cgroup-network detects the network interfaces of CGROUPs
# it must be able to use setns() and run cgroup-network-helper.sh as root
# the helper script reads /proc/PID/fdinfo/* files, runs virsh, etc.
%caps(cap_setuid=ep) %attr(4550,root,netdata) %{_libexecdir}/%{name}/plugins.d/cgroup-network
%attr(0550,root,root) %{_libexecdir}/%{name}/plugins.d/cgroup-network-helper.sh
%endif
%if %{with freeipmi}
%caps(cap_setuid=ep) %attr(4550,root,netdata) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin
%endif
%attr(0770,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
%attr(0755,netdata,root) %dir %{_localstatedir}/log/%{name}
%attr(0770,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
%dir %{_datadir}/%{name}
%dir %{_sysconfdir}/%{name}/health.d
%dir %{_sysconfdir}/%{name}/python.d
%dir %{_sysconfdir}/%{name}/charts.d
%dir %{_sysconfdir}/%{name}/node.d
%dir %{_sysconfdir}/%{name}/statsd.d
%dir %{_libdir}/%{name}/conf.d/health.d
%dir %{_libdir}/%{name}/conf.d/python.d
%dir %{_libdir}/%{name}/conf.d/charts.d
#%dir %{_libdir}/%{name}/conf.d/node.d
%dir %{_libdir}/%{name}/conf.d/statsd.d
%if %{with systemd}
%{_unitdir}/netdata.service
%else
%{_sysconfdir}/rc.d/init.d/netdata
%endif
# Enforce 0644 for files and 0755 for directories
# for the netdata web directory
%defattr(0644,root,netdata,0755)
%{_datadir}/%{name}/web
%changelog
* Wed Jan 02 2019 Pawel Krupa <[email protected]> - 0.0.0-3
- Temporary set version statically
- Fix changelog ordering
- Comment-out node.d configuration directory
* Wed Jan 02 2019 Pawel Krupa <[email protected]> - 0.0.0-2
- Fix permissions for log files
* Sun Nov 15 2015 Alon Bar-Lev <[email protected]> - 0.0.0-1
- Initial add.