2 # - initscript for zabbix-server, zabbix-proxy and zabbix-java
5 %bcond_without pgsql # enable PostgreSQL support
6 %bcond_without sqlite3 # enable sqlite3 support
7 %bcond_without mysql # enable MySQL support
8 %bcond_without java # disable java support
10 %define databases %{?with_sqlite3:sqlite3} %{?with_pgsql:postgresql} %{?with_mysql:mysql}
11 %define any_database %{with pgsql}%{with mysql}%{with sqlite3}
13 %define _noautoreq 'pear(.*\.php)'
15 %define php_min_version 5.4.0
16 Summary: Zabbix - network monitoring software
17 Summary(pl.UTF-8): Zabbix - oprogramowanie do monitorowania sieci
22 Group: Networking/Utilities
23 Source0: https://cdn.zabbix.com/zabbix/sources/stable/6.0/%{name}-%{version}.tar.gz
24 # Source0-md5: a57192d6bb17f9ca80a75f87d5462987
25 Source1: %{name}-apache.conf
26 Source2: %{name}_agentd.init
27 Source3: %{name}_server.init
28 Source4: %{name}_proxy.init
29 Source5: %{name}_agent2.init
31 Patch1: sqlite3_dbname.patch
32 Patch2: always_compile_ipc.patch
33 URL: https://www.zabbix.com/
34 BuildRequires: OpenIPMI-devel
35 BuildRequires: autoconf
36 BuildRequires: automake >= 1:1.15
37 BuildRequires: curl-devel
39 %{?with_java:BuildRequires: jdk}
40 BuildRequires: libevent-devel
41 BuildRequires: libssh2-devel
42 BuildRequires: libtool
43 BuildRequires: libxml2-devel
44 %{?with_mysql:BuildRequires: mysql-devel}
45 BuildRequires: net-snmp-devel
46 BuildRequires: openldap-devel >= 2.4.6
47 BuildRequires: openssl-devel >= 0.9.7d
48 BuildRequires: pcre-devel
49 %{?with_pgsql:BuildRequires: postgresql-devel}
50 BuildRequires: rpmbuild(macros) >= 1.671
51 %{?with_sqlite3:BuildRequires: sqlite3-devel}
52 BuildRequires: unixODBC-devel
53 BuildRequires: zlib-devel
54 Requires(postun): /usr/sbin/groupdel
55 Requires(postun): /usr/sbin/userdel
56 Requires(pre): /bin/id
57 Requires(pre): /usr/bin/getgid
58 Requires(pre): /usr/sbin/groupadd
59 Requires(pre): /usr/sbin/useradd
60 Provides: group(zabbix)
61 Provides: user(zabbix)
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 Zabbixa jest możliwy poprzez interfejs oparty o WWW.
93 Summary(pl.UTF-8): Agenta Zabbixa
94 Group: Networking/Utilities
95 Requires: %{name} = %{version}-%{release}
96 Obsoletes: zabbix-agent-inetd
97 Obsoletes: zabbix-agent-standalone
98 Requires(post,preun): /sbin/chkconfig
102 Zabbix agent collects data from the local system for a Zabbix server.
104 %description agentd -l pl.UTF-8
105 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
108 Summary: Zabbix Agent 2
109 Summary(pl.UTF-8): Agent 2 Zabbixa
110 Group: Networking/Utilities
111 Requires: %{name} = %{version}-%{release}
112 Requires(post,preun): /sbin/chkconfig
116 Zabbix agent collects data from the local system for a Zabbix server.
118 %description agent2 -l pl.UTF-8
119 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
122 Summary: Web frontend for Zabbix
123 Summary(pl.UTF-8): Interfejs Web dla Zabbixa
124 Group: Applications/WWW
125 Requires: php(bcmath)
126 Requires: php(core) >= %{php_min_version}
129 Requires: php(gettext)
131 Requires: php(mbstring)
133 Requires: php(session)
134 Requires: php(sockets)
136 Requires: php(xmlreader)
137 Requires: php(xmlwriter)
139 Requires: webserver(alias)
140 Requires: webserver(indexfile)
141 Requires: webserver(php)
144 Suggests: php(sqlite3)
146 Suggests: php(sysvsem)
150 This package provides web based (PHP) frontend for Zabbix.
152 %description web -l pl.UTF-8
153 Ten pakiet dostarcza napisany w PHP frontend dla Zabbixa.
156 Summary: Zabbix proxy
157 Summary(pl.UTF-8): Proxy do Zabbixa
158 Group: Networking/Utilities
159 Requires: %{name} = %{version}-%{release}
160 Requires: zabbix-proxy(db) = %{version}-%{release}
163 This package provides the Zabbix proxy.
165 %description proxy -l pl.UTF-8
166 Ten pakiet zawiera proxy Zabbix.
169 Summary: MySQL support for Zabbix proxy
170 Summary(pl.UTF-8): Obsługa MySQL dla proxy do Zabbixa
171 Group: Networking/Utilities
172 Provides: %{name}-proxy(db) = %{version}-%{release}
173 Obsoletes: zabbix-proxy-postgresql
174 Obsoletes: zabbix-proxy-sqlite3
176 %description proxy-mysql
177 This package provides the Zabbix proxy binary with MySQL support.
179 %description proxy-mysql -l pl.UTF-8
180 Ten pakiet zawiera proxy Zabbix z obsługą MySQL.
182 %package proxy-postgresql
183 Summary: PostgreSQL support for Zabbix proxy
184 Summary(pl.UTF-8): Obsługa PostgreSQL dla proxy do Zabbixa
185 Group: Networking/Utilities
186 Provides: %{name}-proxy(db) = %{version}-%{release}
187 Obsoletes: zabbix-proxy-mysql
188 Obsoletes: zabbix-proxy-sqlite3
190 %description proxy-postgresql
191 This package provides the Zabbix proxy binary with PostgreSQL support.
193 %description proxy-postgresql -l pl.UTF-8
194 Ten pakiet zawiera proxy Zabbix z obsługą PostgreSQL.
196 %package proxy-sqlite3
197 Summary: SQLite 3 support for Zabbix proxy
198 Summary(pl.UTF-8): Obsługa SQLite 3 dla proxy do Zabbixa
199 Group: Networking/Utilities
200 Provides: %{name}-proxy(db) = %{version}-%{release}
201 Obsoletes: zabbix-proxy-mysql
202 Obsoletes: zabbix-proxy-postgresql
204 %description proxy-sqlite3
205 This package provides the Zabbix proxy binary with SQLite 3 support.
207 %description proxy-sqlite3 -l pl.UTF-8
208 Ten pakiet zawiera proxy Zabbix z obsługą SQLite 3.
211 Summary: Zabbix server
212 Summary(pl.UTF-8): Serwer Zabbixa
213 Group: Networking/Utilities
214 Requires: %{name} = %{version}-%{release}
215 Requires: %{name}-server(db) = %{version}-%{release}
216 Obsoletes: zabbix-suckerd
217 Obsoletes: zabbix-trapper-inetd
218 Obsoletes: zabbix-trapper-standalone
221 This package provides the Zabbix server.
223 %description server -l pl.UTF-8
224 Ten pakiet zawiera serwer Zabbixa.
226 %package server-mysql
227 Summary: MySQL support for Zabbix server
228 Summary(pl.UTF-8): Obsługa MySQL sla serwera Zabbixa
229 Group: Networking/Utilities
230 Provides: %{name}-server(db) = %{version}-%{release}
231 Obsoletes: zabbix-server-postgresql
232 Obsoletes: zabbix-server-sqlite3
234 %description server-mysql
235 This package provides the Zabbix server binary for use with MySQL
238 %description server-mysql -l pl.UTF-8
239 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych MySQL.
241 %package server-postgresql
242 Summary: PostgreSQL support for Zabbix server
243 Summary(pl.UTF-8): Obsługa PostgreSQL sla serwera Zabbixa
244 Group: Networking/Utilities
245 Provides: %{name}-server(db) = %{version}-%{release}
246 Obsoletes: zabbix-server-mysql
247 Obsoletes: zabbix-server-sqlite3
249 %description server-postgresql
250 This package provides the Zabbix server binary for use with PostgreSQL
253 %description server-postgresql -l pl.UTF-8
254 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych PostgreSQL.
257 Summary: Zabbix Java Gateway
258 Group: Networking/Utilities
259 Requires: %{name} = %{version}-%{release}
262 This package provides the Zabbix Java Gateway.
283 %{__enable_disable java} \
302 for database in %{databases} ; do
303 if [ "$database" = "sqlite3" ] ; then
306 enable_server="--enable-server"
315 if [ "$enable_server" ] ; then
317 -C src/zabbix_server \
318 DESTDIR=$PWD/install-${database}
322 -C src/zabbix_proxy \
323 DESTDIR=$PWD/install-${database}
327 rm -rf $RPM_BUILD_ROOT
328 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d,/etc/webapps/%{_webapp},%{_appdir}} \
329 $RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix}
332 DESTDIR=$RPM_BUILD_ROOT \
333 GOBIN=$RPM_BUILD_ROOT%{_sbindir} \
334 ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
336 for database in %{databases} ; do
337 if [ "$database" != "sqlite3" ] ; then
338 cp -p install-$database/%{_sbindir}/zabbix_server \
339 $RPM_BUILD_ROOT%{_sbindir}/zabbix_server-$database
341 cp -p install-$database/%{_sbindir}/zabbix_proxy \
342 $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy-$database
345 if [ -n "$database" ] ; then
346 ln -sf %{_sbindir}/zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
347 ln -sf %{_sbindir}/zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
350 cp -r ui $RPM_BUILD_ROOT%{_appdir}
352 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
353 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
355 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
356 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_server
357 install %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_proxy
358 install %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agent2
360 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
361 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
362 touch $RPM_BUILD_ROOT%{_sysconfdir}/web/zabbix.conf.php
365 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
366 ln -s %{_sysconfdir}/zabbix_java.conf $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh
367 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
368 ln -s %{_sysconfdir}/java-logback.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml
369 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
370 ln -s %{_sysconfdir}/java-logback-console.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml
372 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
375 exec %{_datadir}/zabbix_java/startup.sh "$@"
378 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-stop <<'EOF'
381 exec %{_datadir}/zabbix_java/shutdown.sh "$@"
386 rm -rf $RPM_BUILD_ROOT
388 %triggerin web -- apache < 2.2.0, apache-base
389 %webapp_register httpd %{_webapp}
391 %triggerun web -- apache < 2.2.0, apache-base
392 %webapp_unregister httpd %{_webapp}
395 %groupadd -g 111 zabbix
396 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
397 %addusertogroup -q zabbix proc
400 if [ "$1" = "0" ]; then
406 if [ "$1" = 1 ]; then
407 %banner -e %{name}-server <<-EOF
408 You should create database for Zabbix.
410 Running these should be fine in most cases:
412 mysqladmin create zabbix
413 zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
414 zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
415 zcat %{_docdir}/%{name}-server-mysql-%{version}/data.sql.gz | mysql zabbix
418 ln -sf %{_sbindir}/zabbix_server-mysql %{_sbindir}/zabbix_server || :
420 %post server-postgresql
421 if [ "$1" = 1 ]; then
422 %banner -e %{name}-server <<-EOF
423 You should create database for Zabbix.
425 Running these should be fine in most cases:
427 createuser -U postgres zabbix
428 createdb -U postgres -O zabbix zabbix
429 zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -U zabbix zabbix
430 zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -U zabbix zabbix
431 zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -U zabbix zabbix
434 ln -sf %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
437 /sbin/chkconfig --add zabbix_server
438 %service zabbix_server restart
441 if [ "$1" = "0" ]; then
442 %service -q zabbix_server stop
443 /sbin/chkconfig --del zabbix_server
445 if [ "$1" = "0" ]; then
446 if [ -L %{_sbindir}/zabbix_server ] ; then
447 rm -f %{_sbindir}/zabbix_server || :
452 /sbin/chkconfig --add zabbix_agentd
453 %service zabbix_agentd restart
456 if [ "$1" = "0" ]; then
457 %service -q zabbix_agentd stop
458 /sbin/chkconfig --del zabbix_agentd
462 /sbin/chkconfig --add zabbix_agent2
463 %service zabbix_agent2 restart
466 if [ "$1" = "0" ]; then
467 %service -q zabbix_agent2 stop
468 /sbin/chkconfig --del zabbix_agent2
472 ln -sf %{_sbindir}/zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
474 %post proxy-postgresql
475 ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
478 ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
481 /sbin/chkconfig --add zabbix_server
482 %service zabbix_server restart
485 if [ "$1" = "0" ]; then
486 %service -q zabbix_proxy stop
487 /sbin/chkconfig --del zabbix_proxy
489 if [ "$1" = "0" ]; then
490 if [ -L %{_sbindir}/zabbix_proxy ] ; then
491 rm -f %{_sbindir}/zabbix_proxy || :
496 %defattr(644,root,root,755)
497 %doc AUTHORS ChangeLog README
498 %attr(755,root,root) %{_bindir}/zabbix_get
499 %attr(755,root,root) %{_bindir}/zabbix_js
500 %attr(755,root,root) %{_bindir}/zabbix_sender
501 %attr(751,root,zabbix) %dir %{_sysconfdir}
502 %attr(751,root,http) %dir %{_sysconfdir}/web
504 %dir %attr(770,root,zabbix) /var/run/zabbix
505 %dir %attr(775,root,zabbix) /var/log/zabbix
506 %{_mandir}/man1/zabbix_get*
507 %{_mandir}/man1/zabbix_sender*
510 %defattr(644,root,root,755)
511 %doc conf/zabbix_agentd/*.conf
512 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf
513 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agentd.conf.d
514 %attr(754,root,root) /etc/rc.d/init.d/zabbix_agentd
515 %attr(755,root,root) %{_sbindir}/zabbix_agentd
516 %{_mandir}/man8/zabbix_agentd*
519 %defattr(644,root,root,755)
520 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.conf
521 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.d
522 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.d/plugins.d
523 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/ceph.conf
524 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/docker.conf
525 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/memcached.conf
526 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/modbus.conf
527 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/mqtt.conf
528 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/mysql.conf
529 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/oracle.conf
530 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/redis.conf
531 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/smart.conf
532 %attr(754,root,root) /etc/rc.d/init.d/zabbix_agent2
533 %attr(755,root,root) %{_sbindir}/zabbix_agent2
534 %{_mandir}/man8/zabbix_agent2*
537 %defattr(644,root,root,755)
538 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
539 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
540 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
541 %ghost %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php
542 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/.htaccess
543 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/maintenance.inc.php
544 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php.example
549 %defattr(644,root,root,755)
550 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
551 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
552 %attr(754,root,root) /etc/rc.d/init.d/zabbix_proxy
553 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
554 %{_mandir}/man8/zabbix_proxy*
559 %defattr(644,root,root,755)
560 %attr(755,root,root) %{_sbindir}/zabbix_proxy-mysql
564 %files proxy-postgresql
565 %defattr(644,root,root,755)
566 %attr(755,root,root) %{_sbindir}/zabbix_proxy-postgresql
571 %defattr(644,root,root,755)
572 %attr(755,root,root) %{_sbindir}/zabbix_proxy-sqlite3
578 %defattr(644,root,root,755)
579 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
580 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
581 %attr(754,root,root) /etc/rc.d/init.d/zabbix_server
582 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
583 %{_mandir}/man8/zabbix_server*
588 %defattr(644,root,root,755)
589 %doc database/mysql/*.sql
590 %attr(755,root,root) %{_sbindir}/zabbix_server-mysql
594 %files server-postgresql
595 %defattr(644,root,root,755)
596 %doc database/postgresql/*.sql
597 %attr(755,root,root) %{_sbindir}/zabbix_server-postgresql
602 %defattr(644,root,root,755)
603 %attr(755,root,root) %{_sbindir}/zabbix_java-start
604 %attr(755,root,root) %{_sbindir}/zabbix_java-stop
605 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_java.conf
606 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback.xml
607 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback-console.xml
608 %dir %{_datadir}/zabbix_java
609 %{_datadir}/zabbix_java/bin
610 %{_datadir}/zabbix_java/lib
611 %{_datadir}/zabbix_java/settings.sh
612 %attr(755,root,root) %{_datadir}/zabbix_java/shutdown.sh
613 %attr(755,root,root) %{_datadir}/zabbix_java/startup.sh