]> git.pld-linux.org Git - packages/zabbix.git/blob - zabbix.spec
download URL changed
[packages/zabbix.git] / zabbix.spec
1 # TODO:
2 # - initscript for zabbix-agentd, zabbix-server, zabbix-proxy and zabbix-java
3 #
4 # Conditional build:
5 %bcond_with     pgsql   # enable PostgreSQL support
6 %bcond_with     oracle  # enable Oracle support
7 %bcond_with     sqlite3 # enable sqlite3 support
8 %bcond_without  mysql   # enable MySQL support
9
10 %bcond_without  java    # disable java support
11
12 %if %{with pgsql} || %{with oracle} || %{with sqlite3}
13 %undefine with_mysql
14 %endif
15
16 %if %{?with_pgsql:1}%{?with_oracle:1}%{?with_sqlite3:1}%{?with_mysql:1} != 1
17 ERROR: exactly one database must be selected
18 %endif
19
20 %define         php_min_version 5.4.0
21
22 Summary:        Zabbix - network monitoring software
23 Summary(pl.UTF-8):      Zabbix - oprogramowanie do monitorowania sieci
24 Name:           zabbix
25 Version:        3.2.0
26 Release:        0.2
27 License:        GPL v2+
28 Group:          Networking/Utilities
29 Source0:        http://downloads.sourceforge.net/zabbix/%{name}-%{version}.tar.gz
30 # Source0-md5:  e2491b482868059f251902d5f636eacb
31 Source1:        %{name}-apache.conf
32 Source2:        zabbix_server.service
33 Source3:        zabbix_agentd.service
34 Source4:        zabbix_proxy.service
35 Source5:        zabbix_java.service
36 Source6:        zabbix.tmpfiles
37 Patch0:         config.patch
38 URL:            http://zabbix.sourceforge.net/
39 BuildRequires:  OpenIPMI-devel
40 BuildRequires:  curl-devel
41 BuildRequires:  iksemel-devel
42 %{?with_java:BuildRequires:     jdk}
43 BuildRequires:  libxml2-devel
44 BuildRequires:  libssh2-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 %{?with_pgsql:BuildRequires:    postgresql-devel}
50 %{?with_sqlite3:BuildRequires:  sqlite3-devel}
51 BuildRequires:  unixODBC-devel
52 BuildRequires:  rpmbuild(macros) >= 1.671
53 Requires:       zabbix-server
54 Requires:       zabbix-agentd
55 Requires:       zabbix-frontend-php
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 %define         _sysconfdir     /etc/%{name}
59 %define         _appdir         %{_datadir}/%{name}
60 %define         _webapps        /etc/webapps
61 %define         _webapp         %{name}
62
63 %description
64 Zabbix is software that monitors numerous parameters of a network and
65 the servers on that network. It is a useful tool for monitoring
66 the health and integrity of servers. Zabbix uses a flexible
67 notification mechanism that allows users to configure email based
68 alerts for virtually any event. All monitored parameters are stored in
69 a database. Zabbix offers excellent reporting and data visualisation
70 features based on the stored data. Zabbix supports both polling and
71 trapping. All Zabbix reports and statistics, as well as configuration
72 parameters, are accessed through a web-based front end.
73
74 %description -l pl.UTF-8
75 Zabbix to oprogramowanie do monitorowania licznych parametrów sieci i
76 serwerów sieciowych. Jest przydatny przy monitorowaniu działania
77 serwerów. Jorzysta z elastycznego mechanizmu powiadamiania, który
78 pozwala użytkownikom konfigurować powiadamianie pocztą elektroniczną
79 dla praktycznie wszelkich zdarzeń. Monitorowane parametry są
80 przechowywane w bazie danych. W oparciu o przechowywane dane Zabbix
81 oferuje świetne raportowanie i funkcje wizualizacji. Wspiera zarówno
82 odpytywanie jak i pułapkowanie. Dostęp do wszystkich raportów i
83 statystyk Zabbiksa jest możliwy poprzez interfejs oparty o WWW.
84
85 %package common
86 Summary:        Common files for Zabbix monitoring software
87 Summary(pl.UTF-8):      Wspólne pliki dla oprogramowania monitorującego Zabbix
88 Group:          Networking/Utilities
89 Requires(postun):       /usr/sbin/groupdel
90 Requires(postun):       /usr/sbin/userdel
91 Requires(pre):  /bin/id
92 Requires(pre):  /usr/bin/getgid
93 Requires(pre):  /usr/sbin/groupadd
94 Requires(pre):  /usr/sbin/useradd
95 Provides:       group(zabbix)
96 Provides:       user(zabbix)
97
98 %description common
99 Common files for Zabbix monitoring software.
100
101 %description common -l pl.UTF-8
102 Wspólne pliki dla oprogramowania monitorującego Zabbix.
103
104 %package agentd
105 Summary:        Zabbix Agent
106 Summary(pl.UTF-8):      Agenta Zabbiksa
107 Group:          Networking/Utilities
108 Requires:       systemd-units >= 38
109 Requires:       %{name}-common = %{version}-%{release}
110 Obsoletes:      zabbix-agent-inetd
111 Obsoletes:      zabbix-agent-standalone
112
113 %description agentd
114 Zabbix agent collects data from the local system for a Zabbix server.
115
116 %description agentd -l pl.UTF-8
117 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
118
119 %package frontend-php
120 Summary:        PHP frontend for Zabbix
121 Summary(pl.UTF-8):      Interfejs PHP dla Zabbiksa
122 Group:          Applications/WWW
123 Requires:       php(bcmath)
124 Requires:       php(core) >= %{php_min_version}
125 Requires:       php(ctype)
126 Requires:       php(gd)
127 Requires:       php(gettext)
128 Requires:       php(mbstring)
129 Requires:       php(pcre)
130 Requires:       php(session)
131 Requires:       php(sockets)
132 Requires:       php(xml)
133 Requires:       php(xmlreader)
134 Requires:       php(xmlwriter)
135 %{?with_mysql:Requires: php(mysql)}
136 %{?with_pgsql:Requires: php(pgsql)}
137 Requires:       webapps
138 Requires:       webserver(php)
139
140 %description frontend-php
141 This package provides web based (PHP) frontend for Zabbix.
142
143 %description frontend-php -l pl.UTF-8
144 Ten pakiet dostarcza napisany w PHP frontend dla Zabbiksa.
145
146 %package get
147 Summary:        Program retrieving data from Zabbix agent
148 Summary(pl.UTF-8):      Program odpytujÄcy agenta Zabbiksa
149 Group:          Networking/Utilities
150
151 %description get
152 This package provides a program retrieving data from Zabbix agent.
153
154 %description get -l pl.UTF-8
155 Ten pakiet zawiera program odpytujÄcy agenta Zabbiksa.
156
157 %package proxy
158 Summary:        Zabbix proxy
159 Summary(pl.UTF-8):      Proxy do Zabbiksa
160 Group:          Networking/Utilities
161 Requires:       systemd-units >= 38
162 Requires:       %{name}-common = %{version}-%{release}
163
164 %description proxy
165 This package provides the Zabbix proxy.
166
167 %description proxy -l pl.UTF-8
168 Ten pakiet zawiera proxy Zabbix.
169
170 %package sender
171 Summary:        Zabbix sender
172 Summary(pl.UTF-8):      Program zawiadamiający Zabbiksa
173 Group:          Networking/Utilities
174
175 %description sender
176 This package provides the Zabbix sender.
177
178 %description sender -l pl.UTF-8
179 Ten pakiet zawiera program zawiadamiający Zabbiksa.
180
181 %package server
182 Summary:        Zabbix server
183 Summary(pl.UTF-8):      Serwer Zabbiksa
184 Group:          Networking/Utilities
185 Requires:       systemd-units >= 38
186 Requires:       %{name}-common = %{version}-%{release}
187 Obsoletes:      %{name}-suckerd
188 Obsoletes:      %{name}-trapper-inetd
189 Obsoletes:      %{name}-trapper-standalone
190
191 %description server
192 This package provides the Zabbix server.
193
194 %description server -l pl.UTF-8
195 Ten pakiet zawiera serwer Zabbiksa.
196
197 %package java
198 Summary:        Zabbix Java Gateway
199 Group:          Networking/Utilities
200 Requires:       systemd-units >= 38
201 Requires:       %{name}-common = %{version}-%{release}
202
203 %description java
204 This package provides the Zabbix Java Gateway.
205
206 %prep
207 %setup -q
208
209 %patch0 -p1
210
211 %build
212 %configure \
213         %{?with_mysql:--with-mysql} \
214         %{?with_pgsql:--with-postgresql} \
215         %{?with_oracle:--with-oracle} \
216         %{?with_sqlite3:--with-sqlite3} \
217         --enable-server \
218         --enable-agent \
219         --enable-proxy \
220         --enable-ipv6 \
221         %{__enable_disable java} \
222         --with-jabber \
223         --with-ldap \
224         --with-libcurl \
225         --with-libxml2 \
226         --with-net-snmp \
227         --with-openipmi \
228         --with-openssl \
229         --with-ssh2 \
230         --with-unixodbc
231
232 %{__make}
233
234 %install
235 rm -rf $RPM_BUILD_ROOT
236 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/webapps/%{_webapp},%{_appdir}} \
237         $RPM_BUILD_ROOT{/run/zabbix,/var/log/zabbix,%{systemdunitdir},%{tmpfilesdir}}
238
239 %{__make} install \
240         DESTDIR=$RPM_BUILD_ROOT \
241         ZJG_DEST=$RPM_BUILD_ROOT%{_datadir}/zabbix_java
242
243 cp -r frontends $RPM_BUILD_ROOT%{_appdir}
244
245 install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
246 install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
247
248 install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_server.service
249 install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_agentd.service
250 install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_proxy.service
251 install %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/zabbix_java.service
252
253 install %{SOURCE6} $RPM_BUILD_ROOT%{tmpfilesdir}/zabbix.conf
254
255 mv $RPM_BUILD_ROOT%{_appdir}/frontends/php/conf $RPM_BUILD_ROOT%{_sysconfdir}/frontend
256 ln -s %{_sysconfdir}/frontend $RPM_BUILD_ROOT%{_appdir}/frontends/php/conf
257 touch $RPM_BUILD_ROOT%{_sysconfdir}/frontend/zabbix.conf.php
258
259 %if %{with java}
260 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_java.conf
261 ln -s %{_sysconfdir}/zabbix_java.conf $RPM_BUILD_ROOT%{_datadir}/zabbix_java/settings.sh
262 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback.xml
263 ln -s %{_sysconfdir}/java-logback.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback.xml
264 mv $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml $RPM_BUILD_ROOT%{_sysconfdir}/java-logback-console.xml
265 ln -s %{_sysconfdir}/java-logback-console.xml $RPM_BUILD_ROOT%{_datadir}/zabbix_java/lib/logback-console.xml
266
267 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-start <<'EOF'
268 #!/bin/sh
269
270 exec %{_datadir}/zabbix_java/startup.sh "$@"
271 EOF
272
273 cat >$RPM_BUILD_ROOT%{_sbindir}/zabbix_java-stop <<'EOF'
274 #!/bin/sh
275
276 exec %{_datadir}/zabbix_java/shutdown.sh "$@"
277 EOF
278 %endif
279
280 %clean
281 rm -rf $RPM_BUILD_ROOT
282
283 %triggerin frontend-php -- apache1 < 1.3.37-3, apache1-base
284 %webapp_register apache %{_webapp}
285
286 %triggerun frontend-php -- apache1 < 1.3.37-3, apache1-base
287 %webapp_unregister apache %{_webapp}
288
289 %triggerin frontend-php -- apache < 2.2.0, apache-base
290 %webapp_register httpd %{_webapp}
291
292 %triggerun frontend-php -- apache < 2.2.0, apache-base
293 %webapp_unregister httpd %{_webapp}
294
295 %pre common
296 %groupadd -g 111 zabbix
297 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
298
299 %postun common
300 if [ "$1" = "0" ]; then
301         %userremove zabbix
302         %groupremove zabbix
303 fi
304
305 %post server
306 if [ "$1" = 1 ]; then
307         %banner -e %{name}-server <<-EOF
308         You should create database for Zabbix.
309 %if %{with pgsql}
310         Running these should be fine in most cases:
311         psql -c 'create database zabbix'
312         zcat %{_docdir}/%{name}-server-%{version}/postgresql/schema.sql.gz | psql zabbix
313         zcat %{_docdir}/%{name}-server-%{version}/postgresql/images.sql.gz | psql zabbix
314         zcat %{_docdir}/%{name}-server-%{version}/postgresql/data.sql.gz | psql zabbix
315 %else
316 %if %{with mysql}
317         Running these should be fine in most cases:
318         mysqladmin create zabbix
319         zcat %{_docdir}/%{name}-server-%{version}/mysql/schema.sql.gz | mysql zabbix
320         zcat %{_docdir}/%{name}-server-%{version}/mysql/images.sql.gz | mysql zabbix
321         zcat %{_docdir}/%{name}-server-%{version}/mysql/data.sql.gz | mysql zabbix
322 %else
323         Database template is available in %{_docdir}/%{name}-%{version}
324 %endif
325 %endif
326         %{?TODO:You also need zabbix-agent. install zabbix-agentd.}
327 EOF
328 fi
329 %systemd_post zabbix_server.service
330
331 %preun server
332 %systemd_preun zabbix_server.service
333
334 %postun server
335 %systemd_reload
336
337 %post agentd
338 %systemd_post zabbix_agentd.service
339
340 %preun agentd
341 %systemd_preun zabbix_agentd.service
342
343 %postun agentd
344 %systemd_reload
345
346 %post proxy
347 %systemd_post zabbix_proxy.service
348
349 %preun proxy
350 %systemd_preun zabbix_proxy.service
351
352 %postun proxy
353 %systemd_reload
354
355 %post java
356 %systemd_post zabbix_java.service
357
358 %preun java
359 %systemd_preun zabbix_java.service
360
361 %postun java
362 %systemd_reload
363
364 %files
365 %defattr(644,root,root,755)
366 %doc AUTHORS ChangeLog README
367
368 %files common
369 %defattr(644,root,root,755)
370 %doc AUTHORS ChangeLog README
371 %attr(751,root,zabbix) %dir %{_sysconfdir}
372 %attr(751,root,http) %dir %{_sysconfdir}/frontend
373 %dir %{_appdir}
374 %dir %{_appdir}/frontends
375 %dir %attr(770,root,zabbix) /run/zabbix
376 %dir %attr(775,root,zabbix) /var/log/zabbix
377
378 %files agentd
379 %defattr(644,root,root,755)
380 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf
381 %attr(755,root,root) %{_sbindir}/zabbix_agentd
382 %{_mandir}/man8/zabbix_agentd*
383 %{systemdunitdir}/zabbix_agentd.service
384
385 %files frontend-php
386 %defattr(644,root,root,755)
387 %attr(750,root,http) %dir %{_webapps}/%{_webapp}
388 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/*
389 %{_appdir}/frontends/php
390 %ghost %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/zabbix.conf.php
391 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/.htaccess
392 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/maintenance.inc.php
393 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/frontend/zabbix.conf.php.example
394
395 %files get
396 %defattr(644,root,root,755)
397 %attr(755,root,root) %{_bindir}/zabbix_get
398 %{_mandir}/man1/zabbix_get*
399
400 %files proxy
401 %defattr(644,root,root,755)
402 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
403 %attr(755,root,root) %{_sbindir}/zabbix_proxy
404 %{_mandir}/man8/zabbix_proxy*
405 %{systemdunitdir}/zabbix_proxy.service
406
407 %files sender
408 %defattr(644,root,root,755)
409 %attr(755,root,root) %{_bindir}/zabbix_sender
410 %{_mandir}/man1/zabbix_sender*
411
412 %files server
413 %defattr(644,root,root,755)
414 %doc upgrades/dbpatches
415 %if %{with mysql}
416 %doc database/mysql
417 %endif
418 %if %{with pgsql}
419 %doc database/postgresql
420 %endif
421 %if %{with oracle}
422 %doc database/oracle
423 %endif
424 %if %{with sqlite3}
425 %doc database/sqlite3
426 %endif
427 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
428 %attr(755,root,root) %{_sbindir}/zabbix_server
429 %{_mandir}/man8/zabbix_server*
430 %{systemdunitdir}/zabbix_server.service
431
432 %if %{with java}
433 %files java
434 %defattr(644,root,root,755)
435 %attr(755,root,root) %{_sbindir}/zabbix_java-start
436 %attr(755,root,root) %{_sbindir}/zabbix_java-stop
437 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_java.conf
438 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback.xml
439 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/java-logback-console.xml
440 %dir %{_datadir}/zabbix_java
441 %{_datadir}/zabbix_java/bin
442 %{_datadir}/zabbix_java/lib
443 %{_datadir}/zabbix_java/settings.sh
444 %attr(755,root,root) %{_datadir}/zabbix_java/shutdown.sh
445 %attr(755,root,root) %{_datadir}/zabbix_java/startup.sh
446 %{systemdunitdir}/zabbix_java.service
447 %endif
This page took 0.188075 seconds and 4 git commands to generate.