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