# TODO:
# - initscript for zabbix-server, zabbix-proxy and zabbix-java
# - unpackaged files:
-# /lib/systemd/system/zabbix_java.service
# /usr/bin/zabbix_js
# /var/lib/zabbix/zabbix.db
#
%define databases %{?with_sqlite3:sqlite3} %{?with_pgsql:postgresql} %{?with_mysql:mysql}
%define any_database %{with pgsql}%{with mysql}%{with sqlite3}
-%ifnarch %{ix86} %{x8664}
+%ifnarch %{go_arches}
%undefine with_agent2
%endif
+%{?with_java:%{?use_default_jdk}}
+
%define php_min_version 7.2.5
Summary: Zabbix - network monitoring software
Summary(pl.UTF-8): Zabbix - oprogramowanie do monitorowania sieci
Name: zabbix
-Version: 5.4.3
-Release: 0.7
+Version: 6.0.29
+Release: 1
License: GPL v2+
Group: Networking/Utilities
# https://www.zabbix.com/download_sources
-Source0: https://cdn.zabbix.com/zabbix/sources/stable/5.4/%{name}-%{version}.tar.gz
-# Source0-md5: 5dccb536c164e45c7d5c1a5a9d64be43
+Source0: https://cdn.zabbix.com/zabbix/sources/stable/6.0/%{name}-%{version}.tar.gz
+# Source0-md5: 73314d5d61722baf9236a4755f07a100
+Source100: go-vendor.tar.xz
+# Source100-md5: 4a9250ca3ff0b8cf94e6540f8f542628
Source1: %{name}-apache.conf
Source2: %{name}_server.service
Source3: %{name}_agentd.service
Source5: %{name}_java.service
Source6: %{name}.tmpfiles
Source7: %{name}_agentd.init
+Source8: %{name}_agent2.init
+Source9: %{name}_agent2.service
%if 0
cd src/go/
go mod vendor
tar -caf ~/go-vendor.tar.xz -C ../../ src/go/vendor
%endif
-Source8: go-vendor.tar.xz
-# Source8-md5: 61f2ee9647280765b622a5e1e8cdfbba
Patch0: config.patch
Patch1: sqlite3_dbname.patch
Patch2: always_compile_ipc.patch
BuildRequires: automake >= 1:1.15
BuildRequires: curl-devel
BuildRequires: iksemel-devel
-%{?with_java:BuildRequires: jdk}
+%{?with_java:%buildrequires_jdk}
+BuildRequires: rpm-build >= 4.6
%{?with_java:BuildRequires: rpm-pld-macros-javaprov}
-%{?with_agent2:BuildRequires: golang >= 1.13}
+%{?with_agent2:BuildRequires: golang >= 1.19}
BuildRequires: libevent-devel
BuildRequires: libssh2-devel
BuildRequires: libtool
BuildRequires: openssl-devel >= 0.9.7d
BuildRequires: pcre-devel
%{?with_pgsql:BuildRequires: postgresql-devel}
-BuildRequires: rpmbuild(macros) >= 1.671
+BuildRequires: rpmbuild(macros) >= 2.021
%{?with_sqlite3:BuildRequires: sqlite3-devel}
+BuildRequires: tar >= 1:1.22
BuildRequires: unixODBC-devel
+BuildRequires: xz
BuildRequires: zlib-devel
Requires: %{name}-agentd = %{version}-%{release}
Requires: %{name}-frontend-php = %{version}-%{release}
%define _webapps /etc/webapps
%define _webapp %{name}
+%if %{defined __compress_doc}
+%define doc_cat zcat
+%define doc_suffix .gz
+%else
+%define doc_cat cat
+%define doc_suffix %{nil}
+%endif
+
%description
Zabbix is software that monitors numerous parameters of a network and
the servers on that network. It is a useful tool for monitoring the
Group: Networking/Utilities
URL: https://www.zabbix.com/documentation/current/manual/concepts/agent2
Requires: %{name}-common = %{version}-%{release}
+Requires(post,preun): /sbin/chkconfig
+Requires: rc-scripts
%description agent2
Zabbix agent 2 is a new generation of Zabbix agent and may be used in
Requires: php(bcmath)
Requires: php(core) >= %{php_min_version}
Requires: php(ctype)
+Requires: php(filter)
Requires: php(gd)
Requires: php(gettext)
Requires: php(json)
Requires: php(mbstring)
+Requires: php(openssl)
Requires: php(pcre)
Requires: php(session)
+Requires: php(simplexml)
Requires: php(sockets)
Requires: php(xml)
Requires: php(xmlreader)
This package provides the Zabbix Java Gateway.
%prep
-%setup -q -a8
+%setup -q -a100
%patch0 -p1
%patch1 -p1
%patch2 -p1
configure() {
%configure \
+ %{?with_java:ac_cv_prog_JAVAC=%{java_home}/bin/javac} \
+ %{?with_java:ac_cv_prog_JAR=%{java_home}/bin/jar} \
--enable-dependency-tracking \
--enable-agent \
%{__enable_disable agent2} \
%install
rm -rf $RPM_BUILD_ROOT
install -d \
- $RPM_BUILD_ROOT{%{_sysconfdir}/zabbix_agent2.conf.d,/etc/webapps/%{_webapp}} \
+ $RPM_BUILD_ROOT/etc/webapps/%{_webapp} \
$RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_appdir}/frontends/php} \
$RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix,%{systemdunitdir},%{systemdtmpfilesdir}}
install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_server.service
install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_agentd.service
+install %{SOURCE9} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_agent2.service
install %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
+install %{SOURCE8} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agent2
install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_proxy.service
-install %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_java.service
+%{?with_java:install %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_java.service}
cp -p %{SOURCE6} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/zabbix.conf
%triggerun frontend-php -- apache < 2.2.0, apache-base
%webapp_unregister httpd %{_webapp}
+%triggerpostun agent2 -- zabbix-agent2 < 6.0.15
+%systemd_trigger zabbix_agent2.service
+
%pre common
%groupadd -g 111 zabbix
%useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
Running these should be fine in most cases:
mysqladmin create zabbix
- zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
- zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
- zcat %{_docdir}/%{name}-server-mysql-%{version}/data.sql.gz | mysql zabbix
+ %doc_cat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql%{doc_suffix} | mysql zabbix
+ %doc_cat %{_docdir}/%{name}-server-mysql-%{version}/images.sql%{doc_suffix} | mysql zabbix
+ %doc_cat %{_docdir}/%{name}-server-mysql-%{version}/data.sql%{doc_suffix} | mysql zabbix
EOF
fi
ln -sf zabbix_server-mysql %{_sbindir}/zabbix_server || :
Running these should be fine in most cases:
createuser zabbix
- createdb -O zabbix zabbix
- zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -u zabbix zabbix
- zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -u zabbix zabbix
- zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -u zabbix zabbix
+ createdb -O zabbix -E utf8 -T template0 zabbix
+ %doc_cat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql%{doc_suffix} | psql -U zabbix zabbix
+ %doc_cat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql%{doc_suffix} | psql -U zabbix zabbix
+ %doc_cat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql%{doc_suffix} | psql -U zabbix zabbix
EOF
fi
ln -sf zabbix_server-postgresql %{_sbindir}/zabbix_server || :
%postun agentd
%systemd_reload
+%post agent2
+/sbin/chkconfig --add zabbix_agent2
+%service zabbix_agent2 restart
+%systemd_post zabbix_agent2.service
+
+%preun agent2
+if [ "$1" = "0" ]; then
+ %service -q zabbix_agent2 stop
+ /sbin/chkconfig --del zabbix_agent2
+fi
+%systemd_preun zabbix_agent2.service
+
%post proxy-mysql
ln -sf zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
%files agent2
%defattr(644,root,root,755)
%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.conf
-%dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.conf.d
+%dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.d
+%dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.d/plugins.d
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/*.conf
+%attr(754,root,root) /etc/rc.d/init.d/zabbix_agent2
%attr(755,root,root) %{_sbindir}/zabbix_agent2
%{_mandir}/man8/zabbix_agent2.8*
+%{systemdunitdir}/zabbix_agent2.service
%endif
%files frontend-php