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: 199db00f68ce0ea14320ba926265fe9d
25 Source1: %{name}-apache.conf
26 Source2: %{name}_agentd.init
27 Source3: %{name}_server.init
28 Source4: %{name}_proxy.init
30 Patch1: sqlite3_dbname.patch
31 Patch2: always_compile_ipc.patch
32 URL: https://www.zabbix.com/
33 BuildRequires: OpenIPMI-devel
34 BuildRequires: autoconf
35 BuildRequires: automake >= 1:1.15
36 BuildRequires: curl-devel
37 #BuildRequires: iksemel-devel
38 %{?with_java:BuildRequires: jdk}
39 BuildRequires: libevent-devel
40 BuildRequires: libssh2-devel
41 BuildRequires: libtool
42 BuildRequires: libxml2-devel
43 %{?with_mysql:BuildRequires: mysql-devel}
44 BuildRequires: net-snmp-devel
45 BuildRequires: openldap-devel >= 2.4.6
46 BuildRequires: openssl-devel >= 0.9.7d
47 BuildRequires: pcre-devel
48 %{?with_pgsql:BuildRequires: postgresql-devel}
49 BuildRequires: rpmbuild(macros) >= 1.671
50 %{?with_sqlite3:BuildRequires: sqlite3-devel}
51 BuildRequires: unixODBC-devel
52 BuildRequires: zlib-devel
53 Requires(postun): /usr/sbin/groupdel
54 Requires(postun): /usr/sbin/userdel
55 Requires(pre): /bin/id
56 Requires(pre): /usr/bin/getgid
57 Requires(pre): /usr/sbin/groupadd
58 Requires(pre): /usr/sbin/useradd
59 Provides: group(zabbix)
60 Provides: user(zabbix)
61 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
63 %define _sysconfdir /etc/%{name}
64 %define _appdir %{_datadir}/%{name}
65 %define _webapps /etc/webapps
66 %define _webapp %{name}
69 Zabbix is software that monitors numerous parameters of a network and
70 the servers on that network. It is a useful tool for monitoring the
71 health and integrity of servers. Zabbix uses a flexible notification
72 mechanism that allows users to configure email based alerts for
73 virtually any event. All monitored parameters are stored in a
74 database. Zabbix offers excellent reporting and data visualisation
75 features based on the stored data. Zabbix supports both polling and
76 trapping. All Zabbix reports and statistics, as well as configuration
77 parameters, are accessed through a web-based front end.
79 %description -l pl.UTF-8
80 Zabbix to oprogramowanie do monitorowania licznych parametrów sieci i
81 serwerów sieciowych. Jest przydatny przy monitorowaniu działania
82 serwerów. Jorzysta z elastycznego mechanizmu powiadamiania, który
83 pozwala użytkownikom konfigurować powiadamianie pocztą elektroniczną
84 dla praktycznie wszelkich zdarzeń. Monitorowane parametry są
85 przechowywane w bazie danych. W oparciu o przechowywane dane Zabbix
86 oferuje świetne raportowanie i funkcje wizualizacji. Wspiera zarówno
87 odpytywanie jak i pułapkowanie. Dostęp do wszystkich raportów i
88 statystyk Zabbixa jest możliwy poprzez interfejs oparty o WWW.
92 Summary(pl.UTF-8): Agenta Zabbixa
93 Group: Networking/Utilities
94 Requires: %{name} = %{version}-%{release}
95 Obsoletes: zabbix-agent-inetd
96 Obsoletes: zabbix-agent-standalone
97 Requires(post,preun): /sbin/chkconfig
101 Zabbix agent collects data from the local system for a Zabbix server.
103 %description agentd -l pl.UTF-8
104 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
107 Summary: Web frontend for Zabbix
108 Summary(pl.UTF-8): Interfejs Web dla Zabbixa
109 Group: Applications/WWW
110 Requires: php(bcmath)
111 Requires: php(core) >= %{php_min_version}
114 Requires: php(gettext)
116 Requires: php(mbstring)
118 Requires: php(session)
119 Requires: php(sockets)
121 Requires: php(xmlreader)
122 Requires: php(xmlwriter)
124 Requires: webserver(alias)
125 Requires: webserver(indexfile)
126 Requires: webserver(php)
129 Suggests: php(sqlite3)
131 Suggests: php(sysvsem)
135 This package provides web based (PHP) frontend for Zabbix.
137 %description web -l pl.UTF-8
138 Ten pakiet dostarcza napisany w PHP frontend dla Zabbixa.
141 Summary: Zabbix proxy
142 Summary(pl.UTF-8): Proxy do Zabbixa
143 Group: Networking/Utilities
144 Requires: %{name} = %{version}-%{release}
145 Requires: zabbix-proxy(db) = %{version}-%{release}
148 This package provides the Zabbix proxy.
150 %description proxy -l pl.UTF-8
151 Ten pakiet zawiera proxy Zabbix.
154 Summary: MySQL support for Zabbix proxy
155 Summary(pl.UTF-8): Obsługa MySQL dla proxy do Zabbixa
156 Group: Networking/Utilities
157 Provides: %{name}-proxy(db) = %{version}-%{release}
158 Obsoletes: zabbix-proxy-postgresql
159 Obsoletes: zabbix-proxy-sqlite3
161 %description proxy-mysql
162 This package provides the Zabbix proxy binary with MySQL support.
164 %description proxy-mysql -l pl.UTF-8
165 Ten pakiet zawiera proxy Zabbix z obsługą MySQL.
167 %package proxy-postgresql
168 Summary: PostgreSQL support for Zabbix proxy
169 Summary(pl.UTF-8): Obsługa PostgreSQL dla proxy do Zabbixa
170 Group: Networking/Utilities
171 Provides: %{name}-proxy(db) = %{version}-%{release}
172 Obsoletes: zabbix-proxy-mysql
173 Obsoletes: zabbix-proxy-sqlite3
175 %description proxy-postgresql
176 This package provides the Zabbix proxy binary with PostgreSQL support.
178 %description proxy-postgresql -l pl.UTF-8
179 Ten pakiet zawiera proxy Zabbix z obsługą PostgreSQL.
181 %package proxy-sqlite3
182 Summary: SQLite 3 support for Zabbix proxy
183 Summary(pl.UTF-8): Obsługa SQLite 3 dla proxy do Zabbixa
184 Group: Networking/Utilities
185 Provides: %{name}-proxy(db) = %{version}-%{release}
186 Obsoletes: zabbix-proxy-mysql
187 Obsoletes: zabbix-proxy-postgresql
189 %description proxy-sqlite3
190 This package provides the Zabbix proxy binary with SQLite 3 support.
192 %description proxy-sqlite3 -l pl.UTF-8
193 Ten pakiet zawiera proxy Zabbix z obsługą SQLite 3.
196 Summary: Zabbix server
197 Summary(pl.UTF-8): Serwer Zabbixa
198 Group: Networking/Utilities
199 Requires: %{name} = %{version}-%{release}
200 Requires: %{name}-server(db) = %{version}-%{release}
201 Obsoletes: zabbix-suckerd
202 Obsoletes: zabbix-trapper-inetd
203 Obsoletes: zabbix-trapper-standalone
206 This package provides the Zabbix server.
208 %description server -l pl.UTF-8
209 Ten pakiet zawiera serwer Zabbixa.
211 %package server-mysql
212 Summary: MySQL support for Zabbix server
213 Summary(pl.UTF-8): Obsługa MySQL sla serwera Zabbixa
214 Group: Networking/Utilities
215 Provides: %{name}-server(db) = %{version}-%{release}
216 Obsoletes: zabbix-server-postgresql
217 Obsoletes: zabbix-server-sqlite3
219 %description server-mysql
220 This package provides the Zabbix server binary for use with MySQL
223 %description server-mysql -l pl.UTF-8
224 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych MySQL.
226 %package server-postgresql
227 Summary: PostgreSQL support for Zabbix server
228 Summary(pl.UTF-8): Obsługa PostgreSQL sla serwera Zabbixa
229 Group: Networking/Utilities
230 Provides: %{name}-server(db) = %{version}-%{release}
231 Obsoletes: zabbix-server-mysql
232 Obsoletes: zabbix-server-sqlite3
234 %description server-postgresql
235 This package provides the Zabbix server binary for use with PostgreSQL
238 %description server-postgresql -l pl.UTF-8
239 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych PostgreSQL.
242 Summary: Zabbix Java Gateway
243 Group: Networking/Utilities
244 Requires: %{name} = %{version}-%{release}
247 This package provides the Zabbix Java Gateway.
267 %{__enable_disable java} \
286 for database in %{databases} ; do
287 if [ "$database" = "sqlite3" ] ; then
290 enable_server="--enable-server"
299 if [ "$enable_server" ] ; then
301 -C src/zabbix_server \
302 DESTDIR=$PWD/install-${database}
306 -C src/zabbix_proxy \
307 DESTDIR=$PWD/install-${database}
311 rm -rf $RPM_BUILD_ROOT
312 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d,/etc/webapps/%{_webapp},%{_appdir}} \
313 $RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix}
316 DESTDIR=$RPM_BUILD_ROOT \
317 ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
319 for database in %{databases} ; do
320 if [ "$database" != "sqlite3" ] ; then
321 cp -p install-$database/%{_sbindir}/zabbix_server \
322 $RPM_BUILD_ROOT%{_sbindir}/zabbix_server-$database
324 cp -p install-$database/%{_sbindir}/zabbix_proxy \
325 $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy-$database
328 if [ -n "$database" ] ; then
329 ln -sf %{_sbindir}/zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
330 ln -sf %{_sbindir}/zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
333 cp -r ui $RPM_BUILD_ROOT%{_appdir}
335 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
336 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
338 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
339 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_server
340 install %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_proxy
342 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
343 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
344 touch $RPM_BUILD_ROOT%{_sysconfdir}/web/zabbix.conf.php
347 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
348 ln -s %{_sysconfdir}/zabbix_java.conf $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh
349 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
350 ln -s %{_sysconfdir}/java-logback.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml
351 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
352 ln -s %{_sysconfdir}/java-logback-console.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml
354 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
357 exec %{_datadir}/zabbix_java/startup.sh "$@"
360 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-stop <<'EOF'
363 exec %{_datadir}/zabbix_java/shutdown.sh "$@"
368 rm -rf $RPM_BUILD_ROOT
370 %triggerin web -- apache < 2.2.0, apache-base
371 %webapp_register httpd %{_webapp}
373 %triggerun web -- apache < 2.2.0, apache-base
374 %webapp_unregister httpd %{_webapp}
377 %groupadd -g 111 zabbix
378 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
379 %addusertogroup -q zabbix proc
382 if [ "$1" = "0" ]; then
388 if [ "$1" = 1 ]; then
389 %banner -e %{name}-server <<-EOF
390 You should create database for Zabbix.
392 Running these should be fine in most cases:
394 mysqladmin create zabbix
395 zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
396 zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
397 zcat %{_docdir}/%{name}-server-mysql-%{version}/data.sql.gz | mysql zabbix
400 ln -sf %{_sbindir}/zabbix_server-mysql %{_sbindir}/zabbix_server || :
402 %post server-postgresql
403 if [ "$1" = 1 ]; then
404 %banner -e %{name}-server <<-EOF
405 You should create database for Zabbix.
407 Running these should be fine in most cases:
409 createuser -U postgres zabbix
410 createdb -U postgres -O zabbix zabbix
411 zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -U zabbix zabbix
412 zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -U zabbix zabbix
413 zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -U zabbix zabbix
416 ln -sf %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
419 /sbin/chkconfig --add zabbix_server
420 %service zabbix_server restart
423 if [ "$1" = "0" ]; then
424 %service -q zabbix_server stop
425 /sbin/chkconfig --del zabbix_server
427 if [ "$1" = "0" ]; then
428 if [ -L %{_sbindir}/zabbix_server ] ; then
429 rm -f %{_sbindir}/zabbix_server || :
434 /sbin/chkconfig --add zabbix_agentd
435 %service zabbix_agentd restart
438 if [ "$1" = "0" ]; then
439 %service -q zabbix_agentd stop
440 /sbin/chkconfig --del zabbix_agentd
444 ln -sf %{_sbindir}/zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
446 %post proxy-postgresql
447 ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
450 ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
453 /sbin/chkconfig --add zabbix_server
454 %service zabbix_server restart
457 if [ "$1" = "0" ]; then
458 %service -q zabbix_proxy stop
459 /sbin/chkconfig --del zabbix_proxy
461 if [ "$1" = "0" ]; then
462 if [ -L %{_sbindir}/zabbix_proxy ] ; then
463 rm -f %{_sbindir}/zabbix_proxy || :
468 %defattr(644,root,root,755)
469 %doc AUTHORS ChangeLog README
470 %attr(755,root,root) %{_bindir}/zabbix_get
471 %attr(755,root,root) %{_bindir}/zabbix_js
472 %attr(755,root,root) %{_bindir}/zabbix_sender
473 %attr(751,root,zabbix) %dir %{_sysconfdir}
474 %attr(751,root,http) %dir %{_sysconfdir}/web
476 %dir %attr(770,root,zabbix) /var/run/zabbix
477 %dir %attr(775,root,zabbix) /var/log/zabbix
478 %{_mandir}/man1/zabbix_get*
479 %{_mandir}/man1/zabbix_sender*
482 %defattr(644,root,root,755)
483 %doc conf/zabbix_agentd/*.conf
484 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf
485 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agentd.conf.d
486 %attr(754,root,root) /etc/rc.d/init.d/zabbix_agentd
487 %attr(755,root,root) %{_sbindir}/zabbix_agentd
488 %{_mandir}/man8/zabbix_agentd*
491 %defattr(644,root,root,755)
492 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
493 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
494 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
495 %ghost %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php
496 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/.htaccess
497 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/maintenance.inc.php
498 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php.example
503 %defattr(644,root,root,755)
504 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
505 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
506 %attr(754,root,root) /etc/rc.d/init.d/zabbix_proxy
507 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
508 %{_mandir}/man8/zabbix_proxy*
513 %defattr(644,root,root,755)
514 %attr(755,root,root) %{_sbindir}/zabbix_proxy-mysql
518 %files proxy-postgresql
519 %defattr(644,root,root,755)
520 %attr(755,root,root) %{_sbindir}/zabbix_proxy-postgresql
525 %defattr(644,root,root,755)
526 %attr(755,root,root) %{_sbindir}/zabbix_proxy-sqlite3
532 %defattr(644,root,root,755)
533 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
534 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
535 %attr(754,root,root) /etc/rc.d/init.d/zabbix_server
536 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
537 %{_mandir}/man8/zabbix_server*
542 %defattr(644,root,root,755)
543 %doc database/mysql/*.sql
544 %attr(755,root,root) %{_sbindir}/zabbix_server-mysql
548 %files server-postgresql
549 %defattr(644,root,root,755)
550 %doc database/postgresql/*.sql
551 %attr(755,root,root) %{_sbindir}/zabbix_server-postgresql
556 %defattr(644,root,root,755)
557 %attr(755,root,root) %{_sbindir}/zabbix_java-start
558 %attr(755,root,root) %{_sbindir}/zabbix_java-stop
559 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_java.conf
560 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback.xml
561 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback-console.xml
562 %dir %{_datadir}/zabbix_java
563 %{_datadir}/zabbix_java/bin
564 %{_datadir}/zabbix_java/lib
565 %{_datadir}/zabbix_java/settings.sh
566 %attr(755,root,root) %{_datadir}/zabbix_java/shutdown.sh
567 %attr(755,root,root) %{_datadir}/zabbix_java/startup.sh