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