2 # - initscript for zabbix-server, zabbix-proxy and zabbix-java
5 %bcond_with agent2 # build Zabbix Agent 2
6 %bcond_without pgsql # enable PostgreSQL support
7 %bcond_without sqlite3 # enable sqlite3 support
8 %bcond_without mysql # enable MySQL support
9 %bcond_without java # disable java support
11 %define databases %{?with_sqlite3:sqlite3} %{?with_pgsql:postgresql} %{?with_mysql:mysql}
12 %define any_database %{with pgsql}%{with mysql}%{with sqlite3}
14 %define _noautoreq 'pear(.*\.php)'
16 %define php_min_version 5.4.0
17 Summary: Zabbix - network monitoring software
18 Summary(pl.UTF-8): Zabbix - oprogramowanie do monitorowania sieci
23 Group: Networking/Utilities
24 Source0: https://cdn.zabbix.com/zabbix/sources/stable/6.0/%{name}-%{version}.tar.gz
25 # Source0-md5: a57192d6bb17f9ca80a75f87d5462987
26 Source1: %{name}-apache.conf
27 Source2: %{name}_agentd.init
28 Source3: %{name}_server.init
29 Source4: %{name}_proxy.init
30 Source5: %{name}_agent2.init
32 Patch1: sqlite3_dbname.patch
33 Patch2: always_compile_ipc.patch
34 URL: https://www.zabbix.com/
35 BuildRequires: OpenIPMI-devel
36 BuildRequires: autoconf
37 BuildRequires: automake >= 1:1.15
38 BuildRequires: curl-devel
39 %{?with_agent2:BuildRequires: golang}
40 %{?with_java:BuildRequires: jdk}
41 BuildRequires: libevent-devel
42 BuildRequires: libssh2-devel
43 BuildRequires: libtool
44 BuildRequires: libxml2-devel
45 %{?with_mysql:BuildRequires: mysql-devel}
46 BuildRequires: net-snmp-devel
47 BuildRequires: openldap-devel >= 2.4.6
48 BuildRequires: openssl-devel >= 0.9.7d
49 BuildRequires: pcre-devel
50 %{?with_pgsql:BuildRequires: postgresql-devel}
51 BuildRequires: rpmbuild(macros) >= 1.671
52 %{?with_sqlite3:BuildRequires: sqlite3-devel}
53 BuildRequires: unixODBC-devel
54 BuildRequires: zlib-devel
55 Requires(postun): /usr/sbin/groupdel
56 Requires(postun): /usr/sbin/userdel
57 Requires(pre): /bin/id
58 Requires(pre): /usr/bin/getgid
59 Requires(pre): /usr/sbin/groupadd
60 Requires(pre): /usr/sbin/useradd
61 Provides: group(zabbix)
62 Provides: user(zabbix)
63 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
65 %define _sysconfdir /etc/%{name}
66 %define _appdir %{_datadir}/%{name}
67 %define _webapps /etc/webapps
68 %define _webapp %{name}
71 Zabbix is software that monitors numerous parameters of a network and
72 the servers on that network. It is a useful tool for monitoring the
73 health and integrity of servers. Zabbix uses a flexible notification
74 mechanism that allows users to configure email based alerts for
75 virtually any event. All monitored parameters are stored in a
76 database. Zabbix offers excellent reporting and data visualisation
77 features based on the stored data. Zabbix supports both polling and
78 trapping. All Zabbix reports and statistics, as well as configuration
79 parameters, are accessed through a web-based front end.
81 %description -l pl.UTF-8
82 Zabbix to oprogramowanie do monitorowania licznych parametrów sieci i
83 serwerów sieciowych. Jest przydatny przy monitorowaniu działania
84 serwerów. Jorzysta z elastycznego mechanizmu powiadamiania, który
85 pozwala użytkownikom konfigurować powiadamianie pocztą elektroniczną
86 dla praktycznie wszelkich zdarzeń. Monitorowane parametry są
87 przechowywane w bazie danych. W oparciu o przechowywane dane Zabbix
88 oferuje świetne raportowanie i funkcje wizualizacji. Wspiera zarówno
89 odpytywanie jak i pułapkowanie. Dostęp do wszystkich raportów i
90 statystyk Zabbixa jest możliwy poprzez interfejs oparty o WWW.
94 Summary(pl.UTF-8): Agenta Zabbixa
95 Group: Networking/Utilities
96 Requires: %{name} = %{version}-%{release}
97 Obsoletes: zabbix-agent-inetd
98 Obsoletes: zabbix-agent-standalone
99 Requires(post,preun): /sbin/chkconfig
103 Zabbix agent collects data from the local system for a Zabbix server.
105 %description agentd -l pl.UTF-8
106 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
109 Summary: Zabbix Agent 2
110 Summary(pl.UTF-8): Agent 2 Zabbixa
111 Group: Networking/Utilities
112 Requires: %{name} = %{version}-%{release}
113 Requires(post,preun): /sbin/chkconfig
117 Zabbix agent collects data from the local system for a Zabbix server.
119 %description agent2 -l pl.UTF-8
120 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
123 Summary: Web frontend for Zabbix
124 Summary(pl.UTF-8): Interfejs Web dla Zabbixa
125 Group: Applications/WWW
126 Requires: php(bcmath)
127 Requires: php(core) >= %{php_min_version}
130 Requires: php(gettext)
132 Requires: php(mbstring)
134 Requires: php(session)
135 Requires: php(sockets)
137 Requires: php(xmlreader)
138 Requires: php(xmlwriter)
140 Requires: webserver(alias)
141 Requires: webserver(indexfile)
142 Requires: webserver(php)
145 Suggests: php(sqlite3)
147 Suggests: php(sysvsem)
151 This package provides web based (PHP) frontend for Zabbix.
153 %description web -l pl.UTF-8
154 Ten pakiet dostarcza napisany w PHP frontend dla Zabbixa.
157 Summary: Zabbix proxy
158 Summary(pl.UTF-8): Proxy do Zabbixa
159 Group: Networking/Utilities
160 Requires: %{name} = %{version}-%{release}
161 Requires: zabbix-proxy(db) = %{version}-%{release}
164 This package provides the Zabbix proxy.
166 %description proxy -l pl.UTF-8
167 Ten pakiet zawiera proxy Zabbix.
170 Summary: MySQL support for Zabbix proxy
171 Summary(pl.UTF-8): Obsługa MySQL dla proxy do Zabbixa
172 Group: Networking/Utilities
173 Provides: %{name}-proxy(db) = %{version}-%{release}
174 Obsoletes: zabbix-proxy-postgresql
175 Obsoletes: zabbix-proxy-sqlite3
177 %description proxy-mysql
178 This package provides the Zabbix proxy binary with MySQL support.
180 %description proxy-mysql -l pl.UTF-8
181 Ten pakiet zawiera proxy Zabbix z obsługą MySQL.
183 %package proxy-postgresql
184 Summary: PostgreSQL support for Zabbix proxy
185 Summary(pl.UTF-8): Obsługa PostgreSQL dla proxy do Zabbixa
186 Group: Networking/Utilities
187 Provides: %{name}-proxy(db) = %{version}-%{release}
188 Obsoletes: zabbix-proxy-mysql
189 Obsoletes: zabbix-proxy-sqlite3
191 %description proxy-postgresql
192 This package provides the Zabbix proxy binary with PostgreSQL support.
194 %description proxy-postgresql -l pl.UTF-8
195 Ten pakiet zawiera proxy Zabbix z obsługą PostgreSQL.
197 %package proxy-sqlite3
198 Summary: SQLite 3 support for Zabbix proxy
199 Summary(pl.UTF-8): Obsługa SQLite 3 dla proxy do Zabbixa
200 Group: Networking/Utilities
201 Provides: %{name}-proxy(db) = %{version}-%{release}
202 Obsoletes: zabbix-proxy-mysql
203 Obsoletes: zabbix-proxy-postgresql
205 %description proxy-sqlite3
206 This package provides the Zabbix proxy binary with SQLite 3 support.
208 %description proxy-sqlite3 -l pl.UTF-8
209 Ten pakiet zawiera proxy Zabbix z obsługą SQLite 3.
212 Summary: Zabbix server
213 Summary(pl.UTF-8): Serwer Zabbixa
214 Group: Networking/Utilities
215 Requires: %{name} = %{version}-%{release}
216 Requires: %{name}-server(db) = %{version}-%{release}
217 Obsoletes: zabbix-suckerd
218 Obsoletes: zabbix-trapper-inetd
219 Obsoletes: zabbix-trapper-standalone
222 This package provides the Zabbix server.
224 %description server -l pl.UTF-8
225 Ten pakiet zawiera serwer Zabbixa.
227 %package server-mysql
228 Summary: MySQL support for Zabbix server
229 Summary(pl.UTF-8): Obsługa MySQL sla serwera Zabbixa
230 Group: Networking/Utilities
231 Provides: %{name}-server(db) = %{version}-%{release}
232 Obsoletes: zabbix-server-postgresql
233 Obsoletes: zabbix-server-sqlite3
235 %description server-mysql
236 This package provides the Zabbix server binary for use with MySQL
239 %description server-mysql -l pl.UTF-8
240 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych MySQL.
242 %package server-postgresql
243 Summary: PostgreSQL support for Zabbix server
244 Summary(pl.UTF-8): Obsługa PostgreSQL sla serwera Zabbixa
245 Group: Networking/Utilities
246 Provides: %{name}-server(db) = %{version}-%{release}
247 Obsoletes: zabbix-server-mysql
248 Obsoletes: zabbix-server-sqlite3
250 %description server-postgresql
251 This package provides the Zabbix server binary for use with PostgreSQL
254 %description server-postgresql -l pl.UTF-8
255 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych PostgreSQL.
258 Summary: Zabbix Java Gateway
259 Group: Networking/Utilities
260 Requires: %{name} = %{version}-%{release}
263 This package provides the Zabbix Java Gateway.
282 %{__enable_disable agent2} \
284 %{__enable_disable java} \
303 for database in %{databases} ; do
304 if [ "$database" = "sqlite3" ] ; then
307 enable_server="--enable-server"
316 if [ "$enable_server" ] ; then
318 -C src/zabbix_server \
319 DESTDIR=$PWD/install-${database}
323 -C src/zabbix_proxy \
324 DESTDIR=$PWD/install-${database}
328 rm -rf $RPM_BUILD_ROOT
329 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d,/etc/webapps/%{_webapp},%{_appdir}} \
330 $RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix}
333 DESTDIR=$RPM_BUILD_ROOT \
334 GOBIN=$RPM_BUILD_ROOT%{_sbindir} \
335 ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
337 for database in %{databases} ; do
338 if [ "$database" != "sqlite3" ] ; then
339 cp -p install-$database/%{_sbindir}/zabbix_server \
340 $RPM_BUILD_ROOT%{_sbindir}/zabbix_server-$database
342 cp -p install-$database/%{_sbindir}/zabbix_proxy \
343 $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy-$database
346 if [ -n "$database" ] ; then
347 ln -sf %{_sbindir}/zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
348 ln -sf %{_sbindir}/zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
351 cp -r ui $RPM_BUILD_ROOT%{_appdir}
353 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
354 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
356 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
357 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_server
358 install %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_proxy
359 install %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agent2
361 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
362 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
363 touch $RPM_BUILD_ROOT%{_sysconfdir}/web/zabbix.conf.php
366 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
367 ln -s %{_sysconfdir}/zabbix_java.conf $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh
368 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
369 ln -s %{_sysconfdir}/java-logback.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml
370 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
371 ln -s %{_sysconfdir}/java-logback-console.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml
373 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
376 exec %{_datadir}/zabbix_java/startup.sh "$@"
379 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-stop <<'EOF'
382 exec %{_datadir}/zabbix_java/shutdown.sh "$@"
387 rm -rf $RPM_BUILD_ROOT
389 %triggerin web -- apache < 2.2.0, apache-base
390 %webapp_register httpd %{_webapp}
392 %triggerun web -- apache < 2.2.0, apache-base
393 %webapp_unregister httpd %{_webapp}
396 %groupadd -g 111 zabbix
397 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
398 %addusertogroup -q zabbix proc
401 if [ "$1" = "0" ]; then
407 if [ "$1" = 1 ]; then
408 %banner -e %{name}-server <<-EOF
409 You should create database for Zabbix.
411 Running these should be fine in most cases:
413 mysqladmin create zabbix
414 zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
415 zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
416 zcat %{_docdir}/%{name}-server-mysql-%{version}/data.sql.gz | mysql zabbix
419 ln -sf %{_sbindir}/zabbix_server-mysql %{_sbindir}/zabbix_server || :
421 %post server-postgresql
422 if [ "$1" = 1 ]; then
423 %banner -e %{name}-server <<-EOF
424 You should create database for Zabbix.
426 Running these should be fine in most cases:
428 createuser -U postgres zabbix
429 createdb -U postgres -O zabbix zabbix
430 zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -U zabbix zabbix
431 zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -U zabbix zabbix
432 zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -U zabbix zabbix
435 ln -sf %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
438 /sbin/chkconfig --add zabbix_server
439 %service zabbix_server restart
442 if [ "$1" = "0" ]; then
443 %service -q zabbix_server stop
444 /sbin/chkconfig --del zabbix_server
446 if [ "$1" = "0" ]; then
447 if [ -L %{_sbindir}/zabbix_server ] ; then
448 rm -f %{_sbindir}/zabbix_server || :
453 /sbin/chkconfig --add zabbix_agentd
454 %service zabbix_agentd restart
457 if [ "$1" = "0" ]; then
458 %service -q zabbix_agentd stop
459 /sbin/chkconfig --del zabbix_agentd
463 /sbin/chkconfig --add zabbix_agent2
464 %service zabbix_agent2 restart
467 if [ "$1" = "0" ]; then
468 %service -q zabbix_agent2 stop
469 /sbin/chkconfig --del zabbix_agent2
473 ln -sf %{_sbindir}/zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
475 %post proxy-postgresql
476 ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
479 ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
482 /sbin/chkconfig --add zabbix_server
483 %service zabbix_server restart
486 if [ "$1" = "0" ]; then
487 %service -q zabbix_proxy stop
488 /sbin/chkconfig --del zabbix_proxy
490 if [ "$1" = "0" ]; then
491 if [ -L %{_sbindir}/zabbix_proxy ] ; then
492 rm -f %{_sbindir}/zabbix_proxy || :
497 %defattr(644,root,root,755)
498 %doc AUTHORS ChangeLog README
499 %attr(755,root,root) %{_bindir}/zabbix_get
500 %attr(755,root,root) %{_bindir}/zabbix_js
501 %attr(755,root,root) %{_bindir}/zabbix_sender
502 %attr(751,root,zabbix) %dir %{_sysconfdir}
503 %attr(751,root,http) %dir %{_sysconfdir}/web
505 %dir %attr(770,root,zabbix) /var/run/zabbix
506 %dir %attr(775,root,zabbix) /var/log/zabbix
507 %{_mandir}/man1/zabbix_get*
508 %{_mandir}/man1/zabbix_sender*
511 %defattr(644,root,root,755)
512 %doc conf/zabbix_agentd/*.conf
513 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf
514 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agentd.conf.d
515 %attr(754,root,root) /etc/rc.d/init.d/zabbix_agentd
516 %attr(755,root,root) %{_sbindir}/zabbix_agentd
517 %{_mandir}/man8/zabbix_agentd*
521 %defattr(644,root,root,755)
522 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.conf
523 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.d
524 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.d/plugins.d
525 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/ceph.conf
526 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/docker.conf
527 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/memcached.conf
528 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/modbus.conf
529 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/mqtt.conf
530 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/mysql.conf
531 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/oracle.conf
532 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/redis.conf
533 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/smart.conf
534 %attr(754,root,root) /etc/rc.d/init.d/zabbix_agent2
535 %attr(755,root,root) %{_sbindir}/zabbix_agent2
536 %{_mandir}/man8/zabbix_agent2*
540 %defattr(644,root,root,755)
541 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
542 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
543 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
544 %ghost %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php
545 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/.htaccess
546 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/maintenance.inc.php
547 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php.example
552 %defattr(644,root,root,755)
553 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
554 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
555 %attr(754,root,root) /etc/rc.d/init.d/zabbix_proxy
556 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
557 %{_mandir}/man8/zabbix_proxy*
562 %defattr(644,root,root,755)
563 %attr(755,root,root) %{_sbindir}/zabbix_proxy-mysql
567 %files proxy-postgresql
568 %defattr(644,root,root,755)
569 %attr(755,root,root) %{_sbindir}/zabbix_proxy-postgresql
574 %defattr(644,root,root,755)
575 %attr(755,root,root) %{_sbindir}/zabbix_proxy-sqlite3
581 %defattr(644,root,root,755)
582 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
583 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
584 %attr(754,root,root) /etc/rc.d/init.d/zabbix_server
585 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
586 %{_mandir}/man8/zabbix_server*
591 %defattr(644,root,root,755)
592 %doc database/mysql/*.sql
593 %attr(755,root,root) %{_sbindir}/zabbix_server-mysql
597 %files server-postgresql
598 %defattr(644,root,root,755)
599 %doc database/postgresql/*.sql
600 %attr(755,root,root) %{_sbindir}/zabbix_server-postgresql
605 %defattr(644,root,root,755)
606 %attr(755,root,root) %{_sbindir}/zabbix_java-start
607 %attr(755,root,root) %{_sbindir}/zabbix_java-stop
608 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_java.conf
609 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback.xml
610 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback-console.xml
611 %dir %{_datadir}/zabbix_java
612 %{_datadir}/zabbix_java/bin
613 %{_datadir}/zabbix_java/lib
614 %{_datadir}/zabbix_java/settings.sh
615 %attr(755,root,root) %{_datadir}/zabbix_java/shutdown.sh
616 %attr(755,root,root) %{_datadir}/zabbix_java/startup.sh