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