]>
Commit | Line | Data |
---|---|---|
dbcc502d ER |
1 | # |
2 | # Conditional build: | |
dbcc502d ER |
3 | %bcond_with nfacct # build with nfacct plugin |
4 | ||
5 | Summary: Linux real time system monitoring, over the web | |
6 | Name: netdata | |
7 | Version: 1.0.0 | |
1aa35efd | 8 | Release: 0.15 |
4f48df40 | 9 | License: GPL v3+ |
dbcc502d ER |
10 | Group: Applications/System |
11 | Source0: https://github.com/firehol/netdata/archive/v%{version}/%{name}-%{version}.tar.gz | |
12 | # Source0-md5: 53a432f8849da6bd49b0853dd79551c5 | |
01f0b59e | 13 | Source1: %{name}.conf |
1aa35efd ER |
14 | Source2: %{name}.init |
15 | Source3: %{name}.service | |
ea1ae9aa | 16 | Patch0: nodejs.patch |
dbcc502d | 17 | URL: http://netdata.firehol.org/ |
085a70e6 ER |
18 | BuildRequires: autoconf |
19 | BuildRequires: automake | |
65ecfdca | 20 | %{?with_nfacct:BuildRequires: libmnl-devel} |
dbcc502d | 21 | %{?with_nfacct:BuildRequires: libnetfilter_acct-devel} |
085a70e6 | 22 | BuildRequires: pkgconfig |
1aa35efd | 23 | BuildRequires: rpmbuild(macros) >= 1.647 |
dbcc502d | 24 | BuildRequires: zlib-devel |
1229dd1c ER |
25 | Provides: group(netdata) |
26 | Provides: user(netdata) | |
1aa35efd ER |
27 | Requires(post,preun): /sbin/chkconfig |
28 | Requires(post,preun,postun): systemd-units >= 38 | |
1229dd1c ER |
29 | Requires(postun): /usr/sbin/groupdel |
30 | Requires(postun): /usr/sbin/userdel | |
31 | Requires(pre): /bin/id | |
32 | Requires(pre): /usr/bin/getgid | |
33 | Requires(pre): /usr/sbin/groupadd | |
34 | Requires(pre): /usr/sbin/useradd | |
1aa35efd ER |
35 | Requires: rc-scripts |
36 | Requires: systemd-units >= 0.38 | |
37 | Suggests: %{name}-charts | |
38 | Suggests: %{name}-nodejs | |
dbcc502d ER |
39 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
40 | ||
f241237d ER |
41 | %define _libexecdir %{_prefix}/lib |
42 | ||
dbcc502d ER |
43 | %description |
44 | netdata is the fastest way to visualize metrics. It is a resource | |
45 | efficient, highly optimized system for collecting and visualizing any | |
46 | type of realtime timeseries data, from CPU usage, disk activity, SQL | |
47 | queries, API calls, web site visitors, etc. | |
48 | ||
49 | netdata tries to visualize the truth of now, in its greatest detail, | |
50 | so that you can get insights of what is happening now and what just | |
51 | happened, on your systems and applications. | |
52 | ||
bd51d1ce ER |
53 | %package charts |
54 | Summary: netdata charts plugin | |
55 | Group: Applications/System | |
56 | URL: https://github.com/firehol/netdata/wiki/General-Info---charts.d | |
57 | Requires: %{name} = %{version}-%{release} | |
58 | Requires: bash >= 4 | |
59 | %if "%{_rpmversion}" >= "5" | |
60 | BuildArch: noarch | |
61 | %endif | |
62 | ||
63 | %description charts | |
64 | Charts.d is BaSH script that allows you to write simple scripts for | |
65 | collecting data. | |
66 | ||
67 | It has been designed so that the actual script that will do data | |
68 | collection will be permanently in memory, collecting data with as | |
69 | little overheads as possible (i.e. initialize once, repeatedly collect | |
70 | values with minimal overhead). | |
71 | ||
72 | Charts.d looks for scripts in charts.d. The scripts should have the | |
73 | filename suffix: .chart.sh. | |
74 | ||
f241237d ER |
75 | %package nodejs |
76 | Summary: netdata node.js plugins | |
77 | Group: Applications/System | |
78 | URL: https://github.com/firehol/netdata/wiki/General-Info---node.d | |
79 | Requires: %{name} = %{version}-%{release} | |
f241237d ER |
80 | %if "%{_rpmversion}" >= "5" |
81 | BuildArch: noarch | |
82 | %endif | |
83 | ||
84 | %description nodejs | |
85 | node.d.plugin is a netdata plugin that provides an abstraction layer | |
86 | to allow easy and quick development of data collectors in node.js. It | |
87 | also manages all its data collectors (placed in node.d) using a single | |
88 | instance of node, thus lowering the memory footprint of data | |
89 | collection. | |
90 | ||
dbcc502d ER |
91 | %prep |
92 | %setup -q | |
ea1ae9aa | 93 | %patch0 -p1 |
dbcc502d ER |
94 | |
95 | %build | |
96 | %{__aclocal} -I m4 | |
97 | %{__autoconf} | |
98 | %{__autoheader} | |
99 | %{__automake} | |
100 | %configure \ | |
f241237d | 101 | --libdir=%{_libexecdir} \ |
dbcc502d ER |
102 | --with-zlib \ |
103 | --with-math \ | |
104 | %{__enable_disable nfacct plugin-nfacct} \ | |
105 | --with-user=netdata | |
106 | %{__make} | |
107 | ||
108 | %install | |
109 | rm -rf $RPM_BUILD_ROOT | |
110 | %{__make} install \ | |
111 | DESTDIR=$RPM_BUILD_ROOT | |
112 | ||
1aa35efd ER |
113 | install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{systemdunitdir}} |
114 | ||
f241237d | 115 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.conf |
1aa35efd ER |
116 | install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
117 | cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service | |
01f0b59e | 118 | |
dbcc502d ER |
119 | %{__rm} $RPM_BUILD_ROOT/var/{cache,log}/netdata/.keep |
120 | ||
121 | install -d $RPM_BUILD_ROOT%{systemdunitdir} | |
122 | cp -p system/netdata-systemd $RPM_BUILD_ROOT%{systemdunitdir}/netdata.service | |
123 | ||
1aa35efd ER |
124 | %clean |
125 | rm -rf $RPM_BUILD_ROOT | |
126 | ||
dbcc502d | 127 | %pre |
1229dd1c ER |
128 | %groupadd -g 329 netdata |
129 | %useradd -u 329 -g netdata -c netdata -s /sbin/nologin -d / netdata | |
130 | ||
dbcc502d | 131 | %post |
1aa35efd ER |
132 | /sbin/chkconfig --add netdata |
133 | %service netdata restart | |
dbcc502d ER |
134 | %systemd_post netdata.service |
135 | ||
136 | %preun | |
1aa35efd ER |
137 | if [ "$1" = "0" ]; then |
138 | %service -q netdata stop | |
139 | /sbin/chkconfig --del netdata | |
140 | fi | |
dbcc502d ER |
141 | %systemd_preun netdata.service |
142 | ||
143 | %postun | |
1aa35efd ER |
144 | if [ "$1" = "0" ]; then |
145 | %userremove netdata | |
146 | %groupremove netdata | |
147 | fi | |
148 | %systemd_reload | |
dbcc502d ER |
149 | |
150 | %files | |
151 | %defattr(644,root,root,755) | |
152 | %dir %{_sysconfdir}/%{name} | |
c8a7f904 ER |
153 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/apps_groups.conf |
154 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/netdata.conf | |
1aa35efd | 155 | %attr(754,root,root) /etc/rc.d/init.d/netdata |
dbcc502d ER |
156 | %attr(755,root,root) %{_sbindir}/%{name} |
157 | %{_datadir}/%{name} | |
5c048d80 | 158 | %dir %{_libexecdir}/%{name} |
dbcc502d ER |
159 | %{systemdunitdir}/netdata.service |
160 | %attr(755,netdata,netdata) %dir %{_localstatedir}/cache/%{name} | |
161 | %attr(755,netdata,netdata) %dir %{_localstatedir}/log/%{name} | |
5c048d80 ER |
162 | |
163 | %defattr(-,root,root,-) | |
5c048d80 | 164 | %{_libexecdir}/%{name}/plugins.d |
bd51d1ce | 165 | # subpackages |
9c1cee53 | 166 | %exclude %{_libexecdir}/%{name}/plugins.d/node.d.plugin |
bd51d1ce ER |
167 | %exclude %{_libexecdir}/%{name}/plugins.d/charts.d* |
168 | ||
169 | %files charts | |
170 | %defattr(644,root,root,755) | |
c8a7f904 | 171 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/charts.d.conf |
bd51d1ce ER |
172 | %attr(755,root,root) %{_libexecdir}/%{name}/plugins.d/charts.d* |
173 | %dir %{_libexecdir}/%{name}/charts.d | |
174 | %{_libexecdir}/%{name}/charts.d/README.md | |
175 | %attr(755,root,root) %{_libexecdir}/%{name}/charts.d/*.chart.sh | |
f241237d ER |
176 | |
177 | %files nodejs | |
178 | %defattr(644,root,root,755) | |
9c1cee53 | 179 | %attr(755,root,root) %{_libexecdir}/%{name}/plugins.d/node.d.plugin |
f241237d ER |
180 | %dir %{_libexecdir}/%{name}/node.d |
181 | %{_libexecdir}/%{name}/node.d/README.md | |
182 | %{_libexecdir}/%{name}/node.d/node_modules | |
183 | %attr(755,root,root) %{_libexecdir}/%{name}/node.d/*.node.js |