From 175a781ff5f4eb8c1a2579d02695d2dd4b381a58 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Feb 03 2021 15:11:14 +0000 Subject: Initial import of upstream zabbix 5.0.8 Signed-off-by: Fabian Arrotin --- diff --git a/SOURCES/zabbix-nginx.conf b/SOURCES/zabbix-nginx.conf index d68d3bc..3777526 100644 --- a/SOURCES/zabbix-nginx.conf +++ b/SOURCES/zabbix-nginx.conf @@ -29,7 +29,9 @@ server { } location ~ [^/]\.php(/|$) { - fastcgi_pass unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock; + fastcgi_pass unix:/run/php-fpm/zabbix.sock; +# fastcgi_pass unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock; +# fastcgi_pass unix:/var/opt/rh/rh-php73/run/php-fpm/zabbix.sock; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; diff --git a/SOURCES/zabbix-php-fpm.conf b/SOURCES/zabbix-php-fpm.conf index cb4b5e2..fa38188 100644 --- a/SOURCES/zabbix-php-fpm.conf +++ b/SOURCES/zabbix-php-fpm.conf @@ -2,8 +2,8 @@ user = apache group = apache -listen = /var/opt/rh/rh-php72/run/php-fpm/zabbix.sock -listen.acl_users = apache +listen = /run/php-fpm/zabbix.sock +listen.acl_users = apache,nginx listen.allowed_clients = 127.0.0.1 pm = dynamic @@ -13,7 +13,7 @@ pm.min_spare_servers = 5 pm.max_spare_servers = 35 php_value[session.save_handler] = files -php_value[session.save_path] = /var/opt/rh/rh-php72/lib/php/session/ +php_value[session.save_path] = /var/lib/php/session php_value[max_execution_time] = 300 php_value[memory_limit] = 128M diff --git a/SOURCES/zabbix-php-fpm.conf.rhel-7 b/SOURCES/zabbix-php-fpm.conf.rhel-7 new file mode 100644 index 0000000..5918a93 --- /dev/null +++ b/SOURCES/zabbix-php-fpm.conf.rhel-7 @@ -0,0 +1,24 @@ +[zabbix] +user = apache +group = apache + +listen = /run/php-fpm/zabbix.sock +listen.acl_users = apache +listen.allowed_clients = 127.0.0.1 + +pm = dynamic +pm.max_children = 50 +pm.start_servers = 5 +pm.min_spare_servers = 5 +pm.max_spare_servers = 35 + +php_value[session.save_handler] = files +php_value[session.save_path] = /var/lib/php/session + +php_value[max_execution_time] = 300 +php_value[memory_limit] = 128M +php_value[post_max_size] = 16M +php_value[upload_max_filesize] = 2M +php_value[max_input_time] = 300 +php_value[max_input_vars] = 10000 +; php_value[date.timezone] = Europe/Riga diff --git a/SOURCES/zabbix-web-fcgi.conf b/SOURCES/zabbix-web-fcgi.conf index 0716fe3..e072800 100644 --- a/SOURCES/zabbix-web-fcgi.conf +++ b/SOURCES/zabbix-web-fcgi.conf @@ -14,7 +14,9 @@ Alias /zabbix /usr/share/zabbix - SetHandler "proxy:unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php-fpm/zabbix.sock|fcgi://localhost" +# SetHandler "proxy:unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock|fcgi://localhost" +# SetHandler "proxy:unix:/var/opt/rh/rh-php73/run/php-fpm/zabbix.sock|fcgi://localhost" diff --git a/SPECS/zabbix.spec b/SPECS/zabbix.spec index cff7b64..d7b781b 100644 --- a/SPECS/zabbix.spec +++ b/SPECS/zabbix.spec @@ -1,6 +1,6 @@ Name: zabbix -Version: 5.0.7 -Release: %{?alphatag:0.}2%{?alphatag}%{?dist} +Version: 5.0.8 +Release: %{?alphatag:0.}4%{?alphatag}%{?dist} Summary: The Enterprise-class open source monitoring solution Group: Applications/Internet License: GPLv2+ @@ -26,15 +26,36 @@ Source19: zabbix-agent2.service Source20: zabbix-agent.sysconfig Source21: zabbix-agent2.init Source22: zabbix-agent2.sysconfig +Source23: zabbix-php-fpm.conf.rhel-7 Patch0: config.patch Patch1: fping3-sourceip-option.patch Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n) -%ifarch x86_64 +%{!?build_agent: %global build_agent 1} + %if 0%{?rhel} >= 6 -%define build_agent2 0 +%ifarch x86_64 +%{!?build_agent2: %global build_agent2 1} +%endif +%endif + +%if 0%{?rhel} >= 7 +%{!?build_proxy: %global build_proxy 1} +%{!?build_java_gateway: %global build_java_gateway 1} +%{!?build_server: %global build_server 1} +%{!?build_frontend: %global build_frontend 1} + +%{!?build_with_mysql: %global build_with_mysql 1} +%{!?build_with_pgsql: %global build_with_pgsql 1} +%{!?build_with_sqlite: %global build_with_sqlite 1} +%endif + +%if 0%{?build_with_mysql} == 0 && 0%{?build_with_pgsql} == 0 +%global build_server 0 +%if 0%{?build_with_sqlite} == 0 +%global build_proxy 0 %endif %endif @@ -339,6 +360,23 @@ Requires: zabbix-web-database-scl = %{version}-%{release} %description web-deps-scl Convenience package for installing php dependencies of zabbix-web package from redhat software collections +%package web-deps-scl-php73 +Summary: Convenience package for installing php dependencies of zabbix-web package from redhat software collections +Group: Applications/Internet +BuildArch: noarch +Requires: rh-php73 +Requires: rh-php73-php-gd +Requires: rh-php73-php-bcmath +Requires: rh-php73-php-mbstring +Requires: rh-php73-php-xml +Requires: rh-php73-php-ldap +Requires: rh-php73-php-fpm +Requires: zabbix-web-database-scl-php73 = %{version}-%{release} +Provides: zabbix-web-deps-scl = %{version}-%{release} + +%description web-deps-scl-php73 +Convenience package for installing php dependencies of zabbix-web package from redhat software collections + %package web-mysql-scl Summary: Zabbix web frontend for MySQL (scl version) Group: Applications/Internet @@ -351,6 +389,18 @@ Provides: zabbix-web-database-scl = %{version}-%{release} %description web-mysql-scl Convenience package for installing zabbix-web-mysql, and php dependencies from redhat software collections +%package web-mysql-scl-php73 +Summary: Zabbix web frontend for MySQL (scl version) +Group: Applications/Internet +BuildArch: noarch +Requires: rh-php73-php-mysqlnd +Requires: zabbix-web = %{version}-%{release} +Requires: zabbix-web-deps-scl-php73 = %{version}-%{release} +Provides: zabbix-web-database-scl-php73 = %{version}-%{release} + +%description web-mysql-scl-php73 +Convenience package for installing zabbix-web-mysql, and php dependencies from redhat software collections + %package web-pgsql-scl Summary: Zabbix web frontend for PostgreSQL (scl version) Group: Applications/Internet @@ -363,6 +413,18 @@ Provides: zabbix-web-database-scl = %{version}-%{release} %description web-pgsql-scl Convenience package for installing zabbix-web-pgsql, and php dependencies from redhat software collections +%package web-pgsql-scl-php73 +Summary: Zabbix web frontend for PostgreSQL (scl version) +Group: Applications/Internet +BuildArch: noarch +Requires: rh-php73-php-pgsql +Requires: zabbix-web = %{version}-%{release} +Requires: zabbix-web-deps-scl-php73 = %{version}-%{release} +Provides: zabbix-web-database-scl-php73 = %{version}-%{release} + +%description web-pgsql-scl-php73 +Convenience package for installing zabbix-web-pgsql, and php dependencies from redhat software collections + %package apache-conf-scl Summary: Zabbix frontend configuration for apache (scl version) Group: Applications/Internet @@ -373,6 +435,16 @@ Requires: httpd %description apache-conf-scl Zabbix frontend configuration for apache (scl version) +%package apache-conf-scl-php73 +Summary: Zabbix frontend configuration for apache (scl version) +Group: Applications/Internet +BuildArch: noarch +Requires: zabbix-web-deps-scl-php73 = %{version}-%{release} +Requires: httpd + +%description apache-conf-scl-php73 +Zabbix frontend configuration for apache (scl version) + %package nginx-conf-scl Summary: Zabbix frontend configuration for nginx (scl version) Group: Applications/Internet @@ -382,6 +454,16 @@ Requires: rh-nginx116-nginx %description nginx-conf-scl Zabbix frontend configuration for nginx (scl version) + +%package nginx-conf-scl-php73 +Summary: Zabbix frontend configuration for nginx (scl version) +Group: Applications/Internet +BuildArch: noarch +Requires: zabbix-web-deps-scl-php73 = %{version}-%{release} +Requires: rh-nginx116-nginx + +%description nginx-conf-scl-php73 +Zabbix frontend configuration for nginx (scl version) %endif # rhel == 7 @@ -412,10 +494,9 @@ Zabbix java gateway %prep %setup0 -q -n %{name}-%{version}%{?alphatag} + +%if 0%{?build_frontend} %patch0 -p1 -%if 0%{?rhel} >= 7 -%patch1 -p1 -%endif ## remove font file rm -f ui/assets/fonts/DejaVuSans.ttf @@ -433,16 +514,20 @@ rm -f ui/local/.htaccess # remove translation source files and scripts find ui/locale -name '*.po' | xargs rm -f find ui/locale -name '*.sh' | xargs rm -f +%endif + +%if 0%{?build_server} || 0%{?build_proxy} || 0%{?build_agent} || 0%{?build_agent2} +%patch1 -p1 +%endif +%if 0%{?build_server} || 0%{?build_proxy} # traceroute command path for global script sed -i -e 's|/usr/bin/traceroute|/bin/traceroute|' database/mysql/data.sql sed -i -e 's|/usr/bin/traceroute|/bin/traceroute|' database/postgresql/data.sql sed -i -e 's|/usr/bin/traceroute|/bin/traceroute|' database/sqlite3/data.sql +%endif -# change log directory for Java Gateway -sed -i -e 's|/tmp/zabbix_java.log|/var/log/zabbix/zabbix_java_gateway.log|g' src/zabbix_java/lib/logback.xml - -%if 0%{?rhel} >= 7 +%if 0%{?build_server} # copy sql files for servers cat database/mysql/schema.sql > database/mysql/create.sql cat database/mysql/images.sql >> database/mysql/create.sql @@ -454,23 +539,31 @@ cat database/postgresql/images.sql >> database/postgresql/create.sql cat database/postgresql/data.sql >> database/postgresql/create.sql gzip database/postgresql/create.sql gzip database/postgresql/timescaledb.sql +%endif +%if 0%{?build_proxy} # sql files for proxyes gzip database/mysql/schema.sql gzip database/postgresql/schema.sql gzip database/sqlite3/schema.sql %endif -%build +%if 0%{?build_java_gateway} +# change log directory for Java Gateway +sed -i -e 's|/tmp/zabbix_java.log|/var/log/zabbix/zabbix_java_gateway.log|g' src/zabbix_java/lib/logback.xml +%endif -build_flags=" + +# Build consists of 1-3 configure/make passes, one for each database. +# pass 1: is sqlite proxy, may be omitted. +# pass 2: is pqsql server/proxy, may be omitted. +# pass 3: If only one database is enabled, then it must occur with pass 3. + +%build +build_conf_common=" --enable-dependency-tracking --sysconfdir=/etc/zabbix --libdir=%{_libdir}/zabbix - --enable-agent -%if 0%{?build_agent2} - --enable-agent2 -%endif --enable-ipv6 --with-net-snmp --with-ldap @@ -485,141 +578,187 @@ build_flags=" --with-libxml2 --with-libevent --with-libpcre -" - %if 0%{?rhel} >= 6 -build_flags="$build_flags --with-openssl" + --with-openssl %endif +" -%if 0%{?rhel} >= 7 -%configure $build_flags --enable-proxy --with-sqlite3 -make %{?_smp_mflags} -mv src/zabbix_proxy/zabbix_proxy src/zabbix_proxy/zabbix_proxy_sqlite3 +# setup pass 3 +%if 0%{?build_with_mysql} && ( 0%{?build_server} || 0%{?build_proxy} ) +build_conf_3=" +%if 0%{?build_server} + --enable-server +%endif +%if 0%{?build_proxy} + --enable-proxy +%endif + --with-mysql +" -build_flags="$build_flags --enable-server --enable-proxy --enable-java" +build_db_3=mysql +%endif -%configure $build_flags --with-mysql -make %{?_smp_mflags} -mv src/zabbix_server/zabbix_server src/zabbix_server/zabbix_server_mysql -mv src/zabbix_proxy/zabbix_proxy src/zabbix_proxy/zabbix_proxy_mysql -%configure $build_flags --with-postgresql -make %{?_smp_mflags} -mv src/zabbix_server/zabbix_server src/zabbix_server/zabbix_server_pgsql -mv src/zabbix_proxy/zabbix_proxy src/zabbix_proxy/zabbix_proxy_pgsql +# setup pass 2 +%if 0%{?build_with_pgsql} && ( 0%{?build_server} || 0%{?build_proxy} ) +build_conf_2=" +%if 0%{?build_server} + --enable-server +%endif +%if 0%{?build_proxy} + --enable-proxy +%endif + --with-postgresql +" -touch src/zabbix_server/zabbix_server -touch src/zabbix_proxy/zabbix_proxy -%else -%configure $build_flags +if [ -z "$build_conf_3" ]; then + build_conf_3="$build_conf_2" + build_conf_2="" + build_db_3="pgsql" +fi %endif -%install -rm -rf $RPM_BUILD_ROOT +# setup pass 1 +%if 0%{?build_with_sqlite} && 0%{?build_proxy} +build_conf_1="--enable-proxy --with-sqlite3" -# install -%if 0%{?build_agent2} -make DESTDIR=$RPM_BUILD_ROOT GOBIN=$RPM_BUILD_ROOT%{_sbindir} install -%else -make DESTDIR=$RPM_BUILD_ROOT install +if [ -z "$build_conf_3" ]; then + build_conf_3="$build_conf_1" + build_conf_1="" + build_db_3=sqlite3 +fi %endif -# install necessary directories -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/zabbix -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/zabbix -# install server and proxy binaries -%if 0%{?rhel} >= 7 -install -m 0755 -p src/zabbix_server/zabbix_server_* $RPM_BUILD_ROOT%{_sbindir}/ -rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_server -install -m 0755 -p src/zabbix_proxy/zabbix_proxy_* $RPM_BUILD_ROOT%{_sbindir}/ -rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy +# add agents and java-gateway to pass 3 +build_conf_3=" +%if 0%{?build_agent} + --enable-agent +%endif +%if 0%{?build_agent2} + --enable-agent2 +%endif +%if 0%{?build_java_gateway} + --enable-java +%endif + $build_conf_3 +" -# delete unnecessary files from java gateway -rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/settings.sh -rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/startup.sh -rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/shutdown.sh -# install scripts and modules directories -mkdir -p $RPM_BUILD_ROOT/usr/lib/zabbix -mv $RPM_BUILD_ROOT%{_datadir}/zabbix/alertscripts $RPM_BUILD_ROOT/usr/lib/zabbix -mv $RPM_BUILD_ROOT%{_datadir}/zabbix/externalscripts $RPM_BUILD_ROOT/usr/lib/zabbix +# pass 1 +if [ -n "$build_conf_1" ]; then + %configure $build_conf_common $build_conf_1 + make $make_flags + mv src/zabbix_proxy/zabbix_proxy src/zabbix_proxy/zabbix_proxy_sqlite3 +fi -mv $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT/%{_sysconfdir}/zabbix/zabbix_java_gateway_logback.xml -rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/lib/logback-console.xml -mv $RPM_BUILD_ROOT%{_sbindir}/zabbix_java $RPM_BUILD_ROOT/%{_datadir}/zabbix-java-gateway -install -m 0755 -p %{SOURCE14} $RPM_BUILD_ROOT%{_sbindir}/zabbix_java_gateway -%endif -%if 0%{?rhel} >= 7 -# install frontend files -find ui -name '*.orig' | xargs rm -f -cp -a ui/* $RPM_BUILD_ROOT%{_datadir}/zabbix +# pass 2 +if [ -n "$build_conf_2" ]; then + %configure $build_conf_common $build_conf_2 + make $make_flags +%if 0%{?build_server} + mv src/zabbix_server/zabbix_server src/zabbix_server/zabbix_server_pgsql +%endif +%if 0%{?build_proxy} + mv src/zabbix_proxy/zabbix_proxy src/zabbix_proxy/zabbix_proxy_pgsql +%endif +fi -# install frontend configuration files -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web -touch $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web/zabbix.conf.php -mv $RPM_BUILD_ROOT%{_datadir}/zabbix/conf/maintenance.inc.php $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web/ -# install web server config files -%if 0%{?rhel} >= 8 -install -Dm 0644 -p %{SOURCE16} $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.d/zabbix.conf -install -Dm 0644 -p %{SOURCE18} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/zabbix.conf +# pass 3 +if [ -n "$build_conf_3" ]; then + %configure $build_conf_common $build_conf_3 + make $make_flags +%if 0%{?build_server} + mv src/zabbix_server/zabbix_server "src/zabbix_server/zabbix_server_$build_db_3" %endif - -%if 0%{?rhel} >= 7 -install -Dm 0644 -p %{SOURCE17} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/zabbix.conf +%if 0%{?build_proxy} + mv src/zabbix_proxy/zabbix_proxy "src/zabbix_proxy/zabbix_proxy_$build_db_3" %endif +fi -%if 0%{?rhel} == 7 -install -Dm 0644 -p %{SOURCE16} $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-php72/php-fpm.d/zabbix.conf -install -Dm 0644 -p %{SOURCE18} $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf -%endif -mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.d -mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.d -%endif +# +# install +# -# install configuration files -mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.d +%install + +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/zabbix +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/zabbix +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/ +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d +mkdir -p $RPM_BUILD_ROOT%{_datadir}/zabbix + +# install %if 0%{?build_agent2} -mkdir $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agent2.d +make DESTDIR=$RPM_BUILD_ROOT GOBIN=$RPM_BUILD_ROOT%{_sbindir} install +%else +make DESTDIR=$RPM_BUILD_ROOT install %endif -install -dm 755 $RPM_BUILD_ROOT%{_docdir}/zabbix-agent-%{version} +%if 0%{?build_agent} +mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.d +install -dm 755 $RPM_BUILD_ROOT%{_docdir}/zabbix-agent-%{version} cat conf/zabbix_agentd.conf | sed \ -e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_agentd.pid' \ -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_agentd.log|g' \ -e '/^# LogFileSize=.*/a \\nLogFileSize=0' \ -e '/^# Include=$/a \\nInclude=%{_sysconfdir}/zabbix/zabbix_agentd.d/*.conf' \ > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf +cat %{SOURCE3} | sed \ + -e 's|COMPONENT|agentd|g' \ + > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent +%if 0%{?rhel} >= 7 +install -Dm 0644 -p %{SOURCE10} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent.service +install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix-agent.conf +%else +install -Dm 0755 -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/zabbix-agent +install -Dm 0644 -p %{SOURCE20} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zabbix-agent +%endif +%else +rm -f $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf +rm -f $RPM_BUILD_ROOT%{_sbindir}/zabbix_agentd +%endif %if 0%{?build_agent2} +mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8 +mkdir $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agent2.d +cp man/zabbix_agent2.man $RPM_BUILD_ROOT%{_mandir}/man8/zabbix_agent2.8 cat src/go/conf/zabbix_agent2.conf | sed \ -e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_agent2.pid' \ -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_agent2.log|g' \ -e '/^# LogFileSize=.*/a \\nLogFileSize=0' \ -e '/^# Include=$/a \\nInclude=%{_sysconfdir}/zabbix/zabbix_agent2.d/*.conf' \ > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agent2.conf +cat %{SOURCE3} | sed \ + -e 's|COMPONENT|agent2|g' \ + > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent2 +%if 0%{?rhel} >= 7 +install -Dm 0644 -p %{SOURCE19} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent2.service +install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix_agent2.conf +%else +install -Dm 0755 -p %{SOURCE21} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/zabbix-agent2 +install -Dm 0644 -p %{SOURCE22} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zabbix-agent2 +%endif +%endif -cp man/zabbix_agent2.man $RPM_BUILD_ROOT%{_mandir}/man8/zabbix_agent2.8 + +%if 0%{?build_server} || 0%{?build_proxy} +mkdir -p $RPM_BUILD_ROOT/usr/lib/zabbix +mv $RPM_BUILD_ROOT%{_datadir}/zabbix/externalscripts $RPM_BUILD_ROOT/usr/lib/zabbix %endif -%if 0%{?rhel} >= 7 -cat conf/zabbix_server.conf | sed \ - -e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_server.pid' \ - -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_server.log|g' \ - -e '/^# LogFileSize=/a \\nLogFileSize=0' \ - -e '/^# AlertScriptsPath=/a \\nAlertScriptsPath=/usr/lib/zabbix/alertscripts' \ - -e '/^# ExternalScripts=/a \\nExternalScripts=/usr/lib/zabbix/externalscripts' \ - -e 's|^DBUser=root|DBUser=zabbix|g' \ - -e '/^# SNMPTrapperFile=.*/a \\nSNMPTrapperFile=/var/log/snmptrap/snmptrap.log' \ - -e '/^# SocketDir=.*/a \\nSocketDir=/var/run/zabbix' \ - > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.conf +%if 0%{?build_proxy} +install -m 0755 -p src/zabbix_proxy/zabbix_proxy_* $RPM_BUILD_ROOT%{_sbindir}/ +rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy +mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.d cat conf/zabbix_proxy.conf | sed \ -e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_proxy.pid' \ -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_proxy.log|g' \ @@ -629,235 +768,147 @@ cat conf/zabbix_proxy.conf | sed \ -e '/^# SNMPTrapperFile=.*/a \\nSNMPTrapperFile=/var/log/snmptrap/snmptrap.log' \ -e '/^# SocketDir=.*/a \\nSocketDir=/var/run/zabbix' \ > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.conf - -cat src/zabbix_java/settings.sh | sed \ - -e 's|^PID_FILE=.*|PID_FILE="/var/run/zabbix/zabbix_java.pid"|g' \ - > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_java_gateway.conf -%endif - -# install logrotate configuration files -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d -%if 0%{?rhel} >= 7 -cat %{SOURCE3} | sed \ - -e 's|COMPONENT|server|g' \ - > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-server cat %{SOURCE3} | sed \ -e 's|COMPONENT|proxy|g' \ > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-proxy +install -Dm 0644 -p %{SOURCE12} $RPM_BUILD_ROOT%{_unitdir}/zabbix-proxy.service +install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf %endif + + +%if 0%{?build_server} +install -m 0755 -p src/zabbix_server/zabbix_server_* $RPM_BUILD_ROOT%{_sbindir}/ +rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_server +mv $RPM_BUILD_ROOT%{_datadir}/zabbix/alertscripts $RPM_BUILD_ROOT/usr/lib/zabbix +mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.d +cat conf/zabbix_server.conf | sed \ + -e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_server.pid' \ + -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_server.log|g' \ + -e '/^# LogFileSize=/a \\nLogFileSize=0' \ + -e '/^# AlertScriptsPath=/a \\nAlertScriptsPath=/usr/lib/zabbix/alertscripts' \ + -e '/^# ExternalScripts=/a \\nExternalScripts=/usr/lib/zabbix/externalscripts' \ + -e 's|^DBUser=root|DBUser=zabbix|g' \ + -e '/^# SNMPTrapperFile=.*/a \\nSNMPTrapperFile=/var/log/snmptrap/snmptrap.log' \ + -e '/^# SocketDir=.*/a \\nSocketDir=/var/run/zabbix' \ + > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.conf cat %{SOURCE3} | sed \ - -e 's|COMPONENT|agentd|g' \ - > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent -%if 0%{?build_agent2} -cat %{SOURCE3} | sed \ - -e 's|COMPONENT|agent2|g' \ - > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent2 + -e 's|COMPONENT|server|g' \ + > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-server +install -Dm 0644 -p %{SOURCE11} $RPM_BUILD_ROOT%{_unitdir}/zabbix-server.service +install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix-server.conf %endif -# install startup scripts + +%if 0%{?build_frontend} +# install frontend files +find ui -name '*.orig' | xargs rm -f +cp -a ui/* $RPM_BUILD_ROOT%{_datadir}/zabbix + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web +touch $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web/zabbix.conf.php +mv $RPM_BUILD_ROOT%{_datadir}/zabbix/conf/maintenance.inc.php $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web/ + %if 0%{?rhel} >= 7 -install -Dm 0644 -p %{SOURCE10} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent.service -install -Dm 0644 -p %{SOURCE11} $RPM_BUILD_ROOT%{_unitdir}/zabbix-server.service -install -Dm 0644 -p %{SOURCE12} $RPM_BUILD_ROOT%{_unitdir}/zabbix-proxy.service -install -Dm 0644 -p %{SOURCE13} $RPM_BUILD_ROOT%{_unitdir}/zabbix-java-gateway.service -%else -install -Dm 0755 -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/zabbix-agent +install -Dm 0644 -p %{SOURCE17} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/zabbix.conf %endif -%if 0%{?build_agent2} -%if 0%{?rhel} >= 7 -install -Dm 0644 -p %{SOURCE19} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent2.service -%else -install -Dm 0755 -p %{SOURCE21} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/zabbix-agent2 -install -Dm 0644 -p %{SOURCE22} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zabbix-agent2 -%endif -%endif +%if 0%{?rhel} >= 8 +install -Dm 0644 -p %{SOURCE16} $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.d/zabbix.conf -%if 0%{?rhel} <= 6 -install -Dm 0644 -p %{SOURCE20} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zabbix-agent +sed -i '/rh-php7/d' $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/zabbix.conf +install -Dm 0644 -p %{SOURCE18} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/zabbix.conf +sed -i '/rh-php7/d' $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/zabbix.conf %endif -# install systemd-tmpfiles conf -%if 0%{?rhel} >= 7 -install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix-agent.conf -%if 0%{?build_agent2} -install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix_agent2.conf +%if 0%{?rhel} == 7 +install -Dm 0644 -p %{SOURCE23} $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-php72/php-fpm.d/zabbix.conf +sed -i 's:/run/php-fpm/zabbix.sock:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock:' \ + $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-php72/php-fpm.d/zabbix.conf +sed -i 's:/var/lib/php/session:/var/opt/rh/rh-php72/lib/php/session/:' \ + $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-php72/php-fpm.d/zabbix.conf + +install -Dm 0644 -p %{SOURCE23} $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-php73/php-fpm.d/zabbix.conf +sed -i 's:/run/php-fpm/zabbix.sock:/var/opt/rh/rh-php73/run/php-fpm/zabbix.sock:' \ + $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-php73/php-fpm.d/zabbix.conf +sed -i 's:/var/lib/php/session:/var/opt/rh/rh-php73/lib/php/session/:' \ + $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-php73/php-fpm.d/zabbix.conf + +sed -i '\!:/run/php-fpm/zabbix.sock!d;/rh-php72/s/#//' $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/zabbix.conf + +install -Dm 0644 -p %{SOURCE18} $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf +sed -i '\!:/run/php-fpm/zabbix.sock!d;/rh-php72/s/#//' $RPM_BUILD_ROOT%{_sysconfdir}/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf %endif -install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix-server.conf -install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf +%endif + + +%if 0%{?build_java_gateway} +rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/settings.sh +rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/startup.sh +rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/shutdown.sh +mv $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_java_gateway_logback.xml +rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/lib/logback-console.xml +mv $RPM_BUILD_ROOT%{_sbindir}/zabbix_java $RPM_BUILD_ROOT/%{_datadir}/zabbix-java-gateway +install -m 0755 -p %{SOURCE14} $RPM_BUILD_ROOT%{_sbindir}/zabbix_java_gateway +cat src/zabbix_java/settings.sh | sed \ + -e 's|^PID_FILE=.*|PID_FILE="/var/run/zabbix/zabbix_java.pid"|g' \ + > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_java_gateway.conf +install -Dm 0644 -p %{SOURCE13} $RPM_BUILD_ROOT%{_unitdir}/zabbix-java-gateway.service install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix-java-gateway.conf %endif %clean rm -rf $RPM_BUILD_ROOT -%pre agent -getent group zabbix > /dev/null || groupadd -r zabbix -getent passwd zabbix > /dev/null || \ - useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ - -c "Zabbix Monitoring System" zabbix -: -%post agent +# +# files & scriptlets +# + +%if 0%{?build_agent} +%files agent +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING NEWS README conf/zabbix_agentd/userparameter_mysql.conf +%config(noreplace) %{_sysconfdir}/zabbix/zabbix_agentd.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-agent +%dir %{_sysconfdir}/zabbix/zabbix_agentd.d +%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix +%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix +%{_sbindir}/zabbix_agentd +%{_mandir}/man8/zabbix_agentd.8* %if 0%{?rhel} >= 7 -%systemd_post zabbix-agent.service +%{_unitdir}/zabbix-agent.service +%{_prefix}/lib/tmpfiles.d/zabbix-agent.conf %else -/sbin/chkconfig --add zabbix-agent || : -%endif - -%posttrans agent -# preserve old userparameter_mysql.conf file during upgrade -if [ -f %{_sysconfdir}/zabbix/zabbix_agentd.d/userparameter_mysql.conf.rpmsave ] && [ ! -f %{_sysconfdir}/zabbix/zabbix_agentd.d/userparameter_mysql.conf ]; then - cp -vn %{_sysconfdir}/zabbix/zabbix_agentd.d/userparameter_mysql.conf.rpmsave %{_sysconfdir}/zabbix/zabbix_agentd.d/userparameter_mysql.conf -fi -: - -%if 0%{?build_agent2} -%pre agent2 -getent group zabbix > /dev/null || groupadd -r zabbix -getent passwd zabbix > /dev/null || \ - useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ - -c "Zabbix Monitoring System" zabbix -: - -%post agent2 -%systemd_post zabbix-agent2.service -# make sure that agent2 log file is create with proper attributes (ZBX-18243) -if [ $1 == 1 ] && [ ! -f %{_localstatedir}/log/zabbix/zabbix_agent2.log ]; then - touch %{_localstatedir}/log/zabbix/zabbix_agent2.log - chown zabbix:zabbix %{_localstatedir}/log/zabbix/zabbix_agent2.log -fi -: +%{_sysconfdir}/init.d/zabbix-agent +%config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent %endif -%if 0%{?rhel} >= 7 -%pre java-gateway -getent group zabbix > /dev/null || groupadd -r zabbix -getent passwd zabbix > /dev/null || \ - useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ - -c "Zabbix Monitoring System" zabbix -: - -%pre proxy-mysql -getent group zabbix > /dev/null || groupadd -r zabbix -getent passwd zabbix > /dev/null || \ - useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ - -c "Zabbix Monitoring System" zabbix -: - -%pre proxy-pgsql -getent group zabbix > /dev/null || groupadd -r zabbix -getent passwd zabbix > /dev/null || \ - useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ - -c "Zabbix Monitoring System" zabbix -: - -%pre proxy-sqlite3 -getent group zabbix > /dev/null || groupadd -r zabbix -getent passwd zabbix > /dev/null || \ - useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ - -c "Zabbix Monitoring System" zabbix -: +%files get +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING NEWS README +%{_bindir}/zabbix_get +%{_mandir}/man1/zabbix_get.1* -%pre server-mysql -getent group zabbix > /dev/null || groupadd -r zabbix -getent passwd zabbix > /dev/null || \ - useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ - -c "Zabbix Monitoring System" zabbix -: +%files sender +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING NEWS README +%{_bindir}/zabbix_sender +%{_mandir}/man1/zabbix_sender.1* -%pre server-pgsql +%pre agent getent group zabbix > /dev/null || groupadd -r zabbix getent passwd zabbix > /dev/null || \ useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ -c "Zabbix Monitoring System" zabbix : -%post proxy-mysql -%systemd_post zabbix-proxy.service -/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_proxy \ - zabbix-proxy %{_sbindir}/zabbix_proxy_mysql 10 -: - -%post proxy-pgsql -%systemd_post zabbix-proxy.service -/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_proxy \ - zabbix-proxy %{_sbindir}/zabbix_proxy_pgsql 10 -: - -%post proxy-sqlite3 -%systemd_post zabbix-proxy.service -/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_proxy \ - zabbix-proxy %{_sbindir}/zabbix_proxy_sqlite3 10 -: - -%post server-mysql -%systemd_post zabbix-server.service -/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_server \ - zabbix-server %{_sbindir}/zabbix_server_mysql 10 -: - -%post server-pgsql -%systemd_post zabbix-server.service -/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_server \ - zabbix-server %{_sbindir}/zabbix_server_pgsql 10 -: - -%post web -# The fonts directory was moved into assets subdirectory at one point. -# -# This broke invocation of update-alternatives command below, because the target link for zabbix-web-font changed -# from zabbix/fonts/graphfont.ttf to zabbix/assets/fonts/graphfont.ttf -# -# We handle this movement by deleting /var/lib/alternatives/zabbix-web-font file if it contains the old target link. -# We also remove symlink at zabbix/fonts/graphfont.ttf to have the old fonts directory be deleted during update. -if [ -f /var/lib/alternatives/zabbix-web-font ] && \ - [ -z "$(grep %{_datadir}/zabbix/assets/fonts/graphfont.ttf /var/lib/alternatives/zabbix-web-font)" ] -then - rm /var/lib/alternatives/zabbix-web-font - if [ -h %{_datadir}/zabbix/fonts/graphfont.ttf ]; then - rm %{_datadir}/zabbix/fonts/graphfont.ttf - fi -fi -/usr/sbin/update-alternatives --install %{_datadir}/zabbix/assets/fonts/graphfont.ttf \ - zabbix-web-font %{_datadir}/fonts/dejavu/DejaVuSans.ttf 10 -: - -%post web-japanese -/usr/sbin/update-alternatives --install %{_datadir}/zabbix/assets/fonts/graphfont.ttf zabbix-web-font \ -%if 0%{?rhel} >= 8 - %{_datadir}/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc 20 +%post agent +%if 0%{?rhel} >= 7 +%systemd_post zabbix-agent.service %else - %{_datadir}/fonts/vlgothic/VL-PGothic-Regular.ttf 20 -%endif -: - -%if 0%{?rhel} >= 8 -# The user apache must be available for these to work. -# It is provided by httpd or php-fpm packages. -%post apache-conf -if [ -d /etc/zabbix/web ]; then - chown apache:apache /etc/zabbix/web/ -fi -: +/sbin/chkconfig --add zabbix-agent || : %endif -%if 0%{?rhel} >= 8 -%post nginx-conf -if [ -d /etc/zabbix/web ]; then - chown apache:apache /etc/zabbix/web/ -fi -: -%endif - -%if 0%{?rhel} == 7 -%post web-deps-scl -if [ -d /etc/zabbix/web ]; then - chown apache:apache /etc/zabbix/web/ -fi -: -%endif -%endif %preun agent if [ "$1" = 0 ]; then @@ -870,82 +921,6 @@ if [ "$1" = 0 ]; then fi : -%if 0%{?build_agent2} -%preun agent2 -%systemd_preun zabbix-agent2.service -: -%endif - -%if 0%{?rhel} >= 7 -%post java-gateway -%systemd_post zabbix-java-gateway.service -: - -%preun proxy-mysql -if [ "$1" = 0 ]; then -%systemd_preun zabbix-proxy.service -/usr/sbin/update-alternatives --remove zabbix-proxy \ -%{_sbindir}/zabbix_proxy_mysql -fi -: - -%preun proxy-pgsql -if [ "$1" = 0 ]; then -%systemd_preun zabbix-proxy.service -/usr/sbin/update-alternatives --remove zabbix-proxy \ - %{_sbindir}/zabbix_proxy_pgsql -fi -: - -%preun proxy-sqlite3 -if [ "$1" = 0 ]; then -%systemd_preun zabbix-proxy.service -/usr/sbin/update-alternatives --remove zabbix-proxy \ - %{_sbindir}/zabbix_proxy_sqlite3 -fi -: - -%preun java-gateway -if [ $1 -eq 0 ]; then -%systemd_preun zabbix-java-gateway.service -fi -: - -%preun server-mysql -if [ "$1" = 0 ]; then -%systemd_preun zabbix-server.service -/usr/sbin/update-alternatives --remove zabbix-server \ - %{_sbindir}/zabbix_server_mysql -fi -: - -%preun server-pgsql -if [ "$1" = 0 ]; then -%systemd_preun zabbix-server.service -/usr/sbin/update-alternatives --remove zabbix-server \ - %{_sbindir}/zabbix_server_pgsql -fi -: - -%preun web -if [ "$1" = 0 ]; then -/usr/sbin/update-alternatives --remove zabbix-web-font \ - %{_datadir}/fonts/dejavu/DejaVuSans.ttf -fi -: - -%preun web-japanese -if [ "$1" = 0 ]; then -/usr/sbin/update-alternatives --remove zabbix-web-font \ -%if 0%{?rhel} >= 8 - %{_datadir}/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc -%else - %{_datadir}/fonts/vlgothic/VL-PGothic-Regular.ttf -%endif -fi -: -%endif - %postun agent %if 0%{?rhel} >= 7 %systemd_postun_with_restart zabbix-agent.service @@ -955,54 +930,14 @@ if [ $1 -ge 1 ]; then fi %endif -%if 0%{?build_agent2} -%postun agent2 -%systemd_postun_with_restart zabbix-agent2.service -%endif - -%if 0%{?rhel} >= 7 -%postun proxy-mysql -%systemd_postun_with_restart zabbix-proxy.service -: - -%postun proxy-pgsql -%systemd_postun_with_restart zabbix-proxy.service -: - -%postun proxy-sqlite3 -%systemd_postun_with_restart zabbix-proxy.service -: - -%postun java-gateway -%systemd_postun_with_restart zabbix-java-gateway.service -: - -%postun server-mysql -%systemd_postun_with_restart zabbix-server.service -: - -%postun server-pgsql -%systemd_postun_with_restart zabbix-server.service +%posttrans agent +# preserve old userparameter_mysql.conf file during upgrade +if [ -f %{_sysconfdir}/zabbix/zabbix_agentd.d/userparameter_mysql.conf.rpmsave ] && [ ! -f %{_sysconfdir}/zabbix/zabbix_agentd.d/userparameter_mysql.conf ]; then + cp -vn %{_sysconfdir}/zabbix/zabbix_agentd.d/userparameter_mysql.conf.rpmsave %{_sysconfdir}/zabbix/zabbix_agentd.d/userparameter_mysql.conf +fi : %endif -%files agent -%defattr(-,root,root,-) -%doc AUTHORS ChangeLog COPYING NEWS README conf/zabbix_agentd/userparameter_mysql.conf -%config(noreplace) %{_sysconfdir}/zabbix/zabbix_agentd.conf -%config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-agent -%dir %{_sysconfdir}/zabbix/zabbix_agentd.d -%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix -%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix -%{_sbindir}/zabbix_agentd -%{_mandir}/man8/zabbix_agentd.8* -%if 0%{?rhel} >= 7 -%{_unitdir}/zabbix-agent.service -%{_prefix}/lib/tmpfiles.d/zabbix-agent.conf -%else -%{_sysconfdir}/init.d/zabbix-agent -%config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent -%endif %if 0%{?build_agent2} %files agent2 @@ -1022,38 +957,43 @@ fi %{_sysconfdir}/init.d/zabbix-agent2 %config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent2 %endif -%endif -%files get -%defattr(-,root,root,-) -%doc AUTHORS ChangeLog COPYING NEWS README -%{_bindir}/zabbix_get -%{_mandir}/man1/zabbix_get.1* +%pre agent2 +getent group zabbix > /dev/null || groupadd -r zabbix +getent passwd zabbix > /dev/null || \ + useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ + -c "Zabbix Monitoring System" zabbix +: -%files sender -%defattr(-,root,root,-) -%doc AUTHORS ChangeLog COPYING NEWS README -%{_bindir}/zabbix_sender -%{_mandir}/man1/zabbix_sender.1* +%post agent2 +%systemd_post zabbix-agent2.service +# make sure that agent2 log file is create with proper attributes (ZBX-18243) +if [ $1 == 1 ] && [ ! -f %{_localstatedir}/log/zabbix/zabbix_agent2.log ]; then + touch %{_localstatedir}/log/zabbix/zabbix_agent2.log + chown zabbix:zabbix %{_localstatedir}/log/zabbix/zabbix_agent2.log +fi +: -%if 0%{?rhel} >= 7 +%preun agent2 +%systemd_preun zabbix-agent2.service +: + +%postun agent2 +%systemd_postun_with_restart zabbix-agent2.service +: +%endif + + +%if 0%{?build_server} || 0%{?build_proxy} %files js %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README %{_bindir}/zabbix_js +%endif -%files java-gateway -%defattr(-,root,root,-) -%doc AUTHORS ChangeLog COPYING NEWS README -%config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway.conf -%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix -%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix -%{_datadir}/zabbix-java-gateway -%{_sbindir}/zabbix_java_gateway -%{_unitdir}/zabbix-java-gateway.service -%{_prefix}/lib/tmpfiles.d/zabbix-java-gateway.conf -%config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway_logback.xml +%if 0%{?build_proxy} +%if 0%{?build_with_mysql} %files proxy-mysql %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README @@ -1068,11 +1008,39 @@ fi %{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf %{_sbindir}/zabbix_proxy_mysql +%pre proxy-mysql +getent group zabbix > /dev/null || groupadd -r zabbix +getent passwd zabbix > /dev/null || \ + useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ + -c "Zabbix Monitoring System" zabbix +: + +%post proxy-mysql +%systemd_post zabbix-proxy.service +/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_proxy \ + zabbix-proxy %{_sbindir}/zabbix_proxy_mysql 10 +: + +%preun proxy-mysql +if [ "$1" = 0 ]; then +%systemd_preun zabbix-proxy.service +/usr/sbin/update-alternatives --remove zabbix-proxy \ +%{_sbindir}/zabbix_proxy_mysql +fi +: + +%postun proxy-mysql +%systemd_postun_with_restart zabbix-proxy.service +: +%endif + + +%if 0%{?build_with_pgsql} %files proxy-pgsql %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README %doc database/postgresql/schema.sql.gz -%attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf +%attr(0600,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf %dir /usr/lib/zabbix/externalscripts %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-proxy %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix @@ -1082,11 +1050,39 @@ fi %{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf %{_sbindir}/zabbix_proxy_pgsql +%pre proxy-pgsql +getent group zabbix > /dev/null || groupadd -r zabbix +getent passwd zabbix > /dev/null || \ + useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ + -c "Zabbix Monitoring System" zabbix +: + +%post proxy-pgsql +%systemd_post zabbix-proxy.service +/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_proxy \ + zabbix-proxy %{_sbindir}/zabbix_proxy_pgsql 10 +: + +%preun proxy-pgsql +if [ "$1" = 0 ]; then +%systemd_preun zabbix-proxy.service +/usr/sbin/update-alternatives --remove zabbix-proxy \ + %{_sbindir}/zabbix_proxy_pgsql +fi +: + +%postun proxy-pgsql +%systemd_postun_with_restart zabbix-proxy.service +: +%endif + + +%if 0%{?build_with_sqlite} %files proxy-sqlite3 %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README %doc database/sqlite3/schema.sql.gz -%attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf +%attr(0600,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf %dir /usr/lib/zabbix/externalscripts %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-proxy %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix @@ -1096,12 +1092,42 @@ fi %{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf %{_sbindir}/zabbix_proxy_sqlite3 +%pre proxy-sqlite3 +getent group zabbix > /dev/null || groupadd -r zabbix +getent passwd zabbix > /dev/null || \ + useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ + -c "Zabbix Monitoring System" zabbix +: + +%post proxy-sqlite3 +%systemd_post zabbix-proxy.service +/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_proxy \ + zabbix-proxy %{_sbindir}/zabbix_proxy_sqlite3 10 +: + +%preun proxy-sqlite3 +if [ "$1" = 0 ]; then +%systemd_preun zabbix-proxy.service +/usr/sbin/update-alternatives --remove zabbix-proxy \ + %{_sbindir}/zabbix_proxy_sqlite3 +fi +: + +%postun proxy-sqlite3 +%systemd_postun_with_restart zabbix-proxy.service +: +%endif +%endif + + +%if 0%{?build_server} +%if 0%{?build_with_mysql} %files server-mysql %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README %doc database/mysql/create.sql.gz %doc database/mysql/double.sql -%attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf +%attr(0600,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf %dir /usr/lib/zabbix/alertscripts %dir /usr/lib/zabbix/externalscripts %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-server @@ -1112,13 +1138,41 @@ fi %{_prefix}/lib/tmpfiles.d/zabbix-server.conf %{_sbindir}/zabbix_server_mysql +%pre server-mysql +getent group zabbix > /dev/null || groupadd -r zabbix +getent passwd zabbix > /dev/null || \ + useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ + -c "Zabbix Monitoring System" zabbix +: + +%post server-mysql +%systemd_post zabbix-server.service +/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_server \ + zabbix-server %{_sbindir}/zabbix_server_mysql 10 +: + +%preun server-mysql +if [ "$1" = 0 ]; then +%systemd_preun zabbix-server.service +/usr/sbin/update-alternatives --remove zabbix-server \ + %{_sbindir}/zabbix_server_mysql +fi +: + +%postun server-mysql +%systemd_postun_with_restart zabbix-server.service +: +%endif + + +%if 0%{?build_with_pgsql} %files server-pgsql %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README %doc database/postgresql/create.sql.gz %doc database/postgresql/double.sql %doc database/postgresql/timescaledb.sql.gz -%attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf +%attr(0600,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf %dir /usr/lib/zabbix/alertscripts %dir /usr/lib/zabbix/externalscripts %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-server @@ -1129,6 +1183,35 @@ fi %{_prefix}/lib/tmpfiles.d/zabbix-server.conf %{_sbindir}/zabbix_server_pgsql +%pre server-pgsql +getent group zabbix > /dev/null || groupadd -r zabbix +getent passwd zabbix > /dev/null || \ + useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ + -c "Zabbix Monitoring System" zabbix +: + +%post server-pgsql +%systemd_post zabbix-server.service +/usr/sbin/update-alternatives --install %{_sbindir}/zabbix_server \ + zabbix-server %{_sbindir}/zabbix_server_pgsql 10 +: + +%preun server-pgsql +if [ "$1" = 0 ]; then +%systemd_preun zabbix-server.service +/usr/sbin/update-alternatives --remove zabbix-server \ + %{_sbindir}/zabbix_server_pgsql +fi +: + +%postun server-pgsql +%systemd_postun_with_restart zabbix-server.service +: +%endif +%endif + + +%if 0%{?build_frontend} %files web %defattr(-,root,root,-) %dir %{_sysconfdir}/zabbix/web @@ -1140,15 +1223,60 @@ fi %config(noreplace) %{_sysconfdir}/zabbix/web/maintenance.inc.php %{_datadir}/zabbix +%files web-japanese +%defattr(-,root,root,-) + +%post web +# The fonts directory was moved into assets subdirectory at one point. +# +# This broke invocation of update-alternatives command below, because the target link for zabbix-web-font changed +# from zabbix/fonts/graphfont.ttf to zabbix/assets/fonts/graphfont.ttf +# +# We handle this movement by deleting /var/lib/alternatives/zabbix-web-font file if it contains the old target link. +# We also remove symlink at zabbix/fonts/graphfont.ttf to have the old fonts directory be deleted during update. +if [ -f /var/lib/alternatives/zabbix-web-font ] && \ + [ -z "$(grep %{_datadir}/zabbix/assets/fonts/graphfont.ttf /var/lib/alternatives/zabbix-web-font)" ] +then + rm /var/lib/alternatives/zabbix-web-font + if [ -h %{_datadir}/zabbix/fonts/graphfont.ttf ]; then + rm %{_datadir}/zabbix/fonts/graphfont.ttf + fi +fi +/usr/sbin/update-alternatives --install %{_datadir}/zabbix/assets/fonts/graphfont.ttf \ + zabbix-web-font %{_datadir}/fonts/dejavu/DejaVuSans.ttf 10 +: + +%post web-japanese +/usr/sbin/update-alternatives --install %{_datadir}/zabbix/assets/fonts/graphfont.ttf zabbix-web-font \ %if 0%{?rhel} >= 8 -%files web-deps -%config(noreplace) %{_sysconfdir}/php-fpm.d/zabbix.conf + %{_datadir}/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc 20 +%else + %{_datadir}/fonts/vlgothic/VL-PGothic-Regular.ttf 20 %endif +: -%files web-japanese -%defattr(-,root,root,-) +%preun web +if [ "$1" = 0 ]; then +/usr/sbin/update-alternatives --remove zabbix-web-font \ + %{_datadir}/fonts/dejavu/DejaVuSans.ttf +fi +: +%preun web-japanese +if [ "$1" = 0 ]; then +/usr/sbin/update-alternatives --remove zabbix-web-font \ %if 0%{?rhel} >= 8 + %{_datadir}/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc +%else + %{_datadir}/fonts/vlgothic/VL-PGothic-Regular.ttf +%endif +fi +: + +%if 0%{?rhel} > 7 +%files web-deps +%config(noreplace) %{_sysconfdir}/php-fpm.d/zabbix.conf + %files web-mysql %defattr(-,root,root,-) @@ -1162,6 +1290,20 @@ fi %files nginx-conf %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/nginx/conf.d/zabbix.conf + +# The user apache must be available for these to work. +# It is provided by httpd or php-fpm packages. +%post apache-conf +if [ -d /etc/zabbix/web ]; then + chown apache:apache /etc/zabbix/web/ +fi +: + +%post nginx-conf +if [ -d /etc/zabbix/web ]; then + chown apache:apache /etc/zabbix/web/ +fi +: %endif %if 0%{?rhel} == 7 @@ -1169,12 +1311,22 @@ fi %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/opt/rh/rh-php72/php-fpm.d/zabbix.conf +%files web-deps-scl-php73 +%defattr(-,root,root,-) +%config(noreplace) %{_sysconfdir}/opt/rh/rh-php73/php-fpm.d/zabbix.conf + %files web-mysql-scl %defattr(-,root,root,-) +%files web-mysql-scl-php73 +%defattr(-,root,root,-) + %files web-pgsql-scl %defattr(-,root,root,-) +%files web-pgsql-scl-php73 +%defattr(-,root,root,-) + %files apache-conf-scl %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/httpd/conf.d/zabbix.conf @@ -1182,12 +1334,73 @@ fi %files nginx-conf-scl %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf + +%post web-deps-scl +if [ -d /etc/zabbix/web ]; then + chown apache:apache /etc/zabbix/web/ +fi +: +%endif %endif + + +%if 0%{?build_java_gateway} +%files java-gateway +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING NEWS README +%config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway.conf +%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix +%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix +%{_datadir}/zabbix-java-gateway +%{_sbindir}/zabbix_java_gateway +%{_unitdir}/zabbix-java-gateway.service +%{_prefix}/lib/tmpfiles.d/zabbix-java-gateway.conf +%config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway_logback.xml + +%pre java-gateway +getent group zabbix > /dev/null || groupadd -r zabbix +getent passwd zabbix > /dev/null || \ + useradd -r -g zabbix -d %{_localstatedir}/lib/zabbix -s /sbin/nologin \ + -c "Zabbix Monitoring System" zabbix +: + +%post java-gateway +%systemd_post zabbix-java-gateway.service +: + +%preun java-gateway +if [ $1 -eq 0 ]; then +%systemd_preun zabbix-java-gateway.service +fi +: + +%postun java-gateway +%systemd_postun_with_restart zabbix-java-gateway.service +: %endif + +# +# changelog +# + %changelog -* Sat Jan 23 2021 Fabian Arrotin - 5.0.7-2 -- disabling agent2 build due to missing BuildRequires (not fetching GO from internet) +* Wed Jan 27 2021 Zabbix Packager - 5.0.8-4 +- fourth release of 5.0.8 for rhel/centos 7 (frontend packages only) +- added missing zabbix-web-japanese package + +* Wed Jan 27 2021 Zabbix Packager - 5.0.8-3 +- third release of 5.0.8 for rhel/centos 7 (frontend packages only) +- added missing semicolon in /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf file + +* Wed Jan 27 2021 Zabbix Packager - 5.0.8-2 +- second release of 5.0.8 for rhel/centos 7 (frontend packages only) +- zabbix-web-deps-scl-php73 now provides zabbix-web-deps-scl explicitly so that the old package can be uninstalled + +* Mon Jan 25 2021 Zabbix Packager - 5.0.8-1 +- update to 5.0.8 +- reworked spec file to allow selecting which packages are being built via macros (ZBX-18826) +- added rhel-7 frontend packages with rh-php73 (ZBX-18837) * Mon Dec 21 2020 Zabbix Packager - 5.0.7-1 - update to 5.0.7