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