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