]> git.pld-linux.org Git - packages/nagios.git/blame - nagios.spec
- time to move on... default charset utf8
[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
6a23b6a5 12Release: 3
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
9005b572
ER
22Source5: %{name}-config-20090908.tar.bz2
23# Source5-md5: 0ddb5a424c5618278ac6103f914b1f26
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
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
e785f9d9 195sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE6} > 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}
a937d63b 239install 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
3f16fe73 247install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
156a07c5
ER
248install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
249install %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}
250
251# install templated configuration files
fdea6415
ER
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
c0350ebc 255
31f3ed2f 256# webserver files
078e0b6e
ER
257install apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
258install apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
e785f9d9 259install lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
744a134f 260cp -a sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
31f3ed2f
ER
261> $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
262echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
156a07c5 263
fdea6415 264# install event handlers, sample config
4a5ea7ae 265install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
156a07c5 266cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
fdea6415
ER
267cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
268find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
156a07c5
ER
269
270# Object data/cache files
19cc8e59 271for i in {objects.{cache,precache},{comments,downtime,retention,status}.dat,nagios.tmp}; do
156a07c5 272 > $RPM_BUILD_ROOT%{_localstatedir}/$i
b0a1a45f 273done
156a07c5 274> $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
e58661fb 275
1b3d1540
TO
276%clean
277rm -rf $RPM_BUILD_ROOT
278
1b3d1540 279%post
19cc8e59 280for i in %{_localstatedir}/{objects.{cache,precache},{comments,downtime,retention,status}.dat}; do
156a07c5
ER
281 [ ! -f $i ] && touch $i
282 chown root:nagios $i
283 chmod 664 $i
284done
285
fe2307cb 286/sbin/chkconfig --add %{name}
09b7a682 287%service %{name} restart "Nagios service"
fe2307cb 288
1b3d1540
TO
289%preun
290if [ "$1" = "0" ] ; then
fe2307cb 291 %service %{name} stop
1b3d1540
TO
292 /sbin/chkconfig --del %{name}
293fi
294
901d97df 295%pre common
7970ec44 296# rename group netsaint -> nagios
15281e6a 297if [ "`getgid netsaint 2>/dev/null`" = "72" ]; then
901d97df
ER
298 /usr/sbin/groupmod -n nagios netsaint
299fi
7970ec44
ER
300# rename group nagios-data -> nagcmd
301if [ "`getgid nagios-data 2>/dev/null`" = "147" ]; then
302 /usr/sbin/groupmod -n nagcmd nagios-data
303fi
901d97df 304%groupadd -g 72 nagios
7970ec44 305%groupadd -g 147 -f nagcmd
901d97df 306if [ -n "`id -u netsaint 2>/dev/null`" ] && [ "`id -u netsaint`" = "72" ]; then
7970ec44 307 /usr/sbin/usermod -d %{_libdir}/nagios -l nagios -c "Nagios Daemon" -G nagcmd netsaint
901d97df 308fi
7970ec44 309%useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
901d97df
ER
310
311%postun common
4b3055f2 312if [ "$1" = "0" ]; then
56d92939 313 %userremove nagios
314 %groupremove nagios
7970ec44 315 %groupremove nagcmd
4b3055f2 316fi
317
7441a39b 318%post cgi
156a07c5
ER
319if [ "$1" = 1 ]; then
320%banner %{name} -e <<EOF
321NOTE:
31f3ed2f 322You need to add user to %{_webapps}/%{_webapp}/passwd and
fe2307cb 323%{_webapps}/%{_webapp}/group to access Nagios via web.
156a07c5
ER
324
325EOF
326fi
327
91b73a43 328%triggerin cgi -- apache1 < 1.3.37-3, apache1-base
7970ec44 329%addusertogroup http nagcmd
31f3ed2f 330%webapp_register apache %{_webapp}
26c807b6 331
91b73a43 332%triggerun cgi -- apache1 < 1.3.37-3, apache1-base
31f3ed2f 333%webapp_unregister apache %{_webapp}
26c807b6 334
44abff38 335%triggerin cgi -- apache < 2.2.0, apache-base
7970ec44 336%addusertogroup http nagcmd
31f3ed2f 337%webapp_register httpd %{_webapp}
26c807b6 338
44abff38 339%triggerun cgi -- apache < 2.2.0, apache-base
31f3ed2f 340%webapp_unregister httpd %{_webapp}
156a07c5 341
e785f9d9 342%triggerin cgi -- lighttpd
7970ec44 343%addusertogroup lighttpd nagcmd
e785f9d9
ER
344%webapp_register lighttpd %{_webapp}
345
346%triggerun cgi -- lighttpd
347%webapp_unregister lighttpd %{_webapp}
348
156a07c5
ER
349%triggerpostun -- nagios-cgi < 2.0-0.b3.21
350chown root:http %{_sysconfdir}/cgi.cfg
351
e56088ed 352%triggerpostun -- nagios < 3.1.2-4
fdea6415 353# restore lost files
53326298 354for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
fdea6415
ER
355 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
356 mv -f %{_sysconfdir}/$a{.rpmsave,}
31f3ed2f
ER
357 fi
358done
e56088ed 359%{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/nagios.cfg
31f3ed2f 360
1b3d1540
TO
361%files
362%defattr(644,root,root,755)
156a07c5 363%doc Changelog README* UPGRADING INSTALLING LICENSE
7970ec44 364%attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nagios.cfg
156a07c5 365%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/[!n]*.cfg
156a07c5 366
3f16fe73 367%attr(754,root,root) /etc/rc.d/init.d/%{name}
156a07c5
ER
368%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
369
e1f9e4d5 370%attr(755,root,root) %{_bindir}/%{name}
156a07c5
ER
371%attr(755,root,root) %{_bindir}/nagiostats
372
7970ec44
ER
373%attr(770,root,nagcmd) %dir %{_var}/log/%{name}
374%attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
156a07c5 375
7970ec44
ER
376%attr(770,root,nagcmd) %dir %{_localstatedir}
377%attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
378%attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/nagios.cmd
3e125558 379%attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
19cc8e59 380%attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
3e125558
ER
381%attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
382%attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
156a07c5 383
3d336594 384%dir %{_var}/spool
f57d3787 385%attr(770,root,nagios) %dir %{_var}/spool/%{name}
e56088ed 386%attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
3d336594 387
156a07c5
ER
388%{_examplesdir}/%{name}-%{version}
389
901d97df
ER
390%files common
391%defattr(644,root,root,755)
7970ec44 392%attr(750,root,nagcmd) %dir %{_sysconfdir}
3e125558 393%attr(2750,root,nagios) %dir %{_sysconfdir}/plugins
fdea6415 394%attr(2750,root,nagios) %dir %{_sysconfdir}/objects
901d97df
ER
395%dir %{_libdir}/%{name}
396%dir %{_libdir}/%{name}/plugins
156a07c5 397%dir %{_libdir}/%{name}/eventhandlers
1b3d1540 398
4a5ea7ae
ER
399%if "%{_lib}" != "lib"
400%dir %{_prefix}/lib/%{name}
401%dir %{_prefix}/lib/%{name}/plugins
402%dir %{_prefix}/lib/%{name}/eventhandlers
403%endif
404
1b3d1540
TO
405%files cgi
406%defattr(644,root,root,755)
31f3ed2f
ER
407%dir %attr(750,root,http) %{_webapps}/%{_webapp}
408%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
409%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
e785f9d9 410%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
31f3ed2f
ER
411%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
412%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
413%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
156a07c5
ER
414%dir %{_sbindir}
415%attr(755,root,root) %{_sbindir}/*.cgi
20145354
ER
416
417%dir %{_datadir}
37af85b3 418%dir %{_datadir}/includes
73072fcf
ER
419%dir %{_datadir}/images
420%dir %{_datadir}/stylesheets
20145354
ER
421%{_datadir}/favicon.ico
422%{_datadir}/robots.txt
73072fcf
ER
423%{_datadir}/contexthelp
424%{_datadir}/docs
425%{_datadir}/media
426%{_datadir}/ssi
20145354
ER
427
428%files theme-default
429%defattr(644,root,root,755)
37af85b3
AM
430%{_datadir}/*.php
431%{_datadir}/includes/*
73072fcf
ER
432%{_datadir}/images/*
433%{_datadir}/stylesheets/*
1b3d1540
TO
434
435%files devel
436%defattr(644,root,root,755)
437%dir %{_includedir}/%{name}
438%{_includedir}/%{name}/*.h
This page took 0.140171 seconds and 4 git commands to generate.