[zabbix20/el6] SNMP trap patch ZBX-6101, agent pre-un script

Volker Fröhlich volter at fedoraproject.org
Mon Jan 14 21:34:25 UTC 2013


commit a9e361ae98c98b764b3001b9e102e0354f73c3e3
Author: Volker Fröhlich <volker27 at gmx.at>
Date:   Mon Jan 14 22:20:27 2013 +0100

    SNMP trap patch ZBX-6101, agent pre-un script
    
    - Patch for ZBX-6101, where SNMP traps were not processed in
      maintenances with data collection
    - The pre-un scriptlet of the agent was empty for EL
    - Updated logrotate file with "su" statements for Fedora
    - Don't own /var/lib/run directories in Fedora

 zabbix-2.0.4-snmptrap.patch |   23 +++++++++++++++++++
 zabbix-fedora.README        |    8 +++---
 zabbix-logrotate.in         |    1 +
 zabbix20.spec               |   52 ++++++++++++++++++++++++++++++++----------
 4 files changed, 67 insertions(+), 17 deletions(-)
---
diff --git a/zabbix-2.0.4-snmptrap.patch b/zabbix-2.0.4-snmptrap.patch
new file mode 100644
index 0000000..117dc8e
--- /dev/null
+++ b/zabbix-2.0.4-snmptrap.patch
@@ -0,0 +1,23 @@
+Index: src/libs/zbxdbcache/dbconfig.c
+===================================================================
+--- src/libs/zbxdbcache/dbconfig.c	(revision 32723)
++++ src/libs/zbxdbcache/dbconfig.c	(revision 32724)
+@@ -3872,10 +3872,14 @@
+ 
+ 	LOCK_CACHE;
+ 
+-	if (NULL == (dc_interface = zbx_hashset_search(&config->interfaces, &interfaceid)) ||
+-			NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_interface->hostid)) ||
+-			HOST_MAINTENANCE_STATUS_OFF != dc_host->maintenance_status ||
+-			MAINTENANCE_TYPE_NORMAL != dc_host->maintenance_type)
++	if (NULL == (dc_interface = zbx_hashset_search(&config->interfaces, &interfaceid)))
++		goto unlock;
++
++	if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_interface->hostid)))
++		goto unlock;
++
++	if (HOST_MAINTENANCE_STATUS_ON == dc_host->maintenance_status &&
++			MAINTENANCE_TYPE_NODATA == dc_host->maintenance_type)
+ 	{
+ 		goto unlock;
+ 	}
diff --git a/zabbix-fedora.README b/zabbix-fedora.README
index 9dba2c9..671c140 100644
--- a/zabbix-fedora.README
+++ b/zabbix-fedora.README
@@ -27,7 +27,7 @@ better and is easier to maintain.
 ==Zabbix 2.0 packages conflict Zabbix 1.8==
 
 This measure was taken because this major version introduces various database
-schema changes. A silent update would render Zabbix nonoperational and possibly
+schema changes. A silent update would render Zabbix non-operational and possibly
 break the database. Besides that, Zabbix 2.0 server only works with other 2.0
 servers and proxies. Distributed setups must therefore be updated at the same
 time.
@@ -73,10 +73,10 @@ compatibility. maintenance.inc.php moved from /usr/share/zabbix/conf to
 /etc/zabbix/web.
 
 
-==Alert and media scripts==
+==Media scripts and external scripts==
 
-The Alert and media script directories have moved to /var/lib/zabbixsrv.
-Symlinks preserve compatibility.
+The directories for external scripts and media scripts have moved to
+/var/lib/zabbixsrv. Symlinks preserve compatibility.
 
 /var/lib/zabbix is now intended for scripts run by the agent. Please move your
 server or proxy scripts to /var/lib/zabbixsrv. Be sure to check permissions and
diff --git a/zabbix-logrotate.in b/zabbix-logrotate.in
index 027da64..c2f9045 100644
--- a/zabbix-logrotate.in
+++ b/zabbix-logrotate.in
@@ -4,4 +4,5 @@
 	notifempty
 	compress
 	create 0664 zabbix zabbix
+	su zabbix zabbix
 }
diff --git a/zabbix20.spec b/zabbix20.spec
index 730e8cd..89869b3 100644
--- a/zabbix20.spec
+++ b/zabbix20.spec
@@ -36,7 +36,7 @@
 
 Name:           zabbix20
 Version:        2.0.4
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Open-source monitoring solution for your IT infrastructure
 
 Group:          Applications/Internet
@@ -75,6 +75,9 @@ Patch3:         %{srcname}-1.8.12-fping3.patch
 # https://support.zabbix.com/browse/ZBX-3379
 Patch4:         %{srcname}-2.0.3-snmp-source-address.patch
 
+#https://support.zabbix.com/browse/ZBX-6101
+Patch5:         %{srcname}-2.0.4-snmptrap.patch
+
 BuildRequires:   mysql-devel
 BuildRequires:   postgresql-devel
 BuildRequires:   sqlite-devel
@@ -290,23 +293,29 @@ Zabbix web frontend for PostgreSQL
 %if 0%{?fedora}
 %patch3 -p1
 %endif
+
+# Logrotate's su option is currently only available in Fedora
+%if 0%{?rhel}
+sed -i '/su zabbix zabbix/d' %{SOURCE5}
+%endif
 %patch4 -p0
+%patch5 -p0
 
