2 # - initscript for zabbix-server, zabbix-proxy and zabbix-java
4 # /lib/systemd/system/zabbix_java.service
6 # /var/lib/zabbix/zabbix.db
9 %bcond_without pgsql # enable PostgreSQL support
10 %bcond_without sqlite3 # enable sqlite3 support
11 %bcond_without mysql # enable MySQL support
12 %bcond_without java # disable java support
14 %define databases %{?with_sqlite3:sqlite3} %{?with_pgsql:postgresql} %{?with_mysql:mysql}
15 %define any_database %{with pgsql}%{with mysql}%{with sqlite3}
17 %define php_min_version 7.2.5
18 Summary: Zabbix - network monitoring software
19 Summary(pl.UTF-8): Zabbix - oprogramowanie do monitorowania sieci
24 Group: Networking/Utilities
25 Source0: https://cdn.zabbix.com/zabbix/sources/stable/5.2/%{name}-%{version}.tar.gz
26 # Source0-md5: 20445897eb25c65a1ed1b62db7c5f04b
27 Source1: %{name}-apache.conf
28 Source2: %{name}_server.service
29 Source3: %{name}_agentd.service
30 Source4: %{name}_proxy.service
31 Source5: %{name}_java.service
32 Source6: %{name}.tmpfiles
33 Source7: %{name}_agentd.init
35 Patch1: sqlite3_dbname.patch
36 Patch2: always_compile_ipc.patch
37 Patch3: go-destdir.patch
38 URL: http://zabbix.sourceforge.net/
39 BuildRequires: OpenIPMI-devel
40 BuildRequires: autoconf
41 BuildRequires: automake >= 1:1.15
42 BuildRequires: curl-devel
43 BuildRequires: iksemel-devel
44 %{?with_java:BuildRequires: jdk}
45 BuildRequires: libevent-devel
46 BuildRequires: libssh2-devel
47 BuildRequires: libtool
48 BuildRequires: libxml2-devel
49 %{?with_mysql:BuildRequires: mysql-devel}
50 BuildRequires: net-snmp-devel
51 BuildRequires: openldap-devel >= 2.4.6
52 BuildRequires: openssl-devel >= 0.9.7d
53 BuildRequires: pcre-devel
54 %{?with_pgsql:BuildRequires: postgresql-devel}
55 BuildRequires: rpmbuild(macros) >= 1.671
56 %{?with_sqlite3:BuildRequires: sqlite3-devel}
57 BuildRequires: unixODBC-devel
58 BuildRequires: zlib-devel
59 Requires: %{name}-agentd = %{version}-%{release}
60 Requires: %{name}-frontend-php = %{version}-%{release}
61 Requires: %{name}-server = %{version}-%{release}
62 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
64 %define _sysconfdir /etc/%{name}
65 %define _appdir %{_datadir}/%{name}
66 %define _webapps /etc/webapps
67 %define _webapp %{name}
70 Zabbix is software that monitors numerous parameters of a network and
71 the servers on that network. It is a useful tool for monitoring the
72 health and integrity of servers. Zabbix uses a flexible notification
73 mechanism that allows users to configure email based alerts for
74 virtually any event. All monitored parameters are stored in a
75 database. Zabbix offers excellent reporting and data visualisation
76 features based on the stored data. Zabbix supports both polling and
77 trapping. All Zabbix reports and statistics, as well as configuration
78 parameters, are accessed through a web-based front end.
80 %description -l pl.UTF-8
81 Zabbix to oprogramowanie do monitorowania licznych parametrów sieci i
82 serwerów sieciowych. Jest przydatny przy monitorowaniu działania
83 serwerów. Jorzysta z elastycznego mechanizmu powiadamiania, który
84 pozwala użytkownikom konfigurować powiadamianie pocztą elektroniczną
85 dla praktycznie wszelkich zdarzeń. Monitorowane parametry są
86 przechowywane w bazie danych. W oparciu o przechowywane dane Zabbix
87 oferuje świetne raportowanie i funkcje wizualizacji. Wspiera zarówno
88 odpytywanie jak i pułapkowanie. Dostęp do wszystkich raportów i
89 statystyk Zabbiksa jest możliwy poprzez interfejs oparty o WWW.
92 Summary: Common files for Zabbix monitoring software
93 Summary(pl.UTF-8): Wspólne pliki dla oprogramowania monitorującego Zabbix
94 Group: Networking/Utilities
95 Requires(postun): /usr/sbin/groupdel
96 Requires(postun): /usr/sbin/userdel
97 Requires(pre): /bin/id
98 Requires(pre): /usr/bin/getgid
99 Requires(pre): /usr/sbin/groupadd
100 Requires(pre): /usr/sbin/useradd
101 Provides: group(zabbix)
102 Provides: user(zabbix)
105 Common files for Zabbix monitoring software.
107 %description common -l pl.UTF-8
108 Wspólne pliki dla oprogramowania monitorującego Zabbix.
111 Summary: Zabbix Agent
112 Summary(pl.UTF-8): Agenta Zabbiksa
113 Group: Networking/Utilities
114 Requires: %{name}-common = %{version}-%{release}
115 Requires: systemd-units >= 38
116 Obsoletes: zabbix-agent-inetd
117 Obsoletes: zabbix-agent-standalone
118 Requires(post,preun): /sbin/chkconfig
122 Zabbix agent collects data from the local system for a Zabbix server.
124 %description agentd -l pl.UTF-8
125 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
127 %package frontend-php
128 Summary: PHP frontend for Zabbix
129 Summary(pl.UTF-8): Interfejs PHP dla Zabbiksa
130 Group: Applications/WWW
131 Requires: php(bcmath)
132 Requires: php(core) >= %{php_min_version}
135 Requires: php(gettext)
137 Requires: php(mbstring)
139 Requires: php(session)
140 Requires: php(sockets)
142 Requires: php(xmlreader)
143 Requires: php(xmlwriter)
145 Requires: webserver(alias)
146 Requires: webserver(indexfile)
147 Requires: webserver(php)
150 Suggests: php(sqlite3)
152 Suggests: php(sysvsem)
155 %description frontend-php
156 This package provides web based (PHP) frontend for Zabbix.
158 %description frontend-php -l pl.UTF-8
159 Ten pakiet dostarcza napisany w PHP frontend dla Zabbiksa.
162 Summary: Program retrieving data from Zabbix agent
163 Summary(pl.UTF-8): Program odpytujÄcy agenta Zabbiksa
164 Group: Networking/Utilities
167 This package provides a program retrieving data from Zabbix agent.
169 %description get -l pl.UTF-8
170 Ten pakiet zawiera program odpytujÄcy agenta Zabbiksa.
173 Summary: Zabbix proxy
174 Summary(pl.UTF-8): Proxy do Zabbiksa
175 Group: Networking/Utilities
176 Requires: %{name}-common = %{version}-%{release}
177 Requires: systemd-units >= 38
178 Requires: zabbix-proxy(db) = %{version}-%{release}
181 This package provides the Zabbix proxy.
183 %description proxy -l pl.UTF-8
184 Ten pakiet zawiera proxy Zabbix.
187 Summary: MySQL support for Zabbix proxy
188 Summary(pl.UTF-8): Obsługa MySQL dla proxy do Zabbiksa
189 Group: Networking/Utilities
190 Provides: %{name}-proxy(db) = %{version}-%{release}
191 Obsoletes: zabbix-proxy-postgresql
192 Obsoletes: zabbix-proxy-sqlite3
194 %description proxy-mysql
195 This package provides the Zabbix proxy binary with MySQL support.
197 %description proxy-mysql -l pl.UTF-8
198 Ten pakiet zawiera proxy Zabbix z obsługą MySQL.
200 %package proxy-postgresql
201 Summary: PostgreSQL support for Zabbix proxy
202 Summary(pl.UTF-8): Obsługa PostgreSQL dla proxy do Zabbiksa
203 Group: Networking/Utilities
204 Provides: %{name}-proxy(db) = %{version}-%{release}
205 Obsoletes: zabbix-proxy-mysql
206 Obsoletes: zabbix-proxy-sqlite3
208 %description proxy-postgresql
209 This package provides the Zabbix proxy binary with PostgreSQL support.
211 %description proxy-postgresql -l pl.UTF-8
212 Ten pakiet zawiera proxy Zabbix z obsługą PostgreSQL.
214 %package proxy-sqlite3
215 Summary: SQLite 3 support for Zabbix proxy
216 Summary(pl.UTF-8): Obsługa SQLite 3 dla proxy do Zabbiksa
217 Group: Networking/Utilities
218 Provides: %{name}-proxy(db) = %{version}-%{release}
219 Obsoletes: zabbix-proxy-mysql
220 Obsoletes: zabbix-proxy-postgresql
222 %description proxy-sqlite3
223 This package provides the Zabbix proxy binary with SQLite 3 support.
225 %description proxy-sqlite3 -l pl.UTF-8
226 Ten pakiet zawiera proxy Zabbix z obsługą SQLite 3.
229 Summary: Zabbix sender
230 Summary(pl.UTF-8): Program zawiadamiający Zabbiksa
231 Group: Networking/Utilities
234 This package provides the Zabbix sender.
236 %description sender -l pl.UTF-8
237 Ten pakiet zawiera program zawiadamiający Zabbiksa.
240 Summary: Zabbix server
241 Summary(pl.UTF-8): Serwer Zabbiksa
242 Group: Networking/Utilities
243 Requires: %{name}-common = %{version}-%{release}
244 Requires: %{name}-server(db) = %{version}-%{release}
245 Requires: systemd-units >= 38
246 Obsoletes: zabbix-suckerd
247 Obsoletes: zabbix-trapper-inetd
248 Obsoletes: zabbix-trapper-standalone
251 This package provides the Zabbix server.
253 %description server -l pl.UTF-8
254 Ten pakiet zawiera serwer Zabbiksa.
256 %package server-mysql
257 Summary: MySQL support for Zabbix server
258 Summary(pl.UTF-8): Obsługa MySQL sla serwera Zabbiksa
259 Group: Networking/Utilities
260 Provides: %{name}-server(db) = %{version}-%{release}
261 Obsoletes: zabbix-server-postgresql
262 Obsoletes: zabbix-server-sqlite3
264 %description server-mysql
265 This package provides the Zabbix server binary for use with MySQL
268 %description server-mysql -l pl.UTF-8
269 Ten pakiet zawiera serwer Zabbiksa z obsługą bazy danych MySQL.
271 %package server-postgresql
272 Summary: PostgreSQL support for Zabbix server
273 Summary(pl.UTF-8): Obsługa PostgreSQL sla serwera Zabbiksa
274 Group: Networking/Utilities
275 Provides: %{name}-server(db) = %{version}-%{release}
276 Obsoletes: zabbix-server-mysql
277 Obsoletes: zabbix-server-sqlite3
279 %description server-postgresql
280 This package provides the Zabbix server binary for use with PostgreSQL
283 %description server-postgresql -l pl.UTF-8
284 Ten pakiet zawiera serwer Zabbiksa z obsługą bazy danych PostgreSQL.
287 Summary: Zabbix Java Gateway
288 Group: Networking/Utilities
289 Requires: %{name}-common = %{version}-%{release}
290 Requires: systemd-units >= 38
293 This package provides the Zabbix Java Gateway.
311 --enable-dependency-tracking \
314 %{__enable_disable java} \
334 for database in %{databases} ; do
335 if [ "$database" = "sqlite3" ] ; then
338 enable_server="--enable-server"
347 if [ "$enable_server" ] ; then
349 -C src/zabbix_server \
350 DESTDIR=$PWD/install-${database}
354 -C src/zabbix_proxy \
355 DESTDIR=$PWD/install-${database}
359 rm -rf $RPM_BUILD_ROOT
360 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d,/etc/webapps/%{_webapp},%{_appdir}/frontends/php} \
361 $RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix,%{systemdunitdir},%{systemdtmpfilesdir}}
364 DESTDIR=$RPM_BUILD_ROOT \
365 ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
367 for database in %{databases} ; do
368 if [ "$database" != "sqlite3" ] ; then
369 cp -p install-$database/%{_sbindir}/zabbix_server \
370 $RPM_BUILD_ROOT%{_sbindir}/zabbix_server-$database
372 cp -p install-$database/%{_sbindir}/zabbix_proxy \
373 $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy-$database
376 if [ -n "$database" ] ; then
377 ln -sf zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
378 ln -sf zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
382 install -d $RPM_BUILD_ROOT/var/lib/zabbix
383 touch $RPM_BUILD_ROOT/var/lib/zabbix/zabbix.db
386 cp -r ui/* $RPM_BUILD_ROOT%{_appdir}/frontends/php
388 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
389 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
391 install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_server.service
392 install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_agentd.service
393 install %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
394 install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_proxy.service
395 install %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_java.service
397 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/zabbix.conf
399 mv $RPM_BUILD_ROOT%{_appdir}/frontends/php/conf $RPM_BUILD_ROOT%{_sysconfdir}/frontend
400 ln -s --relative $RPM_BUILD_ROOT{%{_sysconfdir}/frontend,%{_appdir}/frontends/php/conf}
401 touch $RPM_BUILD_ROOT%{_sysconfdir}/frontend/zabbix.conf.php
404 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
405 ln -s --relative $RPM_BUILD_ROOT{%{_sysconfdir}/zabbix_java.conf,%{_datadir}/zabbix_java/settings.sh}
406 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
407 ln -s --relative $RPM_BUILD_ROOT{%{_sysconfdir}/java-logback.xml,%{_datadir}/zabbix_java/lib/logback.xml}
408 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
409 ln -s --relative $RPM_BUILD_ROOT{%{_sysconfdir}/java-logback-console.xml,%{_datadir}/zabbix_java/lib/logback-console.xml}
411 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
414 exec %{_datadir}/zabbix_java/startup.sh "$@"
417 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-stop <<'EOF'
420 exec %{_datadir}/zabbix_java/shutdown.sh "$@"
425 rm -rf $RPM_BUILD_ROOT
427 %triggerin frontend-php -- apache1 < 1.3.37-3, apache1-base
428 %webapp_register apache %{_webapp}
430 %triggerun frontend-php -- apache1 < 1.3.37-3, apache1-base
431 %webapp_unregister apache %{_webapp}
433 %triggerin frontend-php -- apache < 2.2.0, apache-base
434 %webapp_register httpd %{_webapp}
436 %triggerun frontend-php -- apache < 2.2.0, apache-base
437 %webapp_unregister httpd %{_webapp}
440 %groupadd -g 111 zabbix
441 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
442 %addusertogroup -q zabbix proc
445 if [ "$1" = "0" ]; then
451 if [ "$1" = 1 ]; then
452 %banner -e %{name}-server <<-EOF
453 You should create database for Zabbix.
455 Running these should be fine in most cases:
456 mysqladmin create zabbix
457 zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
458 zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
459 zcat %{_docdir}/%{name}-server-mysql-%{version}/data.sql.gz | mysql zabbix
462 ln -sf zabbix_server-mysql %{_sbindir}/zabbix_server || :
464 %post server-postgresql
465 if [ "$1" = 1 ]; then
466 %banner -e %{name}-server <<-EOF
467 You should create database for Zabbix.
469 Running these should be fine in most cases:
472 createdb -O zabbix zabbix
473 zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -u zabbix zabbix
474 zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -u zabbix zabbix
475 zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -u zabbix zabbix
478 ln -sf zabbix_server-postgresql %{_sbindir}/zabbix_server || :
481 %systemd_post zabbix_server.service
484 %systemd_preun zabbix_server.service
487 if [ "$1" = "0" ]; then
488 if [ -L %{_sbindir}/zabbix_server ] ; then
489 rm -f %{_sbindir}/zabbix_server || :
495 /sbin/chkconfig --add zabbix_agentd
496 %service zabbix_agentd restart
497 %systemd_post zabbix_agentd.service
500 if [ "$1" = "0" ]; then
501 %service -q zabbix_agentd stop
502 /sbin/chkconfig --del zabbix_agentd
504 %systemd_preun zabbix_agentd.service
510 ln -sf zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
512 %post proxy-postgresql
513 ln -sf zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
516 ln -sf zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
519 %systemd_post zabbix_proxy.service
522 %systemd_preun zabbix_proxy.service
528 %systemd_post zabbix_java.service
531 %systemd_preun zabbix_java.service
537 %defattr(644,root,root,755)
538 %doc AUTHORS ChangeLog README
541 %defattr(644,root,root,755)
542 %doc AUTHORS ChangeLog README
543 %attr(751,root,zabbix) %dir %{_sysconfdir}
544 %attr(751,root,http) %dir %{_sysconfdir}/frontend
546 %dir %{_appdir}/frontends
547 %dir %attr(770,root,zabbix) /var/run/zabbix
548 %dir %attr(775,root,zabbix) /var/log/zabbix
549 %{systemdtmpfilesdir}/zabbix.conf
552 %defattr(644,root,root,755)
553 %doc conf/zabbix_agentd/*.conf
554 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf
555 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agentd.conf.d
556 %attr(754,root,root) /etc/rc.d/init.d/zabbix_agentd
557 %attr(755,root,root) %{_sbindir}/zabbix_agentd
558 %{_mandir}/man8/zabbix_agentd*
559 %{systemdunitdir}/zabbix_agentd.service
562 %defattr(644,root,root,755)
563 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
564 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
565 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
566 %ghost %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/zabbix.conf.php
567 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/.htaccess
568 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/maintenance.inc.php
569 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/zabbix.conf.php.example
570 %{_appdir}/frontends/php
573 %defattr(644,root,root,755)
574 %attr(755,root,root) %{_bindir}/zabbix_get
575 %{_mandir}/man1/zabbix_get*
579 %defattr(644,root,root,755)
580 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
581 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
582 %ghost %{_sbindir}/zabbix_proxy
583 %{_mandir}/man8/zabbix_proxy*
584 %{systemdunitdir}/zabbix_proxy.service
589 %defattr(644,root,root,755)
590 %attr(755,root,root) %{_sbindir}/zabbix_proxy-mysql
594 %files proxy-postgresql
595 %defattr(644,root,root,755)
596 %attr(755,root,root) %{_sbindir}/zabbix_proxy-postgresql
601 %defattr(644,root,root,755)
602 %attr(755,root,root) %{_sbindir}/zabbix_proxy-sqlite3
606 %defattr(644,root,root,755)
607 %attr(755,root,root) %{_bindir}/zabbix_sender
608 %{_mandir}/man1/zabbix_sender*
612 %defattr(644,root,root,755)
613 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
614 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
615 %ghost %{_sbindir}/zabbix_server
616 %{_mandir}/man8/zabbix_server*
617 %{systemdunitdir}/zabbix_server.service
622 %defattr(644,root,root,755)
623 %doc database/mysql/*.sql
624 %attr(755,root,root) %{_sbindir}/zabbix_server-mysql
628 %files server-postgresql
629 %defattr(644,root,root,755)
630 %doc database/postgresql/*.sql
631 %attr(755,root,root) %{_sbindir}/zabbix_server-postgresql
636 %defattr(644,root,root,755)
637 %attr(755,root,root) %{_sbindir}/zabbix_java-start
638 %attr(755,root,root) %{_sbindir}/zabbix_java-stop
639 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_java.conf
640 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback.xml
641 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback-console.xml
642 %dir %{_datadir}/zabbix_java
643 %{_datadir}/zabbix_java/bin
644 %{_datadir}/zabbix_java/lib
645 %{_datadir}/zabbix_java/settings.sh
646 %attr(755,root,root) %{_datadir}/zabbix_java/shutdown.sh
647 %attr(755,root,root) %{_datadir}/zabbix_java/startup.sh
648 %{systemdunitdir}/zabbix_java.service