X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fredhat%2Fcollectd.spec;h=ef8296fc3a0db89ed6fe8e971f392eaadefb8767;hb=ca84b19dead48022f7ad8ddeb5f59ca5743e344e;hp=23fbae244f0b6618a1389e8da9b2a7fb6b7cbf0a;hpb=6f4c0fbf9ccccbf49c495637a8a1893540279bb7;p=collectd.git diff --git a/contrib/redhat/collectd.spec b/contrib/redhat/collectd.spec index 23fbae24..ef8296fc 100644 --- a/contrib/redhat/collectd.spec +++ b/contrib/redhat/collectd.spec @@ -48,6 +48,7 @@ %{?el6:%global _has_libudev 1} %{?el6:%global _has_iproute 1} %{?el6:%global _has_atasmart 1} +%{?el6:%global _has_hiredis 1} %{?el7:%global _has_libyajl 1} %{?el7:%global _has_recent_libpcap 1} @@ -61,6 +62,7 @@ %{?el7:%global _has_broken_libmemcached 1} %{?el7:%global _has_iproute 1} %{?el7:%global _has_atasmart 1} +%{?el7:%global _has_hiredis 1} # plugins enabled by default %define with_aggregation 0%{!?_without_aggregation:1} @@ -132,6 +134,7 @@ %define with_processes 0%{!?_without_processes:1} %define with_protocols 0%{!?_without_protocols:1} %define with_python 0%{!?_without_python:1} +%define with_redis 0%{!?_without_redis:0%{?_has_hiredis}} %define with_rrdcached 0%{!?_without_rrdcached:0%{?_has_recent_librrd}} %define with_rrdtool 0%{!?_without_rrdtool:1} %define with_sensors 0%{!?_without_sensors:1} @@ -159,9 +162,11 @@ %define with_wireless 0%{!?_without_wireless:1} %define with_write_graphite 0%{!?_without_write_graphite:1} %define with_write_http 0%{!?_without_write_http:1} +%define with_write_redis 0%{!?_without_write_redis:0%{?_has_hiredis}} %define with_write_riemann 0%{!?_without_write_riemann:1} %define with_write_tsdb 0%{!?_without_write_tsdb:1} %define with_zfs_arc 0%{!?_without_zfs_arc:1} +%define with_zookeeper 0%{!?_without_zookeeper:1} # Plugins not built by default because of dependencies on libraries not # available in RHEL or EPEL: @@ -184,8 +189,6 @@ %define with_oracle 0%{!?_without_oracle:0} # plugin oracle disabled, requires BSD %define with_pf 0%{!?_without_pf:0} -# plugin redis disabled, requires credis -%define with_redis 0%{!?_without_redis:0} # plugin routeros disabled, requires librouteros %define with_routeros 0%{!?_without_routeros:0} # plugin sigrok disabled, requires libsigrok @@ -198,8 +201,6 @@ %define with_write_kafka 0%{!?_without_write_kafka:0} # plugin write_mongodb disabled, requires libmongoc %define with_write_mongodb 0%{!?_without_write_mongodb:0} -# plugin write_redis disabled, requires credis -%define with_write_redis 0%{!?_without_write_redis:0} # plugin xmms disabled, requires xmms %define with_xmms 0%{!?_without_xmms:0} @@ -215,9 +216,22 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: libgcrypt-devel, kernel-headers Vendor: collectd development team +%if 0%{?el7:1} +Requires(pre): initscripts +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%else +%if 0%{?el6:1} +Requires(pre): initscripts +Requires(preun): upstart +Requires(postun): upstart +%else Requires(post): chkconfig Requires(preun): chkconfig, initscripts Requires(postun): initscripts +%endif +%endif %description collectd is a small daemon which collects system information periodically and @@ -616,10 +630,10 @@ application programming interface (API) to Python-scripts. Summary: Redis plugin for collectd Group: System Environment/Daemons Requires: %{name}%{?_isa} = %{version}-%{release} -BuildRequires: credis-devel +BuildRequires: hiredis-devel %description redis The Redis plugin connects to one or more instances of Redis, a key-value store, -and collects usage information using the credis library. +and collects usage information using the hiredis library. %endif %if %{with_rrdcached} @@ -731,7 +745,7 @@ The write_kafka plugin sends values to kafka, a distributed messaging system. Summary: Write-Redis plugin for collectd Group: System Environment/Daemons Requires: %{name}%{?_isa} = %{version}-%{release} -BuildRequires: credis-devel +BuildRequires: hiredis-devel %description write_redis The Write Redis plugin stores values in Redis, a “data structures server”. %endif @@ -1472,7 +1486,7 @@ Development files for libcollectdclient %if %{with_write_redis} %define _with_write_redis --enable-write_redis %else -%define _with_write_redis --disable-write_redis --without-libcredis +%define _with_write_redis --disable-write_redis %endif %if %{with_write_riemann} @@ -1499,6 +1513,12 @@ Development files for libcollectdclient %define _with_zfs_arc --disable-zfs_arc %endif +%if %{with_zookeeper} +%define _with_zookeeper --enable-zookeeper +%else +%define _with_zookeeper --disable-zookeeper +%endif + %configure CFLAGS="%{optflags} -DLT_LAZY_OR_NOW=\"RTLD_LAZY|RTLD_GLOBAL\"" \ --disable-static \ --without-included-ltdl \ @@ -1591,6 +1611,7 @@ Development files for libcollectdclient %{?_with_write_redis} \ %{?_with_xmms} \ %{?_with_zfs_arc} \ + %{?_with_zookeeper} \ %{?_with_irq} \ %{?_with_load} \ %{?_with_logfile} \ @@ -1639,7 +1660,15 @@ Development files for libcollectdclient %install rm -rf %{buildroot} %{__make} install DESTDIR=%{buildroot} -%{__install} -Dp -m 0755 contrib/redhat/init.d-collectd %{buildroot}%{_initrddir}/collectd +%if 0%{?el7:1} +%{__install} -Dp -m0644 contrib/systemd.collectd.service %{buildroot}%{_unitdir}/collectd.service +%else +%if 0%{?el6:1} +%{__install} -Dp -m0644 contrib/upstart.collectd.conf %{buildroot}%{_sysconfdir}/init/collectd.conf +%else +%{__install} -Dp -m0755 contrib/redhat/init.d-collectd %{buildroot}%{_initrddir}/collectd +%endif +%endif %{__install} -Dp -m0644 src/collectd.conf %{buildroot}%{_sysconfdir}/collectd.conf %{__install} -d %{buildroot}%{_sharedstatedir}/collectd/ %{__install} -d %{buildroot}%{_sysconfdir}/collectd.d/ @@ -1690,19 +1719,62 @@ rm -f %{buildroot}%{_mandir}/man5/collectd-snmp.5* %clean rm -rf %{buildroot} +%pre +%if 0%{?el7:1}%{?el6:1} +# stop sysv-based instance before upgrading to upstart/systemd +if [ $1 -eq 2 ] && [ -f /var/lock/subsys/collectd ]; then + SYSTEMCTL_SKIP_REDIRECT=1 /etc/rc.d/init.d/collectd stop >/dev/null 2>&1 || : +fi +%else +/bin/true +%endif + %post -/sbin/chkconfig --add collectd +%if 0%{?el7:1} +if [ $1 -eq 2 ]; then + /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi +%systemd_post collectd.service +%else +%if 0%{?el6:1} +/bin/true +%else +/sbin/chkconfig --add collectd || : +%endif +%endif %preun +%if 0%{?el7:1} +%systemd_preun collectd.service +%else +# stop collectd only when uninstalling if [ $1 -eq 0 ]; then - /sbin/service collectd stop &>/dev/null - /sbin/chkconfig --del collectd +%if 0%{?el6:1} + /sbin/initctl stop collectd >/dev/null 2>&1 || : +%else + /sbin/service collectd stop >/dev/null 2>&1 || : + /sbin/chkconfig --del collectd || : +%endif fi +%endif %postun -if [ $1 -ge 1 ]; then - /sbin/service collectd condrestart &>/dev/null || : +%if 0%{?el7:1} +%systemd_postun_with_restart collectd.service +%else +# restart collectd only when upgrading +if [ $1 -eq 1 ]; then +%if 0%{?el6:1} + if /sbin/initctl status collectd 2>/dev/null | grep -q 'running'; then + /sbin/initctl restart collectd >/dev/null 2>&1 || : + else + /sbin/initctl start collectd >/dev/null 2>&1 || : + fi +%else + /sbin/service collectd condrestart >/dev/null 2>&1 || : +%endif fi +%endif %post -n libcollectdclient -p /sbin/ldconfig %postun -n libcollectdclient -p /sbin/ldconfig @@ -1711,7 +1783,15 @@ fi %files %doc AUTHORS COPYING ChangeLog README %config(noreplace) %{_sysconfdir}/collectd.conf +%if 0%{?el7:1} +%{_unitdir}/collectd.service +%else +%if 0%{?el6:1} +%{_sysconfdir}/init/collectd.conf +%else %{_initrddir}/collectd +%endif +%endif %{_sbindir}/collectd %{_bindir}/collectd-nagios %{_bindir}/collectd-tg @@ -1917,6 +1997,9 @@ fi %if %{with_zfs_arc} %{_libdir}/%{name}/zfs_arc.so %endif +%if %{with_zookeeper} +%{_libdir}/%{name}/zookeeper.so +%endif %files -n libcollectdclient-devel %{_includedir}/collectd/client.h @@ -2194,7 +2277,7 @@ fi %changelog # * TODO 5.5.0-1 # - New upstream version -# - New plugins enabled by default: drbd, log_logstash, write_tsdb, smart, openldap +# - New plugins enabled by default: drbd, log_logstash, write_tsdb, smart, openldap, redis, write_redis, zookeeper # - New plugins disabled by default: barometer, write_kafka # - Enable zfs_arc, now supported on Linux # - Install disk plugin in an dedicated package, as it depends on libudev