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: %{name}-agentd = %{version}-%{release}
50 Requires: %{name}-web = %{version}-%{release}
51 Requires: %{name}-server = %{version}-%{release}
52 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
54 %define _sysconfdir /etc/%{name}
55 %define _appdir %{_datadir}/%{name}
56 %define _webapps /etc/webapps
57 %define _webapp %{name}
60 Zabbix is software that monitors numerous parameters of a network and
61 the servers on that network. It is a useful tool for monitoring the
62 health and integrity of servers. Zabbix uses a flexible notification
63 mechanism that allows users to configure email based alerts for
64 virtually any event. All monitored parameters are stored in a
65 database. Zabbix offers excellent reporting and data visualisation
66 features based on the stored data. Zabbix supports both polling and
67 trapping. All Zabbix reports and statistics, as well as configuration
68 parameters, are accessed through a web-based front end.
70 %description -l pl.UTF-8
71 Zabbix to oprogramowanie do monitorowania licznych parametrów sieci i
72 serwerów sieciowych. Jest przydatny przy monitorowaniu działania
73 serwerów. Jorzysta z elastycznego mechanizmu powiadamiania, który
74 pozwala użytkownikom konfigurować powiadamianie pocztą elektroniczną
75 dla praktycznie wszelkich zdarzeń. Monitorowane parametry są
76 przechowywane w bazie danych. W oparciu o przechowywane dane Zabbix
77 oferuje świetne raportowanie i funkcje wizualizacji. Wspiera zarówno
78 odpytywanie jak i pułapkowanie. Dostęp do wszystkich raportów i
79 statystyk Zabbixa jest możliwy poprzez interfejs oparty o WWW.
82 Summary: Common files for Zabbix monitoring software
83 Summary(pl.UTF-8): Wspólne pliki dla oprogramowania monitorującego Zabbix
84 Group: Networking/Utilities
85 Requires(postun): /usr/sbin/groupdel
86 Requires(postun): /usr/sbin/userdel
87 Requires(pre): /bin/id
88 Requires(pre): /usr/bin/getgid
89 Requires(pre): /usr/sbin/groupadd
90 Requires(pre): /usr/sbin/useradd
91 Provides: group(zabbix)
92 Provides: user(zabbix)
95 Common files for Zabbix monitoring software.
97 %description common -l pl.UTF-8
98 Wspólne pliki dla oprogramowania monitorującego Zabbix.
101 Summary: Zabbix Agent
102 Summary(pl.UTF-8): Agenta Zabbixa
103 Group: Networking/Utilities
104 Requires: %{name}-common = %{version}-%{release}
105 Obsoletes: zabbix-agent-inetd
106 Obsoletes: zabbix-agent-standalone
107 Requires(post,preun): /sbin/chkconfig
111 Zabbix agent collects data from the local system for a Zabbix server.
113 %description agentd -l pl.UTF-8
114 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
117 Summary: Web frontend for Zabbix
118 Summary(pl.UTF-8): Interfejs Web dla Zabbixa
119 Group: Applications/WWW
120 Requires: php(bcmath)
121 Requires: php(core) >= %{php_min_version}
124 Requires: php(gettext)
126 Requires: php(mbstring)
128 Requires: php(session)
129 Requires: php(sockets)
131 Requires: php(xmlreader)
132 Requires: php(xmlwriter)
134 Requires: webserver(alias)
135 Requires: webserver(indexfile)
136 Requires: webserver(php)
139 Suggests: php(sqlite3)
141 Suggests: php(sysvsem)
145 This package provides web based (PHP) frontend for Zabbix.
147 %description web -l pl.UTF-8
148 Ten pakiet dostarcza napisany w PHP frontend dla Zabbixa.
151 Summary: Zabbix proxy
152 Summary(pl.UTF-8): Proxy do Zabbixa
153 Group: Networking/Utilities
154 Requires: %{name}-common = %{version}-%{release}
155 Requires: zabbix-proxy(db) = %{version}-%{release}
158 This package provides the Zabbix proxy.
160 %description proxy -l pl.UTF-8
161 Ten pakiet zawiera proxy Zabbix.
164 Summary: MySQL support for Zabbix proxy
165 Summary(pl.UTF-8): Obsługa MySQL dla proxy do Zabbixa
166 Group: Networking/Utilities
167 Provides: %{name}-proxy(db) = %{version}-%{release}
168 Obsoletes: zabbix-proxy-postgresql
169 Obsoletes: zabbix-proxy-sqlite3
171 %description proxy-mysql
172 This package provides the Zabbix proxy binary with MySQL support.
174 %description proxy-mysql -l pl.UTF-8
175 Ten pakiet zawiera proxy Zabbix z obsługą MySQL.
177 %package proxy-postgresql
178 Summary: PostgreSQL support for Zabbix proxy
179 Summary(pl.UTF-8): Obsługa PostgreSQL dla proxy do Zabbixa
180 Group: Networking/Utilities
181 Provides: %{name}-proxy(db) = %{version}-%{release}
182 Obsoletes: zabbix-proxy-mysql
183 Obsoletes: zabbix-proxy-sqlite3
185 %description proxy-postgresql
186 This package provides the Zabbix proxy binary with PostgreSQL support.
188 %description proxy-postgresql -l pl.UTF-8
189 Ten pakiet zawiera proxy Zabbix z obsługą PostgreSQL.
191 %package proxy-sqlite3
192 Summary: SQLite 3 support for Zabbix proxy
193 Summary(pl.UTF-8): Obsługa SQLite 3 dla proxy do Zabbixa
194 Group: Networking/Utilities
195 Provides: %{name}-proxy(db) = %{version}-%{release}
196 Obsoletes: zabbix-proxy-mysql
197 Obsoletes: zabbix-proxy-postgresql
199 %description proxy-sqlite3
200 This package provides the Zabbix proxy binary with SQLite 3 support.
202 %description proxy-sqlite3 -l pl.UTF-8
203 Ten pakiet zawiera proxy Zabbix z obsługą SQLite 3.
206 Summary: Zabbix server
207 Summary(pl.UTF-8): Serwer Zabbixa
208 Group: Networking/Utilities
209 Requires: %{name}-common = %{version}-%{release}
210 Requires: %{name}-server(db) = %{version}-%{release}
211 Obsoletes: zabbix-suckerd
212 Obsoletes: zabbix-trapper-inetd
213 Obsoletes: zabbix-trapper-standalone
216 This package provides the Zabbix server.
218 %description server -l pl.UTF-8
219 Ten pakiet zawiera serwer Zabbixa.
221 %package server-mysql
222 Summary: MySQL support for Zabbix server
223 Summary(pl.UTF-8): Obsługa MySQL sla serwera Zabbixa
224 Group: Networking/Utilities
225 Provides: %{name}-server(db) = %{version}-%{release}
226 Obsoletes: zabbix-server-postgresql
227 Obsoletes: zabbix-server-sqlite3
229 %description server-mysql
230 This package provides the Zabbix server binary for use with MySQL
233 %description server-mysql -l pl.UTF-8
234 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych MySQL.
236 %package server-postgresql
237 Summary: PostgreSQL support for Zabbix server
238 Summary(pl.UTF-8): Obsługa PostgreSQL sla serwera Zabbixa
239 Group: Networking/Utilities
240 Provides: %{name}-server(db) = %{version}-%{release}
241 Obsoletes: zabbix-server-mysql
242 Obsoletes: zabbix-server-sqlite3
244 %description server-postgresql
245 This package provides the Zabbix server binary for use with PostgreSQL
248 %description server-postgresql -l pl.UTF-8
249 Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych PostgreSQL.
252 Summary: Zabbix Java Gateway
253 Group: Networking/Utilities
254 Requires: %{name}-common = %{version}-%{release}
257 This package provides the Zabbix Java Gateway.
277 %{__enable_disable java} \
296 for database in %{databases} ; do
297 if [ "$database" = "sqlite3" ] ; then
300 enable_server="--enable-server"
309 if [ "$enable_server" ] ; then
311 -C src/zabbix_server \
312 DESTDIR=$PWD/install-${database}
316 -C src/zabbix_proxy \
317 DESTDIR=$PWD/install-${database}
321 rm -rf $RPM_BUILD_ROOT
322 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d,/etc/webapps/%{_webapp},%{_appdir}} \
323 $RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix}
326 DESTDIR=$RPM_BUILD_ROOT \
327 ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
329 for database in %{databases} ; do
330 if [ "$database" != "sqlite3" ] ; then
331 cp -p install-$database/%{_sbindir}/zabbix_server \
332 $RPM_BUILD_ROOT%{_sbindir}/zabbix_server-$database
334 cp -p install-$database/%{_sbindir}/zabbix_proxy \
335 $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy-$database
338 if [ -n "$database" ] ; then
339 ln -sf %{_sbindir}/zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
340 ln -sf %{_sbindir}/zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
343 cp -r ui $RPM_BUILD_ROOT%{_appdir}
345 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
346 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
348 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
350 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
351 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
352 touch $RPM_BUILD_ROOT%{_sysconfdir}/web/zabbix.conf.php
355 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
356 ln -s %{_sysconfdir}/zabbix_java.conf $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh
357 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
358 ln -s %{_sysconfdir}/java-logback.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml
359 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
360 ln -s %{_sysconfdir}/java-logback-console.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml
362 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
365 exec %{_datadir}/zabbix_java/startup.sh "$@"
368 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-stop <<'EOF'
371 exec %{_datadir}/zabbix_java/shutdown.sh "$@"
376 rm -rf $RPM_BUILD_ROOT
378 %triggerin web -- apache < 2.2.0, apache-base
379 %webapp_register httpd %{_webapp}
381 %triggerun web -- apache < 2.2.0, apache-base
382 %webapp_unregister httpd %{_webapp}
385 %groupadd -g 111 zabbix
386 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
387 %addusertogroup -q zabbix proc
390 if [ "$1" = "0" ]; then
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:
401 mysqladmin create zabbix
402 zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
403 zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
404 zcat %{_docdir}/%{name}-server-mysql-%{version}/data.sql.gz | mysql zabbix
407 ln -sf %{_sbindir}/zabbix_server-mysql %{_sbindir}/zabbix_server || :
409 %post server-postgresql
410 if [ "$1" = 1 ]; then
411 %banner -e %{name}-server <<-EOF
412 You should create database for Zabbix.
414 Running these should be fine in most cases:
417 createdb -O zabbix zabbix
418 zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -u zabbix zabbix
419 zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -u zabbix zabbix
420 zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -u zabbix zabbix
423 ln -sf %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
426 if [ "$1" = "0" ]; then
427 if [ -L %{_sbindir}/zabbix_server ] ; then
428 rm -f %{_sbindir}/zabbix_server || :
433 /sbin/chkconfig --add zabbix_agentd
434 %service zabbix_agentd restart
437 if [ "$1" = "0" ]; then
438 %service -q zabbix_agentd stop
439 /sbin/chkconfig --del zabbix_agentd
443 ln -sf %{_sbindir}/zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
445 %post proxy-postgresql
446 ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
449 ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
452 %defattr(644,root,root,755)
453 %doc AUTHORS ChangeLog README
456 %defattr(644,root,root,755)
457 %doc AUTHORS ChangeLog README
458 %attr(755,root,root) %{_bindir}/zabbix_get
459 %attr(755,root,root) %{_bindir}/zabbix_js
460 %attr(755,root,root) %{_bindir}/zabbix_sender
461 %attr(751,root,zabbix) %dir %{_sysconfdir}
462 %attr(751,root,http) %dir %{_sysconfdir}/web
464 %dir %attr(770,root,zabbix) /var/run/zabbix
465 %dir %attr(775,root,zabbix) /var/log/zabbix
466 %{_mandir}/man1/zabbix_get*
467 %{_mandir}/man1/zabbix_sender*
470 %defattr(644,root,root,755)
471 %doc conf/zabbix_agentd/*.conf
472 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf
473 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agentd.conf.d
474 %attr(754,root,root) /etc/rc.d/init.d/zabbix_agentd
475 %attr(755,root,root) %{_sbindir}/zabbix_agentd
476 %{_mandir}/man8/zabbix_agentd*
479 %defattr(644,root,root,755)
480 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
481 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
482 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
483 %ghost %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php
484 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/.htaccess
485 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/maintenance.inc.php
486 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/web/zabbix.conf.php.example
491 %defattr(644,root,root,755)
492 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
493 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
494 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
495 %{_mandir}/man8/zabbix_proxy*
500 %defattr(644,root,root,755)
501 %attr(755,root,root) %{_sbindir}/zabbix_proxy-mysql
505 %files proxy-postgresql
506 %defattr(644,root,root,755)
507 %attr(755,root,root) %{_sbindir}/zabbix_proxy-postgresql
512 %defattr(644,root,root,755)
513 %attr(755,root,root) %{_sbindir}/zabbix_proxy-sqlite3
519 %defattr(644,root,root,755)
520 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
521 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
522 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
523 %{_mandir}/man8/zabbix_server*
528 %defattr(644,root,root,755)
529 %doc database/mysql/*.sql
530 %attr(755,root,root) %{_sbindir}/zabbix_server-mysql
534 %files server-postgresql
535 %defattr(644,root,root,755)
536 %doc database/postgresql/*.sql
537 %attr(755,root,root) %{_sbindir}/zabbix_server-postgresql
542 %defattr(644,root,root,755)
543 %attr(755,root,root) %{_sbindir}/zabbix_java-start
544 %attr(755,root,root) %{_sbindir}/zabbix_java-stop
545 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_java.conf
546 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback.xml
547 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback-console.xml
548 %dir %{_datadir}/zabbix_java
549 %{_datadir}/zabbix_java/bin
550 %{_datadir}/zabbix_java/lib
551 %{_datadir}/zabbix_java/settings.sh
552 %attr(755,root,root) %{_datadir}/zabbix_java/shutdown.sh
553 %attr(755,root,root) %{_datadir}/zabbix_java/startup.sh