]> git.pld-linux.org Git - packages/nagios.git/blob - nagios.spec
- move docs to standalone -doc package
[packages/nagios.git] / nagios.spec
1 #
2 # Conditional build:
3 %bcond_without  gd      # without statusmap and trends, which require gd library
4 # reeenable when http://tracker.nagios.org/view.php?id=51 is fixed
5 %bcond_with     tests
6 #
7 Summary:        Host/service/network monitoring program
8 Summary(pl.UTF-8):      Program do monitorowania serwerów/usług/sieci
9 Summary(pt_BR.UTF-8):   Programa para monitoração de máquinas e serviços
10 Name:           nagios
11 Version:        3.2.1
12 Release:        1
13 License:        GPL v2
14 Group:          Networking
15 Source0:        http://downloads.sourceforge.net/nagios/%{name}-%{version}.tar.gz
16 # Source0-md5:  d4655ee8c95c9679fd4fd53dac34bbe3
17 Source1:        %{name}-apache.conf
18 Source2:        %{name}.init
19 Source3:        %{name}.sysconfig
20 Source4:        %{name}-config-20090914.tar.bz2
21 # Source4-md5:  605f1cd28c00db961dad6f529d849f16
22 Source5:        %{name}-lighttpd.conf
23 Source6:        http://www.google.com/mapfiles/shadow50.png
24 # Source6-md5:  eff99f302f21b95a900d321743fce72b
25 Source7:        http://www.google.com/mapfiles/marker.png
26 # Source7-md5:  edefef4bdfc29e1c953694651f05b466
27 Source8:        googlemap.js
28 Patch0:         %{name}-resources.patch
29 Patch1:         %{name}-iconv-in-libc.patch
30 Patch2:         %{name}-webapps.patch
31 Patch3:         %{name}-cgi-http_charset.patch
32 Patch4:         %{name}-cmd-typo.patch
33 Patch5:         config.patch
34 Patch6:         %{name}-googlemap.patch
35 URL:            http://www.nagios.org/
36 BuildRequires:  autoconf
37 BuildRequires:  automake
38 %if %{with gd}
39 BuildRequires:  gd-devel
40 BuildRequires:  libjpeg-devel
41 BuildRequires:  libpng-devel
42 %endif
43 BuildRequires:  rpmbuild(macros) >= 1.268
44 BuildRequires:  sed >= 4.0
45 Requires(post,preun):   /sbin/chkconfig
46 Requires:       %{name}-common = %{version}-%{release}
47 Requires:       rc-scripts
48 Requires:       sh-utils
49 Suggests:       nagios-notify >= 0.13
50 Suggests:       nagios-plugin-check_load
51 Suggests:       nagios-plugin-check_ping
52 Suggests:       nagios-plugins
53 Provides:       nagios-core
54 Obsoletes:      netsaint
55 Conflicts:      iputils-ping < 1:ss020124
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 %define         _sysconfdir     /etc/%{name}
59 %define         _bindir         %{_prefix}/sbin
60 %define         _sbindir        %{_libdir}/%{name}/cgi
61 %define         _datadir        %{_prefix}/share/%{name}
62 %define         _localstatedir  /var/lib/%{name}
63 %define         _webapps        /etc/webapps
64 %define         _webapp         %{name}
65
66 %description
67 Nagios is a program that will monitor hosts and services on your
68 network. It has the ability to email or page you when a problem arises
69 and when a problem is resolved. Nagios is written in C and is designed
70 to run under Linux (and some other *NIX variants) as a background
71 process, intermittently running checks on various services that you
72 specify.
73
74 The actual service checks are performed by separate "plugin" programs
75 which return the status of the checks to Nagios. The plugins are
76 available in nagios-plugins packages.
77
78 Nagios is successor to NetSaint.
79
80 %description -l pl.UTF-8
81 Nagios to program, który monitoruje serwery oraz usługi w naszej
82 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
83 rozwiązaniu problemu. Nagios został napisany w C oraz jest
84 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
85 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
86 sprawdzające.
87
88 Właściwe sprawdzanie jest wykonywane przez osobne programy
89 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
90 są dostępne na stronie w pakietach nagios-plugins.
91
92 Nagios jest następcą NetSainta.
93
94 %description -l pt_BR.UTF-8
95 O Nagios é um programa que monitora máquinas e serviços na sua rede.
96 Ele pode enviar um email ou um aviso de pager para o administrador
97 quando surgir um problema e quando ele for resolvido. Nagios é escrito
98 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
99 variações de *NIX) como um processo em segundo plano, periodicamente
100 executando checagens nos diversos serviços que forem especificados.
101
102 %package common
103 Summary:        Common files needed by both nagios and nrpe
104 Summary(pl.UTF-8):      Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
105 Group:          Networking
106 Requires(postun):       /usr/sbin/groupdel
107 Requires(postun):       /usr/sbin/userdel
108 Requires(pre):  /bin/id
109 Requires(pre):  /usr/bin/getgid
110 Requires(pre):  /usr/sbin/groupadd
111 Requires(pre):  /usr/sbin/groupmod
112 Requires(pre):  /usr/sbin/useradd
113 Requires(pre):  /usr/sbin/usermod
114 Provides:       group(nagcmd)
115 Provides:       group(nagios)
116 Provides:       user(nagios)
117
118 %description common
119 Common files needed by both nagios and nrpe.
120
121 %description common -l pl.UTF-8
122 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
123
124 %package cgi
125 Summary:        CGI webinterface for Nagios
126 Summary(pl.UTF-8):      Interfejs WWW/CGI dla Nagiosa
127 Group:          Applications/WWW
128 # for dirs... and accessing local logs, nagios config
129 Requires:       %{name} = %{version}-%{release}
130 Requires:       %{name}-imagepaks
131 Requires:       %{name}-theme
132 Requires:       group(http)
133 Requires:       webapps
134 Requires:       webserver
135 Requires:       webserver(access)
136 Requires:       webserver(alias)
137 Requires:       webserver(auth)
138 Requires:       webserver(cgi)
139 Requires:       webserver(indexfile)
140 Suggests:       %{name}-doc
141
142 %description cgi
143 CGI webinterface for Nagios.
144
145 %description cgi -l pl.UTF-8
146 Interfejs CGI dla Nagiosa.
147
148 %package doc
149 Summary:        HTML Documentation for Nagios
150 Group:          Documentation
151 # does not require base
152
153 %description doc
154 HTML Documentation for Nagios.
155
156 %package theme-default
157 Summary:        Default Nagios theme
158 Summary(pl.UTF-8):      Domyślny motyw Nagiosa
159 Group:          Applications/WWW
160 Requires:       nagios-cgi = %{version}-%{release}
161 Requires:       webserver(php)
162 Provides:       nagios-theme
163 Obsoletes:      nagios-theme
164
165 %description theme-default
166 Original theme from Nagios.
167
168 %description theme-default -l pl.UTF-8
169 Oryginalny motyw z Nagiosa.
170
171 %package devel
172 Summary:        Include files that Nagios-related applications may compile against
173 Summary(pl.UTF-8):      Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
174 Summary(pt_BR.UTF-8):   Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
175 Group:          Development/Libraries
176 # doesn't require base
177
178 %description devel
179 This package provides include files that Nagios-related applications
180 may compile against.
181
182 %description devel -l pl.UTF-8
183 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
184 przez aplikacje związane z nagiosem podczas kompilacji.
185
186 %description devel -l pt_BR.UTF-8
187 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
188 aplicativos para o Nagios.
189
190 %prep
191 %setup -q -a4
192 %patch0 -p0
193 %patch1 -p1
194 %patch2 -p1
195 %patch3 -p1
196 %patch4 -p1
197 %patch5 -p1
198 %patch6 -p1
199
200 find -name .cvsignore -o -name .gitignore | xargs rm
201
202 mv nagios-config-*/objects/*.cfg sample-config/template-object
203 mv nagios-config-*/*.cfg sample-config
204
205 # cleanup backups after patching
206 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
207
208 sed -i -e '
209         s,".*/var/rw/nagios.cmd,"%{_localstatedir}/rw/nagios.cmd,
210         s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
211 ' $(find contrib/eventhandlers -type f)
212
213 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
214 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
215
216 # fixup cgi config
217 %{__sed} -i -e '
218         # kill trailing spaces
219         s, \+$,,
220         # use real paths
221         s,/usr/local/nagios/share,@datadir@,g
222         # we want all authorized users have default access
223         s,=nagiosadmin,=*,g
224 ' sample-config/*.cfg.in
225
226 %build
227 cp -f /usr/share/automake/config.sub .
228 %{__aclocal}
229 %{__autoconf}
230 %configure \
231         CFLAGS="%{rpmcflags} %{rpmcppflags}" \
232         --with-nagios-user=%{name} \
233         --with-nagios-grp=%{name} \
234         --with-command-user=%{name} \
235         --with-command-grp=%{name} \
236         --with-lockfile=%{_localstatedir}/%{name}.pid \
237         --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
238         --with-ping_command='/bin/ping -n %%s -c %%d' \
239         %{!?with_gd:--disable-statusmap --disable-trends} \
240         %{?with_tests:--enable-libtap} \
241         --enable-event-broker
242
243 %{__make} all
244
245 %{?with_tests:%{__make} test}
246
247 %install
248 rm -rf $RPM_BUILD_ROOT
249 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
250         $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
251         $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
252         $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins} \
253 %if "%{_lib}" != "lib"
254         $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
255 %endif
256
257 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
258 cp -a include/*.h       $RPM_BUILD_ROOT%{_includedir}/%{name}
259
260 %{__make} install-unstripped \
261         DESTDIR=$RPM_BUILD_ROOT \
262         INSTALL_OPTS="" \
263         INIT_OPTS="" \
264         COMMAND_OPTS=""
265
266 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
267 cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
268
269 # install templated configuration files
270 for a in nagios.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
271         cp -a sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
272 done
273
274 # webserver files
275 cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
276 cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
277 cp -a lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
278 cp -a sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
279 cp -a %{SOURCE6} $RPM_BUILD_ROOT%{_datadir}/images
280 cp -a %{SOURCE7} $RPM_BUILD_ROOT%{_datadir}/images
281 cp -a %{SOURCE8} $RPM_BUILD_ROOT%{_datadir}/images
282 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
283 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
284
285 # install event handlers, sample config
286 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
287 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
288 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
289 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
290
291 # Object data/cache files
292 for i in {objects.{cache,precache},{comments,downtime,retention,status}.dat,nagios.tmp}; do
293         > $RPM_BUILD_ROOT%{_localstatedir}/$i
294 done
295 > $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
296
297 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
298 mv $RPM_BUILD_ROOT{%{_datadir}/docs/*,%{_docdir}/%{name}}
299
300 %clean
301 rm -rf $RPM_BUILD_ROOT
302
303 %post
304 for i in %{_localstatedir}/{objects.{cache,precache},{comments,downtime,retention,status}.dat}; do
305         [ ! -f $i ] && touch $i
306         chown root:nagios $i
307         chmod 664 $i
308 done
309
310 /sbin/chkconfig --add %{name}
311 %service %{name} restart "Nagios service"
312
313 %preun
314 if [ "$1" = "0" ] ; then
315         %service %{name} stop
316         /sbin/chkconfig --del %{name}
317 fi
318
319 %pre common
320 # rename group netsaint -> nagios
321 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
322         /usr/sbin/groupmod -n nagios netsaint
323 fi
324 # rename group nagios-data -> nagcmd
325 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
326         /usr/sbin/groupmod -n nagcmd nagios-data
327 fi
328 %groupadd -g 72 nagios
329 %groupadd -g 147 -f nagcmd
330 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
331         /usr/sbin/usermod -d %{_libdir}/nagios -l nagios -c "Nagios Daemon" -G nagcmd netsaint
332 fi
333 %useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
334
335 %postun common
336 if [ "$1" = "0" ]; then
337         %userremove nagios
338         %groupremove nagios
339         %groupremove nagcmd
340 fi
341
342 %post cgi
343 if [ "$1" = 1 ]; then
344 %banner %{name} -e <<EOF
345 NOTE:
346 You need to add user to %{_webapps}/%{_webapp}/passwd and
347 %{_webapps}/%{_webapp}/group to access Nagios via web.
348
349 EOF
350 fi
351
352 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
353 %addusertogroup http nagcmd
354 %webapp_register apache %{_webapp}
355
356 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
357 %webapp_unregister apache %{_webapp}
358
359 %triggerin cgi -- apache < 2.2.0, apache-base
360 %addusertogroup http nagcmd
361 %webapp_register httpd %{_webapp}
362
363 %triggerun cgi -- apache < 2.2.0, apache-base
364 %webapp_unregister httpd %{_webapp}
365
366 %triggerin cgi -- lighttpd
367 %addusertogroup lighttpd nagcmd
368 %webapp_register lighttpd %{_webapp}
369
370 %triggerun cgi -- lighttpd
371 %webapp_unregister lighttpd %{_webapp}
372
373 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
374 chown root:http %{_sysconfdir}/cgi.cfg
375
376 %triggerpostun -- nagios < 3.1.2-4
377 # restore lost files
378 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
379         if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
380                 mv -f %{_sysconfdir}/$a{.rpmsave,}
381         fi
382 done
383 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/nagios.cfg
384
385 %files
386 %defattr(644,root,root,755)
387 %doc Changelog README* UPGRADING INSTALLING LICENSE
388 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
389
390 # leave main nagios config readable for -cgi.
391 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nagios.cfg
392
393 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
394 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
395 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
396 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
397 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
398 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
399
400 %attr(754,root,root) /etc/rc.d/init.d/%{name}
401 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
402
403 %attr(755,root,root) %{_bindir}/%{name}
404 %attr(755,root,root) %{_bindir}/nagiostats
405
406 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
407 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
408
409 %attr(770,root,nagcmd) %dir %{_localstatedir}
410 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
411 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/nagios.cmd
412 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
413 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
414 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
415 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
416
417 %dir %{_var}/spool
418 %attr(770,root,nagios) %dir %{_var}/spool/%{name}
419 %attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
420
421 %{_examplesdir}/%{name}-%{version}
422
423 %files common
424 %defattr(644,root,root,755)
425 %attr(750,root,nagcmd) %dir %{_sysconfdir}
426 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
427 %dir %{_libdir}/%{name}
428 %dir %{_libdir}/%{name}/plugins
429 %dir %{_libdir}/%{name}/eventhandlers
430
431 %if "%{_lib}" != "lib"
432 %dir %{_prefix}/lib/%{name}
433 %dir %{_prefix}/lib/%{name}/plugins
434 %dir %{_prefix}/lib/%{name}/eventhandlers
435 %endif
436
437 %files doc
438 %defattr(644,root,root,755)
439 %{_docdir}/%{name}
440
441 %files cgi
442 %defattr(644,root,root,755)
443 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
444 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
445 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
446 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
447 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
448 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
449 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
450 %dir %{_sbindir}
451 %attr(755,root,root) %{_sbindir}/*.cgi
452
453 %dir %{_datadir}
454 %dir %{_datadir}/includes
455 %dir %{_datadir}/images
456 %dir %{_datadir}/stylesheets
457 %{_datadir}/robots.txt
458 %{_datadir}/contexthelp
459 %{_datadir}/media
460 %{_datadir}/ssi
461 %{_datadir}/images/favicon.ico
462 %{_datadir}/images/marker.png
463 %{_datadir}/images/shadow50.png
464
465 %files theme-default
466 %defattr(644,root,root,755)
467 %{_datadir}/*.php
468 %{_datadir}/includes/*
469 %{_datadir}/images/*
470 %exclude %{_datadir}/images/favicon.ico
471 %exclude %{_datadir}/images/marker.png
472 %exclude %{_datadir}/images/shadow50.png
473 %{_datadir}/stylesheets/*
474
475 %files devel
476 %defattr(644,root,root,755)
477 %dir %{_includedir}/%{name}
478 %{_includedir}/%{name}/*.h
This page took 0.091664 seconds and 3 git commands to generate.