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