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 php_min_version 5.4.0
14 Summary: Zabbix - network monitoring software
15 Summary(pl.UTF-8): Zabbix - oprogramowanie do monitorowania sieci
20 Group: Networking/Utilities
21 Source0: https://cdn.zabbix.com/zabbix/sources/stable/5.0/%{name}-%{version}.tar.gz
22 # Source0-md5: e0798bb1b53ab7b451556dc34c3b1827
23 Source1: %{name}-apache.conf
24 Source2: %{name}_agentd.init
26 Patch1: sqlite3_dbname.patch
27 Patch2: always_compile_ipc.patch
28 URL: https://www.zabbix.com/
29 BuildRequires: OpenIPMI-devel
30 BuildRequires: autoconf
31 BuildRequires: automake >= 1:1.15
32 BuildRequires: curl-devel
33 #BuildRequires: iksemel-devel
34 %{?with_java:BuildRequires: jdk}
35 BuildRequires: libevent-devel
36 BuildRequires: libssh2-devel
37 BuildRequires: libtool
38 BuildRequires: libxml2-devel
39 %{?with_mysql:BuildRequires: mysql-devel}
40 BuildRequires: net-snmp-devel
41 BuildRequires: openldap-devel >= 2.4.6
42 BuildRequires: openssl-devel >= 0.9.7d
43 BuildRequires: pcre-devel
44 %{?with_pgsql:BuildRequires: postgresql-devel}
45 BuildRequires: rpmbuild(macros) >= 1.671
46 %{?with_sqlite3:BuildRequires: sqlite3-devel}
47 BuildRequires: unixODBC-devel
48 BuildRequires: zlib-devel
49 Requires(postun): /usr/sbin/groupdel
50 Requires(postun): /usr/sbin/userdel
51 Requires(pre): /bin/id
52 Requires(pre): /usr/bin/getgid
53 Requires(pre): /usr/sbin/groupadd
54 Requires(pre): /usr/sbin/useradd
55 Provides: group(zabbix)
56 Provides: user(zabbix)
57 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59 %define _sysconfdir /etc/%{name}
60 %define _appdir %{_datadir}/%{name}
61 %define _webapps /etc/webapps
62 %define _webapp %{name}
65 Zabbix is software that monitors numerous parameters of a network and
66 the servers on that network. It is a useful tool for monitoring the
67 health and integrity of servers. Zabbix uses a flexible notification
68 mechanism that allows users to configure email based alerts for
69 virtually any event. All monitored parameters are stored in a
70 database. Zabbix offers excellent reporting and data visualisation
71 features based on the stored data. Zabbix supports both polling and
72 trapping. All Zabbix reports and statistics, as well as configuration
73 parameters, are accessed through a web-based front end.
75 %description -l pl.UTF-8
76 Zabbix to oprogramowanie do monitorowania licznych parametrów sieci i
77 serwerów sieciowych. Jest przydatny przy monitorowaniu działania
78 serwerów. Jorzysta z elastycznego mechanizmu powiadamiania, który
79 pozwala użytkownikom konfigurować powiadamianie pocztą elektroniczną
80 dla praktycznie wszelkich zdarzeń. Monitorowane parametry są
81 przechowywane w bazie danych. W oparciu o przechowywane dane Zabbix
82 oferuje świetne raportowanie i funkcje wizualizacji. Wspiera zarówno
83 odpytywanie jak i pułapkowanie. Dostęp do wszystkich raportów i
84 statystyk Zabbixa jest możliwy poprzez interfejs oparty o WWW.
88 Summary(pl.UTF-8): Agenta Zabbixa
89 Group: Networking/Utilities
90 Requires: %{name} = %{version}-%{release}
91 Obsoletes: zabbix-agent-inetd
92 Obsoletes: zabbix-agent-standalone
93 Requires(post,preun): /sbin/chkconfig
97 Zabbix agent collects data from the local system for a Zabbix server.
99 %description agentd -l pl.UTF-8
100 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
103 Summary: Web frontend for Zabbix
104 Summary(pl.UTF-8): Interfejs Web dla Zabbixa
105 Group: Applications/WWW
106 Requires: php(bcmath)
107 Requires: php(core) >= %{php_min_version}
110 Requires: php(gettext)
112 Requires: php(mbstring)
114 Requires: php(session)
115 Requires: php(sockets)
117 Requires: php(xmlreader)
118 Requires: php(xmlwriter)
120 Requires: webserver(alias)
121 Requires: webserver(indexfile)
122 Requires: webserver(php)
125 Suggests: php(sqlite3)
127 Suggests: php(sysvsem)
131 This package provides web based (PHP) frontend for Zabbix.
133 %description web -l pl.UTF-8
134 Ten pakiet dostarcza napisany w PHP frontend dla Zabbixa.
137 Summary: Zabbix proxy
138 Summary(pl.UTF-8): Proxy do Zabbixa
139 Group: Networking/Utilities
140 Requires: %{name} = %{version}-%{release}
141 Requires: zabbix-proxy(db) = %{version}-%{release}
144 This package provides the Zabbix proxy.
146 %description proxy -l pl.UTF-8
147 Ten pakiet zawiera proxy Zabbix.
150 Summary: MySQL support for Zabbix proxy
151 Summary(pl.UTF-8): Obsługa MySQL dla proxy do Zabbixa
152 Group: Networking/Utilities
153 Provides: %{name}-proxy(db) = %{version}-%{release}
154 Obsoletes: zabbix-proxy-postgresql
155 Obsoletes: zabbix-proxy-sqlite3
157 %description proxy-mysql
158 This package provides the Zabbix proxy binary with MySQL support.
160 %description proxy-mysql -l pl.UTF-8
161 Ten pakiet zawiera proxy Zabbix z obsługą MySQL.
163 %package proxy-postgresql
164 Summary: PostgreSQL support for Zabbix proxy
165 Summary(pl.UTF-8): Obsługa PostgreSQL dla proxy do Zabbixa
166 Group: Networking/Utilities
167 Provides: %{name}-proxy(db) = %{version}-%{release}
168 Obsoletes: zabbix-proxy-mysql
169 Obsoletes: zabbix-proxy-sqlite3
171 %description proxy-postgresql
172 This package provides the Zabbix proxy binary with PostgreSQL support.
174 %description proxy-postgresql -l pl.UTF-8
175 Ten pakiet zawiera proxy Zabbix z obsługą PostgreSQL.
177 %package proxy-sqlite3
178 Summary: SQLite 3 support for Zabbix proxy
179 Summary(pl.UTF-8): Obsługa SQLite 3 dla proxy do Zabbixa
180 Group: Networking/Utilities
181 Provides: %{name}-proxy(db) = %{version}-%{release}
182 Obsoletes: zabbix-proxy-mysql
183 Obsoletes: zabbix-proxy-postgresql
185 %description proxy-sqlite3
186 This package provides the Zabbix proxy binary with SQLite 3 support.
188 %description proxy-sqlite3 -l pl.UTF-8
189 Ten pakiet zawiera proxy Zabbix z obsługą SQLite 3.
192 Summary: Zabbix server
193 Summary(pl.UTF-8): Serwer Zabbixa
194 Group: Networking/Utilities
195 Requires: %{name} = %{version}-%{release}
196 Requires: %{name}-server(db) = %{version}-%{release}
197 Obsoletes: zabbix-suckerd
198 Obsoletes: zabbix-trapper-inetd
199 Obsoletes: zabbix-trapper-standalone
202 This package provides the Zabbix server.
204 %description server -l pl.UTF-8
205 Ten pakiet zawiera serwer Zabbixa.
207 %package server-mysql
208 Summary: MySQL support for Zabbix server
209 Summary(pl.UTF-8): Obsługa MySQL sla serwera Zabbixa
210 Group: Networking/Utilities
211 Provides: %{name}-server(db) = %{version}-%{release}
212 Obsoletes: zabbix-server-postgresql
213 Obsoletes: zabbix-server-sqlite3
215 %description server-mysql
216 This package provides the Zabbix server binary for use with MySQL
219 %description server-mysql -l pl.UTF-8
220 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych MySQL.
222 %package server-postgresql
223 Summary: PostgreSQL support for Zabbix server
224 Summary(pl.UTF-8): Obsługa PostgreSQL sla serwera Zabbixa
225 Group: Networking/Utilities
226 Provides: %{name}-server(db) = %{version}-%{release}
227 Obsoletes: zabbix-server-mysql
228 Obsoletes: zabbix-server-sqlite3
230 %description server-postgresql
231 This package provides the Zabbix server binary for use with PostgreSQL
234 %description server-postgresql -l pl.UTF-8
235 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych PostgreSQL.
238 Summary: Zabbix Java Gateway
239 Group: Networking/Utilities
240 Requires: %{name} = %{version}-%{release}
243 This package provides the Zabbix Java Gateway.
263 %{__enable_disable java} \
282 for database in %{databases} ; do
283 if [ "$database" = "sqlite3" ] ; then
286 enable_server="--enable-server"
295 if [ "$enable_server" ] ; then
297 -C src/zabbix_server \
298 DESTDIR=$PWD/install-${database}
302 -C src/zabbix_proxy \
303 DESTDIR=$PWD/install-${database}
307 rm -rf $RPM_BUILD_ROOT
308 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d,/etc/webapps/%{_webapp},%{_appdir}} \
309 $RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix}
312 DESTDIR=$RPM_BUILD_ROOT \
313 ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
315 for database in %{databases} ; do
316 if [ "$database" != "sqlite3" ] ; then
317 cp -p install-$database/%{_sbindir}/zabbix_server \
318 $RPM_BUILD_ROOT%{_sbindir}/zabbix_server-$database
320 cp -p install-$database/%{_sbindir}/zabbix_proxy \
321 $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy-$database
324 if [ -n "$database" ] ; then
325 ln -sf %{_sbindir}/zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
326 ln -sf %{_sbindir}/zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
329 cp -r ui $RPM_BUILD_ROOT%{_appdir}
331 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
332 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
334 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
336 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
337 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
338 touch $RPM_BUILD_ROOT%{_sysconfdir}/web/zabbix.conf.php
341 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
342 ln -s %{_sysconfdir}/zabbix_java.conf $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh
343 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
344 ln -s %{_sysconfdir}/java-logback.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml
345 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
346 ln -s %{_sysconfdir}/java-logback-console.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml
348 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
351 exec %{_datadir}/zabbix_java/startup.sh "$@"
354 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-stop <<'EOF'
357 exec %{_datadir}/zabbix_java/shutdown.sh "$@"
362 rm -rf $RPM_BUILD_ROOT
364 %triggerin web -- apache < 2.2.0, apache-base
365 %webapp_register httpd %{_webapp}
367 %triggerun web -- apache < 2.2.0, apache-base
368 %webapp_unregister httpd %{_webapp}
371 %groupadd -g 111 zabbix
372 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
373 %addusertogroup -q zabbix proc
376 if [ "$1" = "0" ]; then
382 if [ "$1" = 1 ]; then
383 %banner -e %{name}-server <<-EOF
384 You should create database for Zabbix.
386 Running these should be fine in most cases:
387 mysqladmin create zabbix
388 zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
389 zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
390 zcat %{_docdir}/%{name}-server-mysql-%{version}/data.sql.gz | mysql zabbix
393 ln -sf %{_sbindir}/zabbix_server-mysql %{_sbindir}/zabbix_server || :
395 %post server-postgresql
396 if [ "$1" = 1 ]; then
397 %banner -e %{name}-server <<-EOF
398 You should create database for Zabbix.
400 Running these should be fine in most cases:
403 createdb -O zabbix zabbix
404 zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -u zabbix zabbix
405 zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -u zabbix zabbix
406 zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -u zabbix zabbix
409 ln -sf %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
412 if [ "$1" = "0" ]; then
413 if [ -L %{_sbindir}/zabbix_server ] ; then
414 rm -f %{_sbindir}/zabbix_server || :
419 /sbin/chkconfig --add zabbix_agentd
420 %service zabbix_agentd restart
423 if [ "$1" = "0" ]; then
424 %service -q zabbix_agentd stop
425 /sbin/chkconfig --del zabbix_agentd
429 ln -sf %{_sbindir}/zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
431 %post proxy-postgresql
432 ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
435 ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
438 %defattr(644,root,root,755)
439 %doc AUTHORS ChangeLog README
440 %attr(755,root,root) %{_bindir}/zabbix_get
441 %attr(755,root,root) %{_bindir}/zabbix_js
442 %attr(755,root,root) %{_bindir}/zabbix_sender
443 %attr(751,root,zabbix) %dir %{_sysconfdir}
444 %attr(751,root,http) %dir %{_sysconfdir}/web
446 %dir %attr(770,root,zabbix) /var/run/zabbix
447 %dir %attr(775,root,zabbix) /var/log/zabbix
448 %{_mandir}/man1/zabbix_get*
449 %{_mandir}/man1/zabbix_sender*
452 %defattr(644,root,root,755)
453 %doc conf/zabbix_agentd/*.conf
454 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf
455 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agentd.conf.d
456 %attr(754,root,root) /etc/rc.d/init.d/zabbix_agentd
457 %attr(755,root,root) %{_sbindir}/zabbix_agentd
458 %{_mandir}/man8/zabbix_agentd*
461 %defattr(644,root,root,755)
462 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
463 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
464 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
465 %ghost %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php
466 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/.htaccess
467 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/maintenance.inc.php
468 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php.example
473 %defattr(644,root,root,755)
474 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
475 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
476 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
477 %{_mandir}/man8/zabbix_proxy*
482 %defattr(644,root,root,755)
483 %attr(755,root,root) %{_sbindir}/zabbix_proxy-mysql
487 %files proxy-postgresql
488 %defattr(644,root,root,755)
489 %attr(755,root,root) %{_sbindir}/zabbix_proxy-postgresql
494 %defattr(644,root,root,755)
495 %attr(755,root,root) %{_sbindir}/zabbix_proxy-sqlite3
501 %defattr(644,root,root,755)
502 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
503 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
504 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
505 %{_mandir}/man8/zabbix_server*
510 %defattr(644,root,root,755)
511 %doc database/mysql/*.sql
512 %attr(755,root,root) %{_sbindir}/zabbix_server-mysql
516 %files server-postgresql
517 %defattr(644,root,root,755)
518 %doc database/postgresql/*.sql
519 %attr(755,root,root) %{_sbindir}/zabbix_server-postgresql
524 %defattr(644,root,root,755)
525 %attr(755,root,root) %{_sbindir}/zabbix_java-start
526 %attr(755,root,root) %{_sbindir}/zabbix_java-stop
527 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_java.conf
528 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback.xml
529 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback-console.xml
530 %dir %{_datadir}/zabbix_java
531 %{_datadir}/zabbix_java/bin
532 %{_datadir}/zabbix_java/lib
533 %{_datadir}/zabbix_java/settings.sh
534 %attr(755,root,root) %{_datadir}/zabbix_java/shutdown.sh
535 %attr(755,root,root) %{_datadir}/zabbix_java/startup.sh