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