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