Merge branch 'collectd-4.10' into collectd-5.0
[collectd.git] / contrib / redhat / collectd.spec
1
2 %define with_java %(test -z "$JAVA_HOME" ; echo $?)
3
4 Summary:        Statistics collection daemon for filling RRD files.
5 Name:           collectd
6 Version:        4.9.0
7 Release:        1%{?dist}
8 Source:         http://collectd.org/files/%{name}-%{version}.tar.gz
9 License:        GPL
10 Group:          System Environment/Daemons
11 BuildRoot:      %{_tmppath}/%{name}-%{version}-root
12 BuildPrereq:    lm_sensors-devel, rrdtool-devel, libpcap-devel, net-snmp-devel, libstatgrab-devel, libxml2-devel, libiptcdata-devel
13 # libcurl deps
14 BuildPrereq:    curl-devel,libidn-devel,openssl-devel
15 Requires:       rrdtool, perl-Regexp-Common, libstatgrab
16 Packager:       RightScale <support@rightscale.com>
17 Vendor:         collectd development team <collectd@verplant.org>
18
19 %description
20 collectd is a small daemon which collects system information periodically and
21 provides mechanisms to monitor and store the values in a variety of ways. It
22 is written in C for performance. Since the daemon doesn't need to startup
23 every time it wants to update the values it's very fast and easy on the
24 system. Also, the statistics are very fine grained since the files are updated
25 every 10 seconds.
26
27
28 %package apache
29 Summary:        apache-plugin for collectd.
30 Group:          System Environment/Daemons
31 Requires:       collectd = %{version}, curl
32 %description apache
33 This plugin collects data provided by Apache's `mod_status'.
34
35 %package email
36 Summary:        email-plugin for collectd.
37 Group:          System Environment/Daemons
38 Requires:       collectd = %{version}, spamassassin
39 %description email
40 This plugin collects data provided by spamassassin.
41
42 %package mysql
43 Summary:        mysql-module for collectd.
44 Group:          System Environment/Daemons
45 Requires:       collectd = %{version}, mysql
46 %description mysql
47 MySQL querying plugin. This plugins provides data of issued commands, called
48 handlers and database traffic.
49
50 %package nginx
51 Summary:        nginx-plugin for collectd.
52 Group:          System Environment/Daemons
53 Requires:       collectd = %{version}, curl
54 %description nginx
55 This plugin gets data provided by nginx.
56
57 %package sensors
58 Summary:        libsensors-module for collectd.
59 Group:          System Environment/Daemons
60 Requires:       collectd = %{version}, lm_sensors
61 %description sensors
62 This plugin for collectd provides querying of sensors supported by lm_sensors.
63
64 %package snmp
65 Summary:        snmp-module for collectd.
66 Group:          System Environment/Daemons
67 Requires:       collectd = %{version}, net-snmp
68 %description snmp
69 This plugin for collectd allows querying of network equipment using SNMP.
70
71 %if %with_java
72 %package java
73 Summary:        java-module for collectd.
74 Group:          System Environment/Daemons
75 Requires:       collectd = %{version}, jdk >= 1.6
76 BuildPrereq:    jdk >= 1.6
77 %description java
78 This plugin for collectd allows plugins to be written in Java and executed
79 in an embedded JVM.
80 %endif
81
82 %prep
83 rm -rf $RPM_BUILD_ROOT
84 %setup
85
86 %build
87 ./configure CFLAGS=-"DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'" --prefix=%{_prefix} --sbindir=%{_sbindir} --mandir=%{_mandir} --libdir=%{_libdir} --sysconfdir=%{_sysconfdir} \
88     %{!?with_java:"--with-java=$JAVA_HOME --enable-java"} \
89     --disable-battery
90 make
91
92 %install
93 make install DESTDIR=$RPM_BUILD_ROOT
94 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
95 mkdir -p $RPM_BUILD_ROOT/var/www/cgi-bin
96 cp contrib/redhat/init.d-collectd $RPM_BUILD_ROOT/etc/rc.d/init.d/collectd
97 cp contrib/collection.cgi $RPM_BUILD_ROOT/var/www/cgi-bin
98 mkdir -p $RPM_BUILD_ROOT/etc/collectd.d
99 mkdir -p $RPM_BUILD_ROOT/var/lib/collectd
100 ### Clean up docs
101 find contrib/ -type f -exec %{__chmod} a-x {} \;
102
103 ###Modify Config for Redhat Based Distros
104 sed -i 's:#BaseDir     "/usr/var/lib/collectd":BaseDir     "/var/lib/collectd":' $RPM_BUILD_ROOT/etc/collectd.conf
105 sed -i 's:#PIDFile     "/usr/var/run/collectd.pid":PIDFile     "/var/run/collectd.pid":' $RPM_BUILD_ROOT/etc/collectd.conf
106 sed -i 's:#PluginDir   "/usr/lib/collectd":PluginDir   "%{_libdir}/collectd":' $RPM_BUILD_ROOT/etc/collectd.conf
107 sed -i 's:#TypesDB     "/usr/share/collectd/types.db":TypesDB     "/usr/share/collectd/types.db":' $RPM_BUILD_ROOT/etc/collectd.conf
108 sed -i 's:#Interval     10:Interval     30:' $RPM_BUILD_ROOT/etc/collectd.conf
109 sed -i 's:#ReadThreads  5:ReadThreads  5:' $RPM_BUILD_ROOT/etc/collectd.conf
110 ###Include broken out config directory
111 echo -e '\nInclude "/etc/collectd.d"' >> $RPM_BUILD_ROOT/etc/collectd.conf
112
113 ##Move config contribs
114 cp contrib/redhat/apache.conf $RPM_BUILD_ROOT/etc/collectd.d/apache.conf
115 cp contrib/redhat/email.conf $RPM_BUILD_ROOT/etc/collectd.d/email.conf
116 cp contrib/redhat/sensors.conf $RPM_BUILD_ROOT/etc/collectd.d/sensors.conf
117 cp contrib/redhat/mysql.conf $RPM_BUILD_ROOT/etc/collectd.d/mysql.conf
118 cp contrib/redhat/nginx.conf $RPM_BUILD_ROOT/etc/collectd.d/nginx.conf
119 cp contrib/redhat/snmp.conf $RPM_BUILD_ROOT/etc/collectd.d/snmp.conf
120
121 %clean
122 rm -rf $RPM_BUILD_ROOT
123
124 %post
125 /sbin/chkconfig --add collectd
126 /sbin/chkconfig collectd on
127
128 %preun
129 if [ "$1" = 0 ]; then
130    /sbin/chkconfig collectd off
131    /etc/init.d/collectd stop
132    /sbin/chkconfig --del collectd
133 fi
134 exit 0
135
136 %postun
137 if [ "$1" -ge 1 ]; then
138     /etc/init.d/collectd restart
139 fi
140 exit 0
141
142 %files
143 %defattr(-,root,root)
144 %doc AUTHORS COPYING ChangeLog INSTALL NEWS README contrib/
145 %config %attr(0644,root,root) /etc/collectd.conf
146 %attr(0755,root,root) /etc/rc.d/init.d/collectd
147 %attr(0755,root,root) /var/www/cgi-bin/collection.cgi
148 %attr(0755,root,root) %{_sbindir}/collectd
149 %attr(0755,root,root) %{_bindir}/collectd-nagios
150 %attr(0755,root,root) %{_sbindir}/collectdmon
151 %attr(0644,root,root) %{_mandir}/man1/*
152 %attr(0644,root,root) %{_mandir}/man5/*
153 %dir /etc/collectd.d
154
155 # client
156 %attr(0644,root,root) /usr/include/collectd/client.h
157 %attr(0644,root,root) /usr/include/collectd/lcc_features.h
158
159 %attr(0644,root,root) %{_libdir}/libcollectdclient.*
160 %attr(0644,root,root) %{_libdir}/pkgconfig/libcollectdclient.pc
161
162 # macro to grab binaries for a plugin, given a name
163 %define plugin_macro() \
164 %attr(0644,root,root) %{_libdir}/%{name}/%1.a \
165 %attr(0644,root,root) %{_libdir}/%{name}/%1.so* \
166 %attr(0644,root,root) %{_libdir}/%{name}/%1.la
167
168 %plugin_macro apcups
169 %plugin_macro ascent
170 %plugin_macro bind
171 %plugin_macro conntrack
172 %plugin_macro contextswitch
173 %plugin_macro cpufreq
174 %plugin_macro cpu
175 %plugin_macro csv
176 %plugin_macro curl
177 %plugin_macro df
178 %plugin_macro disk
179 %plugin_macro dns
180 %plugin_macro entropy
181 %plugin_macro email
182 %plugin_macro exec
183 %plugin_macro filecount
184 %plugin_macro fscache
185 %plugin_macro hddtemp
186 %plugin_macro interface
187 %plugin_macro iptables
188 %plugin_macro irq
189 %plugin_macro load
190 %plugin_macro logfile
191 %plugin_macro madwifi
192
193 %plugin_macro match_empty_counter
194 %plugin_macro match_hashed
195 %plugin_macro match_regex
196 %plugin_macro match_timediff
197 %plugin_macro match_value
198
199 %plugin_macro mbmon
200 %plugin_macro memcached
201 %plugin_macro memory
202 %plugin_macro multimeter
203 %plugin_macro network
204 %plugin_macro nfs
205 %plugin_macro ntpd
206 %plugin_macro openvpn
207 %plugin_macro olsrd
208 %plugin_macro perl
209 %plugin_macro powerdns
210 %plugin_macro processes
211 %plugin_macro protocols
212 %plugin_macro python
213 %plugin_macro rrdtool
214 %plugin_macro serial
215 %plugin_macro sensors
216 %plugin_macro swap
217 %plugin_macro syslog
218 %plugin_macro table
219 %plugin_macro tail
220
221 %plugin_macro target_notification
222 %plugin_macro target_replace
223 %plugin_macro target_scale
224 %plugin_macro target_set
225
226 %plugin_macro tcpconns
227 %plugin_macro teamspeak2
228 %plugin_macro ted
229 %plugin_macro thermal
230 %plugin_macro unixsock
231 %plugin_macro uptime
232 %plugin_macro users
233 %plugin_macro uuid
234 %plugin_macro vmem
235 %plugin_macro vserver
236 %plugin_macro wireless
237 %plugin_macro write_http
238
239 %attr(0644,root,root) %{_datadir}/%{name}/types.db
240
241 %exclude %{_libdir}/perl5/5.8.8/%{_arch}-linux-thread-multi/perllocal.pod
242 %attr(0644,root,root) %{_libdir}/perl5/site_perl/5.8.8/%{_arch}-linux-thread-multi/auto/Collectd/.packlist
243 %attr(0644,root,root) /usr/lib/perl5/site_perl/5.8.8/Collectd.pm
244 %attr(0644,root,root) /usr/lib/perl5/site_perl/5.8.8/Collectd/Unixsock.pm
245 %attr(0644,root,root) /usr/lib/perl5/site_perl/5.8.8/Collectd/Plugins/OpenVZ.pm
246 %attr(0644,root,root) /usr/share/man/man3/Collectd::Unixsock.3pm.gz
247
248 %exclude /usr/share/collectd/postgresql_default.conf
249
250 %dir /var/lib/collectd
251
252 %if %with_java
253 %files java
254 %attr(0644,root,root) /usr/share/%{name}/java/org/collectd/api/*.class
255 %attr(0644,root,root) /usr/share/%{name}/java/org/collectd/java/*.class
256 %plugin_macro java
257 %endif
258
259 %files apache
260 %config %attr(0644,root,root) /etc/collectd.d/apache.conf
261 %plugin_macro apache
262
263 %files email
264 %attr(0644,root,root) %{_libdir}/%{name}/email.so*
265 %attr(0644,root,root) %{_libdir}/%{name}/email.la
266 %config %attr(0644,root,root) /etc/collectd.d/email.conf
267
268 %files mysql
269 %config %attr(0644,root,root) /etc/collectd.d/mysql.conf
270 %plugin_macro mysql
271
272 %files nginx
273 %config %attr(0644,root,root) /etc/collectd.d/nginx.conf
274 %plugin_macro nginx
275
276 %files sensors
277 %attr(0644,root,root) %{_libdir}/%{name}/sensors.so*
278 %attr(0644,root,root) %{_libdir}/%{name}/sensors.la
279 %config %attr(0644,root,root) /etc/collectd.d/sensors.conf
280
281 %files snmp
282 %attr(0644,root,root) /etc/collectd.d/snmp.conf
283 %plugin_macro snmp
284
285 %changelog
286 * Tue Jan 04 2010 Rackspace <stu.hood@rackspace.com> 4.9.0
287 - New upstream version
288 - Changes to support 4.9.0
289 - Added support for Java/GenericJMX plugin
290
291 * Mon Mar 17 2008 RightScale <support@rightscale.com> 4.3.1
292 - New upstream version
293 - Changes to support 4.3.1
294 - Added More Prereqs to support more plugins
295 - Added support for perl plugin
296
297 * Mon Aug 06 2007 Kjell Randa <Kjell.Randa@broadpark.no> 4.0.6
298 - New upstream version
299
300 * Wed Jul 25 2007 Kjell Randa <Kjell.Randa@broadpark.no> 4.0.5
301 - New major releas
302 - Changes to support 4.0.5 
303
304 * Wed Jan 11 2007 Iain Lea <iain@bricbrac.de> 3.11.0-0
305 - fixed spec file to build correctly on fedora core
306 - added improved init.d script to work with chkconfig
307 - added %post and %postun to call chkconfig automatically
308
309 * Sun Jul 09 2006 Florian octo Forster <octo@verplant.org> 3.10.0-1
310 - New upstream version
311
312 * Tue Jun 25 2006 Florian octo Forster <octo@verplant.org> 3.9.4-1
313 - New upstream version
314
315 * Tue Jun 01 2006 Florian octo Forster <octo@verplant.org> 3.9.3-1
316 - New upstream version
317
318 * Tue May 09 2006 Florian octo Forster <octo@verplant.org> 3.9.2-1
319 - New upstream version
320
321 * Tue May 09 2006 Florian octo Forster <octo@verplant.org> 3.8.5-1
322 - New upstream version
323
324 * Fri Apr 21 2006 Florian octo Forster <octo@verplant.org> 3.9.1-1
325 - New upstream version
326
327 * Fri Apr 14 2006 Florian octo Forster <octo@verplant.org> 3.9.0-1
328 - New upstream version
329 - Added the `apache' package.
330
331 * Thu Mar 14 2006 Florian octo Forster <octo@verplant.org> 3.8.2-1
332 - New upstream version
333
334 * Thu Mar 13 2006 Florian octo Forster <octo@verplant.org> 3.8.1-1
335 - New upstream version
336
337 * Thu Mar 09 2006 Florian octo Forster <octo@verplant.org> 3.8.0-1
338 - New upstream version
339
340 * Sat Feb 18 2006 Florian octo Forster <octo@verplant.org> 3.7.2-1
341 - Include `tape.so' so the build doesn't terminate because of missing files..
342 - New upstream version
343
344 * Sat Feb 04 2006 Florian octo Forster <octo@verplant.org> 3.7.1-1
345 - New upstream version
346
347 * Mon Jan 30 2006 Florian octo Forster <octo@verplant.org> 3.7.0-1
348 - New upstream version
349 - Removed the extra `hddtemp' package
350
351 * Tue Jan 24 2006 Florian octo Forster <octo@verplant.org> 3.6.2-1
352 - New upstream version
353
354 * Fri Jan 20 2006 Florian octo Forster <octo@verplant.org> 3.6.1-1
355 - New upstream version
356
357 * Fri Jan 20 2006 Florian octo Forster <octo@verplant.org> 3.6.0-1
358 - New upstream version
359 - Added config file, `collectd.conf(5)', `df.so'
360 - Added package `collectd-mysql', dependency on `mysqlclient10 | mysql'
361
362 * Wed Dec 07 2005 Florian octo Forster <octo@verplant.org> 3.5.0-1
363 - New upstream version
364
365 * Sat Nov 26 2005 Florian octo Forster <octo@verplant.org> 3.4.0-1
366 - New upstream version
367
368 * Sat Nov 05 2005 Florian octo Forster <octo@verplant.org> 3.3.0-1
369 - New upstream version
370
371 * Tue Oct 26 2005 Florian octo Forster <octo@verplant.org> 3.2.0-1
372 - New upstream version
373 - Added statement to remove the `*.la' files. This fixes a problem when
374   `Unpackaged files terminate build' is in effect.
375 - Added `processes.so*' to the main package
376
377 * Fri Oct 14 2005 Florian octo Forster <octo@verplant.org> 3.1.0-1
378 - New upstream version
379 - Added package `collectd-hddtemp'
380
381 * Fri Sep 30 2005 Florian octo Forster <octo@verplant.org> 3.0.0-1
382 - New upstream version
383 - Split the package into `collectd' and `collectd-sensors'
384
385 * Fri Sep 16 2005 Florian octo Forster <octo@verplant.org> 2.1.0-1
386 - New upstream version
387
388 * Mon Sep 10 2005 Florian octo Forster <octo@verplant.org> 2.0.0-1
389 - New upstream version
390
391 * Mon Aug 29 2005 Florian octo Forster <octo@verplant.org> 1.8.0-1
392 - New upstream version
393
394 * Sun Aug 25 2005 Florian octo Forster <octo@verplant.org> 1.7.0-1
395 - New upstream version
396
397 * Sun Aug 21 2005 Florian octo Forster <octo@verplant.org> 1.6.0-1
398 - New upstream version
399
400 * Sun Jul 17 2005 Florian octo Forster <octo@verplant.org> 1.5.1-1
401 - New upstream version
402
403 * Sun Jul 17 2005 Florian octo Forster <octo@verplant.org> 1.5-1
404 - New upstream version
405
406 * Mon Jul 11 2005 Florian octo Forster <octo@verplant.org> 1.4.2-1
407 - New upstream version
408
409 * Sat Jul 09 2005 Florian octo Forster <octo@verplant.org> 1.4-1
410 - Built on RedHat 7.3