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