2 # - initscript for zabbix-agentd, 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_pgsql:postgresql} %{?with_mysql:mysql} %{?with_sqlite3:sqlite3}
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: http://downloads.sourceforge.net/zabbix/%{name}-%{version}.tar.gz
22 # Source0-md5: 3211dd373fa3424be3ab3a0ee9c48816
23 Source1: %{name}-apache.conf
24 Source2: %{name}_server.service
25 Source3: %{name}_agentd.service
26 Source4: %{name}_proxy.service
27 Source5: %{name}_java.service
28 Source6: %{name}.tmpfiles
30 Patch1: sqlite3_dbname.patch
31 Patch2: sqlite3_dbname.patch
32 URL: http://zabbix.sourceforge.net/
33 BuildRequires: OpenIPMI-devel
34 BuildRequires: curl-devel
35 BuildRequires: iksemel-devel
36 %{?with_java:BuildRequires: jdk}
37 BuildRequires: libevent-devel
38 BuildRequires: libssh2-devel
39 BuildRequires: libxml2-devel
40 %{?with_mysql:BuildRequires: mysql-devel}
41 BuildRequires: net-snmp-devel
42 BuildRequires: openldap-devel >= 2.4.6
43 BuildRequires: openssl-devel >= 0.9.7d
44 BuildRequires: pcre-devel
45 %{?with_pgsql:BuildRequires: postgresql-devel}
46 BuildRequires: rpmbuild(macros) >= 1.671
47 %{?with_sqlite3:BuildRequires: sqlite3-devel}
48 BuildRequires: unixODBC-devel
49 Requires: %{name}-agentd = %{version}-%{release}
50 Requires: %{name}-frontend-php = %{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 Zabbiksa 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 Zabbiksa
103 Group: Networking/Utilities
104 Requires: %{name}-common = %{version}-%{release}
105 Requires: systemd-units >= 38
106 Obsoletes: zabbix-agent-inetd
107 Obsoletes: zabbix-agent-standalone
110 Zabbix agent collects data from the local system for a Zabbix server.
112 %description agentd -l pl.UTF-8
113 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
115 %package frontend-php
116 Summary: PHP frontend for Zabbix
117 Summary(pl.UTF-8): Interfejs PHP dla Zabbiksa
118 Group: Applications/WWW
119 Requires: php(bcmath)
120 Requires: php(core) >= %{php_min_version}
123 Requires: php(gettext)
125 Requires: php(mbstring)
127 Requires: php(session)
128 Requires: php(sockets)
130 Requires: php(xmlreader)
131 Requires: php(xmlwriter)
133 Requires: webserver(alias)
134 Requires: webserver(indexfile)
135 Requires: webserver(php)
138 Suggests: php(sqlite3)
140 Suggests: php(sysvsem)
143 %description frontend-php
144 This package provides web based (PHP) frontend for Zabbix.
146 %description frontend-php -l pl.UTF-8
147 Ten pakiet dostarcza napisany w PHP frontend dla Zabbiksa.
150 Summary: Program retrieving data from Zabbix agent
151 Summary(pl.UTF-8): Program odpytujÄcy agenta Zabbiksa
152 Group: Networking/Utilities
155 This package provides a program retrieving data from Zabbix agent.
157 %description get -l pl.UTF-8
158 Ten pakiet zawiera program odpytujÄcy agenta Zabbiksa.
161 Summary: Zabbix proxy
162 Summary(pl.UTF-8): Proxy do Zabbiksa
163 Group: Networking/Utilities
164 Requires: %{name}-common = %{version}-%{release}
165 Requires: systemd-units >= 38
166 Requires: zabbix-proxy(db) = %{version}-%{release}
169 This package provides the Zabbix proxy.
171 %description proxy -l pl.UTF-8
172 Ten pakiet zawiera proxy Zabbix.
175 Summary: MySQL support for Zabbix proxy
176 Summary(pl.UTF-8): Obsługa MySQL dla proxy do Zabbiksa
177 Group: Networking/Utilities
178 Provides: %{name}-proxy(db) = %{version}-%{release}
179 Obsoletes: zabbix-proxy-postgresql
180 Obsoletes: zabbix-proxy-sqlite3
182 %description proxy-mysql
183 This package provides the Zabbix proxy binary with MySQL support.
185 %description proxy-mysql -l pl.UTF-8
186 Ten pakiet zawiera proxy Zabbix z obsługą MySQL.
188 %package proxy-postgresql
189 Summary: PostgreSQL support for Zabbix proxy
190 Summary(pl.UTF-8): Obsługa PostgreSQL dla proxy do Zabbiksa
191 Group: Networking/Utilities
192 Provides: %{name}-proxy(db) = %{version}-%{release}
193 Obsoletes: zabbix-proxy-mysql
194 Obsoletes: zabbix-proxy-sqlite3
196 %description proxy-postgresql
197 This package provides the Zabbix proxy binary with PostgreSQL support.
199 %description proxy-postgresql -l pl.UTF-8
200 Ten pakiet zawiera proxy Zabbix z obsługą PostgreSQL.
202 %package proxy-sqlite3
203 Summary: SQLite 3 support for Zabbix proxy
204 Summary(pl.UTF-8): Obsługa SQLite 3 dla proxy do Zabbiksa
205 Group: Networking/Utilities
206 Provides: %{name}-proxy(db) = %{version}-%{release}
207 Obsoletes: zabbix-proxy-mysql
208 Obsoletes: zabbix-proxy-postgresql
210 %description proxy-sqlite3
211 This package provides the Zabbix proxy binary with SQLite 3 support.
213 %description proxy-sqlite3 -l pl.UTF-8
214 Ten pakiet zawiera proxy Zabbix z obsługą SQLite 3.
217 Summary: Zabbix sender
218 Summary(pl.UTF-8): Program zawiadamiający Zabbiksa
219 Group: Networking/Utilities
222 This package provides the Zabbix sender.
224 %description sender -l pl.UTF-8
225 Ten pakiet zawiera program zawiadamiający Zabbiksa.
228 Summary: Zabbix server
229 Summary(pl.UTF-8): Serwer Zabbiksa
230 Group: Networking/Utilities
231 Requires: %{name}-common = %{version}-%{release}
232 Requires: %{name}-server(db) = %{version}-%{release}
233 Requires: systemd-units >= 38
234 Obsoletes: zabbix-suckerd
235 Obsoletes: zabbix-trapper-inetd
236 Obsoletes: zabbix-trapper-standalone
239 This package provides the Zabbix server.
241 %description server -l pl.UTF-8
242 Ten pakiet zawiera serwer Zabbiksa.
244 %package server-mysql
245 Summary: MySQL support for Zabbix server
246 Summary(pl.UTF-8): Obsługa MySQL sla serwera Zabbiksa
247 Group: Networking/Utilities
248 Provides: %{name}-server(db) = %{version}-%{release}
249 Obsoletes: zabbix-server-postgresql
250 Obsoletes: zabbix-server-sqlite3
252 %description server-mysql
253 This package provides the Zabbix server binary for use with MySQL
256 %description server-mysql -l pl.UTF-8
257 Ten pakiet zawiera serwer Zabbiksa z obsługą bazy danych MySQL.
259 %package server-postgresql
260 Summary: PostgreSQL support for Zabbix server
261 Summary(pl.UTF-8): Obsługa PostgreSQL sla serwera Zabbiksa
262 Group: Networking/Utilities
263 Provides: %{name}-server(db) = %{version}-%{release}
264 Obsoletes: zabbix-server-mysql
265 Obsoletes: zabbix-server-sqlite3
267 %description server-postgresql
268 This package provides the Zabbix server binary for use with PostgreSQL
271 %description server-postgresql -l pl.UTF-8
272 Ten pakiet zawiera serwer Zabbiksa z obsługą bazy danych PostgreSQL.
275 Summary: Zabbix Java Gateway
276 Group: Networking/Utilities
277 Requires: %{name}-common = %{version}-%{release}
278 Requires: systemd-units >= 38
281 This package provides the Zabbix Java Gateway.
296 %{__enable_disable java} \
315 # keep timestamps to prevent unneccessary rebuilds
316 cp -a include/config.h include/config.h.old
317 cp -a include/stamp-h1 include/stamp-h1.old
319 for database in %{databases} ; do
326 touch --reference=include/config.h.old include/config.h
327 touch --reference=include/stamp-h1.old include/stamp-h1
329 # clean what needs rebuilding
330 for dir in src/libs/zbxdb* src/libs/zbxserver ; do
331 %{__make} -C $dir clean
334 touch include/zbxdb.h
339 -C src/zabbix_server \
340 DESTDIR=$PWD/install-${database}
342 -C src/zabbix_proxy \
343 DESTDIR=$PWD/install-${database}
345 # prepare dirs for %%doc
346 for dir in upgrades/dbpatches/* ; do
347 [ -d $dir/${database} ] || continue
348 mkdir -p install-${database}/upgrade/$(basename $dir)
349 cp -a $dir/${databases}/* install-${database}/upgrade/$(basename $dir)
354 rm -rf $RPM_BUILD_ROOT
355 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/webapps/%{_webapp},%{_appdir}} \
356 $RPM_BUILD_ROOT{/run/zabbix,/var/log/zabbix,%{systemdunitdir},%{systemdtmpfilesdir}}
359 DESTDIR=$RPM_BUILD_ROOT \
360 ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
362 for database in %{databases} ; do
363 cp -p install-$database/%{_sbindir}/zabbix_server \
364 $RPM_BUILD_ROOT%{_sbindir}/zabbix_server-$database
365 cp -p install-$database/%{_sbindir}/zabbix_proxy \
366 $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy-$database
369 if [ -n "$database" ] ; then
370 ln -sf %{_sbindir}/zabbix_server-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
371 ln -sf %{_sbindir}/zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
375 install -d $RPM_BUILD_ROOT/var/lib/zabbix
376 touch $RPM_BUILD_ROOT/var/lib/zabbix/zabbix.db
379 cp -r frontends $RPM_BUILD_ROOT%{_appdir}
381 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
382 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
384 install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_server.service
385 install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_agentd.service
386 install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_proxy.service
387 install %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_java.service
389 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/zabbix.conf
391 mv $RPM_BUILD_ROOT%{_appdir}/frontends/php/conf $RPM_BUILD_ROOT%{_sysconfdir}/frontend
392 ln -s %{_sysconfdir}/frontend $RPM_BUILD_ROOT%{_appdir}/frontends/php/conf
393 touch $RPM_BUILD_ROOT%{_sysconfdir}/frontend/zabbix.conf.php
396 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
397 ln -s %{_sysconfdir}/zabbix_java.conf $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh
398 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
399 ln -s %{_sysconfdir}/java-logback.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml
400 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
401 ln -s %{_sysconfdir}/java-logback-console.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml
403 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
406 exec %{_datadir}/zabbix_java/startup.sh "$@"
409 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-stop <<'EOF'
412 exec %{_datadir}/zabbix_java/shutdown.sh "$@"
417 rm -rf $RPM_BUILD_ROOT
419 %triggerin frontend-php -- apache1 < 1.3.37-3, apache1-base
420 %webapp_register apache %{_webapp}
422 %triggerun frontend-php -- apache1 < 1.3.37-3, apache1-base
423 %webapp_unregister apache %{_webapp}
425 %triggerin frontend-php -- apache < 2.2.0, apache-base
426 %webapp_register httpd %{_webapp}
428 %triggerun frontend-php -- apache < 2.2.0, apache-base
429 %webapp_unregister httpd %{_webapp}
432 %groupadd -g 111 zabbix
433 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
434 %addusertogroup -q zabbix proc
437 if [ "$1" = "0" ]; then
443 if [ "$1" = 1 ]; then
444 %banner -e %{name}-server <<-EOF
445 You should create database for Zabbix.
447 Running these should be fine in most cases:
448 mysqladmin create zabbix
449 zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
450 zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
451 zcat %{_docdir}/%{name}-server-mysql-%{version}/data.sql.gz | mysql zabbix
454 ln -sf %{_sbindir}/zabbix_server-mysql %{_sbindir}/zabbix_server || :
456 %post server-postgresql
457 if [ "$1" = 1 ]; then
458 %banner -e %{name}-server <<-EOF
459 You should create database for Zabbix.
461 Running these should be fine in most cases:
464 createdb -O zabbix zabbix
465 zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -u zabbix zabbix
466 zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -u zabbix zabbix
467 zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -u zabbix zabbix
470 ln -sf %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
473 %systemd_post zabbix_server.service
476 %systemd_preun zabbix_server.service
479 if [ "$1" = "0" ]; then
480 if [ -L %{_sbindir}/zabbix_server ] ; then
481 rm -f %{_sbindir}/zabbix_server || :
487 %systemd_post zabbix_agentd.service
490 %systemd_preun zabbix_agentd.service
496 ln -sf %{_sbindir}/zabbix_proxy-mysql %{_sbindir}/zabbix_proxy || :
498 %post proxy-postgresql
499 ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
502 ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
505 %systemd_post zabbix_proxy.service
508 %systemd_preun zabbix_proxy.service
514 %systemd_post zabbix_java.service
517 %systemd_preun zabbix_java.service
523 %defattr(644,root,root,755)
524 %doc AUTHORS ChangeLog README
527 %defattr(644,root,root,755)
528 %doc AUTHORS ChangeLog README
529 %attr(751,root,zabbix) %dir %{_sysconfdir}
530 %attr(751,root,http) %dir %{_sysconfdir}/frontend
532 %dir %{_appdir}/frontends
533 %dir %attr(770,root,zabbix) /run/zabbix
534 %dir %attr(775,root,zabbix) /var/log/zabbix
535 %{systemdtmpfilesdir}/zabbix.conf
538 %defattr(644,root,root,755)
539 %doc conf/zabbix_agentd/*.conf
540 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf
541 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agentd.conf.d
542 %attr(755,root,root) %{_sbindir}/zabbix_agentd
543 %{_mandir}/man8/zabbix_agentd*
544 %{systemdunitdir}/zabbix_agentd.service
547 %defattr(644,root,root,755)
548 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
549 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
550 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
551 %ghost %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/zabbix.conf.php
552 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/.htaccess
553 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/maintenance.inc.php
554 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/zabbix.conf.php.example
555 %{_appdir}/frontends/php
558 %defattr(644,root,root,755)
559 %attr(755,root,root) %{_bindir}/zabbix_get
560 %{_mandir}/man1/zabbix_get*
564 %defattr(644,root,root,755)
565 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
566 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
567 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
568 %{_mandir}/man8/zabbix_proxy*
569 %{systemdunitdir}/zabbix_proxy.service
574 %defattr(644,root,root,755)
575 %attr(755,root,root) %{_sbindir}/zabbix_proxy-mysql
579 %files proxy-postgresql
580 %defattr(644,root,root,755)
581 %attr(755,root,root) %{_sbindir}/zabbix_proxy-postgresql
586 %defattr(644,root,root,755)
587 %attr(755,root,root) %{_sbindir}/zabbix_proxy-sqlite3
591 %defattr(644,root,root,755)
592 %attr(755,root,root) %{_bindir}/zabbix_sender
593 %{_mandir}/man1/zabbix_sender*
597 %defattr(644,root,root,755)
598 %doc upgrades/dbpatches
599 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
600 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
601 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
602 %{_mandir}/man8/zabbix_server*
603 %{systemdunitdir}/zabbix_server.service
608 %defattr(644,root,root,755)
609 %doc database/mysql/*.sql install-mysql/upgrade
610 %attr(755,root,root) %{_sbindir}/zabbix_server-mysql
614 %files server-postgresql
615 %defattr(644,root,root,755)
616 %doc database/postgresql/*.sql install-postgresql/upgrade
617 %attr(755,root,root) %{_sbindir}/zabbix_server-postgresql
622 %defattr(644,root,root,755)
623 %attr(755,root,root) %{_sbindir}/zabbix_java-start
624 %attr(755,root,root) %{_sbindir}/zabbix_java-stop
625 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_java.conf
626 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback.xml
627 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback-console.xml
628 %dir %{_datadir}/zabbix_java
629 %{_datadir}/zabbix_java/bin
630 %{_datadir}/zabbix_java/lib
631 %{_datadir}/zabbix_java/settings.sh
632 %attr(755,root,root) %{_datadir}/zabbix_java/shutdown.sh
633 %attr(755,root,root) %{_datadir}/zabbix_java/startup.sh
634 %{systemdunitdir}/zabbix_java.service