]> git.pld-linux.org Git - packages/zabbix.git/blobdiff - zabbix.spec
up to 6.0.30
[packages/zabbix.git] / zabbix.spec
index da9fe64b5d9d91938ca95498169cd6c9bfac5c15..12126422b34145857524151140c48eb76f733a09 100644 (file)
@@ -1,25 +1,38 @@
 # TODO:
 # - initscript for zabbix-server, zabbix-proxy and zabbix-java
+# - unpackaged files:
+#   /usr/bin/zabbix_js
+#   /var/lib/zabbix/zabbix.db
 #
 # Conditional build:
 %bcond_without pgsql   # enable PostgreSQL support
 %bcond_without sqlite3 # enable sqlite3 support
 %bcond_without mysql   # enable MySQL support
 %bcond_without java    # disable java support
+%bcond_without agent2  # disable bulding of Go based agent2
 
 %define databases %{?with_sqlite3:sqlite3} %{?with_pgsql:postgresql} %{?with_mysql:mysql}
 %define any_database %{with pgsql}%{with mysql}%{with sqlite3}
 
-%define                php_min_version 5.4.0
+%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:       4.2.0
-Release:       2
+Version:       6.0.30
+Release:       1
 License:       GPL v2+
 Group:         Networking/Utilities
-Source0:       http://downloads.sourceforge.net/zabbix/%{name}-%{version}.tar.gz
-# Source0-md5: 20f261708f95787f3dbea3eab89f804d
+# https://www.zabbix.com/download_sources
+Source0:       https://cdn.zabbix.com/zabbix/sources/stable/6.0/%{name}-%{version}.tar.gz
+# Source0-md5: 7f553e63c07f330996ad06ea87ea2f38
+Source100:     go-vendor.tar.xz
+# Source100-md5:       b25dd4b2a72c62d6fa1378031b261a3d
 Source1:       %{name}-apache.conf
 Source2:       %{name}_server.service
 Source3:       %{name}_agentd.service
@@ -27,16 +40,28 @@ Source4:    %{name}_proxy.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
 Patch0:                config.patch
 Patch1:                sqlite3_dbname.patch
 Patch2:                always_compile_ipc.patch
-URL:           http://zabbix.sourceforge.net/
+Patch3:                go-destdir.patch
+Patch4:                go-vendor.patch
+URL:           https://www.zabbix.com/
 BuildRequires: OpenIPMI-devel
 BuildRequires: autoconf
 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.19}
 BuildRequires: libevent-devel
 BuildRequires: libssh2-devel
 BuildRequires: libtool
@@ -47,9 +72,11 @@ BuildRequires:       openldap-devel >= 2.4.6
 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}
@@ -61,6 +88,14 @@ BuildRoot:   %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 %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
@@ -119,6 +154,34 @@ Zabbix agent collects data from the local system for a Zabbix server.
 %description agentd -l pl.UTF-8
 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
 
+%package agent2
+Summary:       Zabbix Agent 2
+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
+place of Zabbix agent.
+
+Zabbix agent 2 has been developed to:
+- reduce the number of TCP connections
+- have greater check concurrency
+- be easily extendible with plugins.
+
+A plugin should be able to:
+- provide trivial checks consisting of only a few simple lines of code
+- provide complex checks consisting of long-running scripts and
+  standalone data gathering with periodic sending back of the data
+- be a drop-in replacement for Zabbix agent (in that it supports all
+  the previous functionality)
+
+Passive checks work similarly to Zabbix agent. Active checks support
+scheduled/flexible intervals and check concurrency within one active
+server.
+
 %package frontend-php
 Summary:       PHP frontend for Zabbix
 Summary(pl.UTF-8):     Interfejs PHP dla Zabbiksa
@@ -126,12 +189,15 @@ Group:            Applications/WWW
 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)
@@ -288,11 +354,12 @@ Requires: systemd-units >= 38
 This package provides the Zabbix Java Gateway.
 
 %prep
-%setup -q
-
+%setup -q -a100
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 %build
 %{__libtoolize}
@@ -303,12 +370,17 @@ This package provides the Zabbix Java Gateway.
 
 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} \
        --enable-ipv6 \
        %{__enable_disable java} \
-       --with-jabber \
        --with-ldap \
        --with-libcurl \
