]> TLD Linux GIT Repositories - packages/zabbix.git/blobdiff - zabbix.spec
- build and package Zabbix Agent 2
[packages/zabbix.git] / zabbix.spec
index 57ef7b07cd20037a5b6305906806a380a38c280a..fcbbe4c9c1c821ea5f0ef3a13ac702a0aecf34bf 100644 (file)
 %define databases %{?with_sqlite3:sqlite3} %{?with_pgsql:postgresql} %{?with_mysql:mysql}
 %define any_database %{with pgsql}%{with mysql}%{with sqlite3}
 
+%define                _noautoreq 'pear(.*\.php)'
+
 %define                php_min_version 5.4.0
 Summary:       Zabbix - network monitoring software
 Summary(pl.UTF-8):     Zabbix - oprogramowanie do monitorowania sieci
 Name:          zabbix
-Version:       5.0.7
-Release:       0.1
+Version:       6.0.19
+Release:       1
 License:       GPL v2+
 Group:         Networking/Utilities
-Source0:       https://cdn.zabbix.com/zabbix/sources/stable/5.0/%{name}-%{version}.tar.gz
-# Source0-md5: e0798bb1b53ab7b451556dc34c3b1827
+Source0:       https://cdn.zabbix.com/zabbix/sources/stable/6.0/%{name}-%{version}.tar.gz
+# Source0-md5: a57192d6bb17f9ca80a75f87d5462987
 Source1:       %{name}-apache.conf
 Source2:       %{name}_agentd.init
+Source3:       %{name}_server.init
+Source4:       %{name}_proxy.init
+Source5:       %{name}_agent2.init
 Patch0:                tld.patch
 Patch1:                sqlite3_dbname.patch
 Patch2:                always_compile_ipc.patch
@@ -30,7 +35,7 @@ BuildRequires:        OpenIPMI-devel
 BuildRequires: autoconf
 BuildRequires: automake >= 1:1.15
 BuildRequires: curl-devel
-#BuildRequires:        iksemel-devel
+BuildRequires: golang
 %{?with_java:BuildRequires:    jdk}
 BuildRequires: libevent-devel
 BuildRequires: libssh2-devel
@@ -99,6 +104,20 @@ 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
+Summary(pl.UTF-8):     Agent 2 Zabbixa
+Group:         Networking/Utilities
+Requires:      %{name} = %{version}-%{release}
+Requires(post,preun):  /sbin/chkconfig
+Requires:      rc-scripts
+
+%description agent2
+Zabbix agent collects data from the local system for a Zabbix server.
+
+%description agent2 -l pl.UTF-8
+Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
+
 %package web
 Summary:       Web frontend for Zabbix
 Summary(pl.UTF-8):     Interfejs Web dla Zabbixa
@@ -259,6 +278,7 @@ This package provides the Zabbix Java Gateway.
 configure() {
        %configure \
        --enable-agent \
+       --enable-agent2 \
        --enable-ipv6 \
        %{__enable_disable java} \
        --with-jabber \
@@ -310,6 +330,7 @@ install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d,/etc/webapps/%{_webap
 
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT \
+       GOBIN=$RPM_BUILD_ROOT%{_sbindir} \
        ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
 
 for database in %{databases} ; do
@@ -332,6 +353,9 @@ 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/etc/rc.d/init.d/zabbix_agentd
+install        %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_server
+install        %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_proxy
+install        %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agent2
 
 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
@@ -384,6 +408,7 @@ if [ "$1" = 1 ]; then
        You should create database for 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
@@ -399,16 +424,24 @@ 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
+       createuser -U postgres zabbix
+       createdb -U postgres -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
 EOF
 fi
 ln -sf %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
 
+%post server
+/sbin/chkconfig --add zabbix_server
+%service zabbix_server restart
+
 %postun server
+if [ "$1" = "0" ]; then
+       %service -q zabbix_server stop
+       /sbin/chkconfig --del zabbix_server
+fi
 if [ "$1" = "0" ]; then
        if [ -L %{_sbindir}/zabbix_server ] ; then
                rm -f %{_sbindir}/zabbix_server || :
@@ -425,6 +458,16 @@ if [ "$1" = "0" ]; then
        /sbin/chkconfig --del zabbix_agentd
 fi
 
+%post agent2
+/sbin/chkconfig --add zabbix_agent2
+%service zabbix_agent2 restart
+
+%preun agent2
+if [ "$1" = "0" ]; then
+       %service -q zabbix_agent2 stop
+       /sbin/chkconfig --del zabbix_agent2
+fi
+
 %post proxy-mysql
 ln -sf %{_sbindir}/zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
 
@@ -434,6 +477,21 @@ ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
 %post proxy-sqlite3
 ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 
+%post proxy
+/sbin/chkconfig --add zabbix_server
+%service zabbix_server restart
+
+%postun proxy
+if [ "$1" = "0" ]; then
+       %service -q zabbix_proxy stop
+       /sbin/chkconfig --del zabbix_proxy
+fi
+if [ "$1" = "0" ]; then
+       if [ -L %{_sbindir}/zabbix_proxy ] ; then
+               rm -f %{_sbindir}/zabbix_proxy || :
+       fi
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS ChangeLog README
@@ -457,6 +515,24 @@ ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 %attr(755,root,root) %{_sbindir}/zabbix_agentd
 %{_mandir}/man8/zabbix_agentd*
 
+%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/ceph.conf
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/docker.conf
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/memcached.conf
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/modbus.conf
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/mqtt.conf
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/mysql.conf
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/oracle.conf
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/redis.conf
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/smart.conf
+%attr(754,root,root) /etc/rc.d/init.d/zabbix_agent2
+%attr(755,root,root) %{_sbindir}/zabbix_agent2
+%{_mandir}/man8/zabbix_agent2*
+
 %files web
 %defattr(644,root,root,755)
 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
@@ -473,6 +549,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
+%attr(754,root,root) /etc/rc.d/init.d/zabbix_proxy
 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
 %{_mandir}/man8/zabbix_proxy*
 %endif
@@ -501,6 +578,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
+%attr(754,root,root) /etc/rc.d/init.d/zabbix_server
 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
 %{_mandir}/man8/zabbix_server*
 %endif