-# remove flash applet
+# Remove flash applet
 # https://support.zabbix.com/browse/ZBX-4794
 %patch2 -p1
 rm -f frontend/php/images/flash/zbxclock.swf
 
-# remove bundled java libs
+# Remove bundled java libs
 rm -rf src/zabbix_java/lib/*.jar
 
-# remove prebuilt Windows binaries
+# Remove prebuilt Windows binaries
 rm -rf bin
 
-# remove included fonts
+# Remove included fonts
 rm -rf frontends/php/fonts
 
-# remove executable permissions
+# Remove executable permissions
 chmod a-x upgrades/dbpatches/*/mysql/upgrade
 
 # All libraries are expected in /usr/lib or /usr/local/lib
@@ -314,7 +323,7 @@ chmod a-x upgrades/dbpatches/*/mysql/upgrade
 sed -i.orig -e 's|_LIBDIR=/usr/lib|_LIBDIR=%{_libdir}|g' \
     configure
 
-# kill off .htaccess files, options set in SOURCE1
+# Kill off .htaccess files, options set in SOURCE1
 rm -f frontends/php/include/.htaccess
 rm -f frontends/php/api/.htaccess
 rm -f frontends/php/conf/.htaccess
@@ -454,12 +463,12 @@ mv $RPM_BUILD_ROOT%{_datadir}/%{srcname}/conf/maintenance.inc.php $RPM_BUILD_ROO
 # Drop Apache config file in place
 install -m 0644 -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/%{srcname}.conf
 
-# install log rotation
-cat %{SOURCE5} | sed -e 's|COMPONENT|agentd|g' > \
+# Install log rotation
+sed -e 's|COMPONENT|agentd|g' %{SOURCE5} > \
      $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent
-cat %{SOURCE5} | sed -e 's|COMPONENT|server|g' > \
+sed -e 's|COMPONENT|server|g' %{SOURCE5} > \
      $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-server
-cat %{SOURCE5} | sed -e 's|COMPONENT|proxy|g' > \
+sed -e 's|COMPONENT|proxy|g' %{SOURCE5} > \
      $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-proxy
 
 %if 0%{?fedora}
@@ -653,6 +662,7 @@ getent passwd zabbixsrv > /dev/null || \
 :
 
 %preun proxy
+#TODO: Use the same style consistently
 if [ "$1" = 0 ]
 then
 %if 0%{?fedora}
@@ -666,12 +676,16 @@ fi
 :
 
 %preun agent
-%if 0%{?fedora}
 if [ $1 -eq 0 ] ; then
+%if 0%{?fedora}
   /bin/systemctl --no-reload disable zabbix-agent.service > /dev/null 2>&1 || :
   /bin/systemctl stop zabbix-agent.service > /dev/null 2>&1 || :
-fi
+%else
+  /sbin/service zabbix-agent stop >/dev/null 2>&1
+  /sbin/chkconfig --del zabbix-agent
 %endif
+fi
+:
 
 %postun server
 %if 0%{?fedora}
@@ -755,7 +769,9 @@ fi
 %files server
 %doc misc/snmptrap/zabbix_trap_receiver.pl
 %attr(0775,root,zabbix) %dir %{_localstatedir}/log/zabbix
+%if 0%{?rhel}
 %attr(0775,root,zabbix) %dir %{_localstatedir}/run/zabbix
+%endif
 %attr(0400,zabbixsrv,zabbix) %config(noreplace) %{_sysconfdir}/zabbix_server.conf
 %config(noreplace) %{_sysconfdir}/%{srcname}/zabbix_server.conf
 %config(noreplace) %{_sysconfdir}/%{srcname}/externalscripts
@@ -787,7 +803,9 @@ fi
 %files agent
 %doc conf/zabbix_agentd/*.conf
 %attr(0775,root,zabbix) %dir %{_localstatedir}/log/zabbix
+%if 0%{?rhel}
 %attr(0775,root,zabbix) %dir %{_localstatedir}/run/zabbix
+%endif
 %config(noreplace) %{_sysconfdir}/zabbix_agent.conf
 %config(noreplace) %{_sysconfdir}/%{srcname}/zabbix_agent.conf
 %config(noreplace) %{_sysconfdir}/zabbix_agentd.conf
@@ -806,7 +824,9 @@ fi
 %files proxy
 %doc misc/snmptrap/zabbix_trap_receiver.pl
 %attr(0775,root,zabbix) %dir %{_localstatedir}/log/zabbix
+%if 0%{?rhel}
 %attr(0775,root,zabbix) %dir %{_localstatedir}/run/zabbix
+%endif
 %attr(0600,zabbixsrv,zabbix) %config(noreplace) %{_sysconfdir}/zabbix_proxy.conf
 %config(noreplace) %{_sysconfdir}/%{srcname}/zabbix_proxy.conf
 %attr(0755,zabbixsrv,zabbix) %dir %{_sysconfdir}/%{srcname}/externalscripts
@@ -855,6 +875,12 @@ fi
 %files web-pgsql
 
 %changelog
+* Mon Jan 14 2013 Volker Fröhlich <volker27 at gmx.at> - 2.0.4-2
+- Apply patch for ZBX-6101
+- Add su line to logrotate config file
+- Do not own /var/run/zabbix on Fedora, systemd manages it
+- Add forgotten chkconfig and service commands on agent preun script
+
 * Sat Dec  8 2012 Volker Fröhlich <volker27 at gmx.at> - 2.0.4-1
 - New upstream release
 


More information about the scm-commits mailing list