+       --with-libevent \
+       --with-libpcre \
        --with-libxml2 \
        --with-net-snmp \
        --with-openipmi \
@@ -350,7 +422,9 @@ done
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d,/etc/webapps/%{_webapp},%{_appdir}} \
+install -d \
+       $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}}
 
 %{__make} install \
@@ -367,8 +441,8 @@ for database in %{databases} ; do
 done
 
 if [ -n "$database" ] ; then
-       ln -sf %{_sbindir}/zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
-       ln -sf %{_sbindir}/zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
+       ln -sf zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
+       ln -sf zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
 fi
 
 %if %{with sqlite3}
@@ -376,30 +450,32 @@ install -d $RPM_BUILD_ROOT/var/lib/zabbix
 touch $RPM_BUILD_ROOT/var/lib/zabbix/zabbix.db
 %endif
 
-cp -r frontends $RPM_BUILD_ROOT%{_appdir}
+cp -r ui/* $RPM_BUILD_ROOT%{_appdir}/frontends/php
 
 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
 
 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
 
 mv $RPM_BUILD_ROOT%{_appdir}/frontends/php/conf $RPM_BUILD_ROOT%{_sysconfdir}/frontend
-ln -s %{_sysconfdir}/frontend $RPM_BUILD_ROOT%{_appdir}/frontends/php/conf
+ln -s --relative $RPM_BUILD_ROOT{%{_sysconfdir}/frontend,%{_appdir}/frontends/php/conf}
 touch $RPM_BUILD_ROOT%{_sysconfdir}/frontend/zabbix.conf.php
 
 %if %{with java}
 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
-ln -s %{_sysconfdir}/zabbix_java.conf $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh
+ln -s --relative $RPM_BUILD_ROOT{%{_sysconfdir}/zabbix_java.conf,%{_datadir}/zabbix_java/settings.sh}
 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
-ln -s %{_sysconfdir}/java-logback.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml
+ln -s --relative $RPM_BUILD_ROOT{%{_sysconfdir}/java-logback.xml,%{_datadir}/zabbix_java/lib/logback.xml}
 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
-ln -s %{_sysconfdir}/java-logback-console.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml
+ln -s --relative $RPM_BUILD_ROOT{%{_sysconfdir}/java-logback-console.xml,%{_datadir}/zabbix_java/lib/logback-console.xml}
 
 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
 #!/bin/sh
@@ -429,6 +505,9 @@ rm -rf $RPM_BUILD_ROOT
 %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
@@ -447,12 +526,12 @@ if [ "$1" = 1 ]; then
 
        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 %{_sbindir}/zabbix_server-mysql %{_sbindir}/zabbix_server || :
+ln -sf zabbix_server-mysql %{_sbindir}/zabbix_server || :
 
 %post server-postgresql
 if [ "$1" = 1 ]; then
@@ -462,13 +541,13 @@ if [ "$1" = 1 ]; then
        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 %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
+ln -sf zabbix_server-postgresql %{_sbindir}/zabbix_server || :
 
 %post server
 %systemd_post zabbix_server.service
@@ -499,14 +578,26 @@ fi
 %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 %{_sbindir}/zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
+ln -sf zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
 
 %post proxy-postgresql
-ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
+ln -sf zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
 
 %post proxy-sqlite3
-ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
+ln -sf zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 
 %post proxy
 %systemd_post zabbix_proxy.service
@@ -551,6 +642,19 @@ ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 %{_mandir}/man8/zabbix_agentd*
 %{systemdunitdir}/zabbix_agentd.service
 
+%if %{with agent2}
+%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.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
 %defattr(644,root,root,755)
 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
@@ -572,7 +676,7 @@ ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 %defattr(644,root,root,755)
 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
-%ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
+%ghost %{_sbindir}/zabbix_proxy
 %{_mandir}/man8/zabbix_proxy*
 %{systemdunitdir}/zabbix_proxy.service
 %endif
@@ -605,7 +709,7 @@ ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 %defattr(644,root,root,755)
 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
-%ghost %attr(755,root,root) %{_sbindir}/zabbix_server
+%ghost %{_sbindir}/zabbix_server
 %{_mandir}/man8/zabbix_server*
 %{systemdunitdir}/zabbix_server.service
 %endif
This page took 0.110013 seconds and 4 git commands to generate.