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