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