]> git.pld-linux.org Git - packages/nagios.git/blame - nagios.spec
- make /var/spool/nagios writable for nagios; 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
37af85b3 11Version: 3.1.2
f57d3787 12Release: 6
0cf1a114 13License: GPL v2
1b3d1540 14Group: Networking
98d19e90 15Source0: http://dl.sourceforge.net/nagios/%{name}-%{version}.tar.gz
37af85b3 16# Source0-md5: f3c60428cba14264c709749182b8d93e
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
fdea6415
ER
22Source5: %{name}-config-20090803.tar.bz2
23# Source5-md5: e4c42ebadecef32cfe14cc3085f5bae4
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}
f40d513a 44Requires: /bin/mail
c956dc9f 45Requires: nagios-notify >= 0.13
d4363d96
ER
46Requires: rc-scripts
47Requires: sh-utils
f0724323 48Provides: nagios-core
1b3d1540 49Obsoletes: netsaint
d4363d96 50Conflicts: iputils-ping < 1:ss020124
56d92939 51BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
1b3d1540 52
e1f9e4d5
JB
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}
31f3ed2f
ER
58%define _webapps /etc/webapps
59%define _webapp %{name}
a9824b3a 60
1b3d1540
TO
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
0cf1a114
TO
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.
1b3d1540
TO
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
924840b9
TO
73Nagios is successor to NetSaint.
74
eb034f05
JR
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.
1b3d1540 82
eb034f05
JR
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.
1b3d1540 86
eb034f05 87Nagios jest następcą NetSainta.
924840b9 88
eb034f05
JR
89%description -l pt_BR.UTF-8
90O Nagios é um programa que monitora máquinas e serviços na sua rede.
1b3d1540 91Ele pode enviar um email ou um aviso de pager para o administrador
eb034f05 92quando surgir um problema e quando ele for resolvido. Nagios é escrito
0cf1a114 93em C e foi desenvolvido para rodar em plataformas Linux (e algumas
eb034f05
JR
94variações de *NIX) como um processo em segundo plano, periodicamente
95executando checagens nos diversos serviços que forem especificados.
1b3d1540 96
901d97df
ER
97%package common
98Summary: Common files needed by both nagios and nrpe
a02dfee5 99Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
901d97df 100Group: Networking
d4363d96
ER
101Requires(postun): /usr/sbin/groupdel
102Requires(postun): /usr/sbin/userdel
901d97df 103Requires(pre): /bin/id
d4363d96 104Requires(pre): /usr/bin/getgid
901d97df
ER
105Requires(pre): /usr/sbin/groupadd
106Requires(pre): /usr/sbin/groupmod
107Requires(pre): /usr/sbin/useradd
108Requires(pre): /usr/sbin/usermod
901d97df
ER
109Provides: group(nagios)
110Provides: group(nagios-data)
d4363d96 111Provides: user(nagios)
901d97df
ER
112
113%description common
114Common files needed by both nagios and nrpe.
115
eb034f05
JR
116%description common -l pl.UTF-8
117Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
bee7c8ea 118
1b3d1540
TO
119%package cgi
120Summary: CGI webinterface for Nagios
a02dfee5 121Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
7c33b67a 122Group: Applications/WWW
31f3ed2f 123# for dirs... and accessing local logs.
4a3af0fb 124Requires: %{name} = %{version}-%{release}
1bbdd399 125Requires: %{name}-imagepaks
20145354 126Requires: %{name}-theme
156a07c5 127Requires: group(http)
d4363d96 128Requires: webapps
e785f9d9 129Requires: webserver
111ce231 130Requires: webserver(access)
e785f9d9
ER
131Requires: webserver(alias)
132Requires: webserver(auth)
133Requires: webserver(cgi)
134Requires: webserver(indexfile)
1b3d1540
TO
135
136%description cgi
0964d76f
JB
137CGI webinterface for Nagios.
138
eb034f05 139%description cgi -l pl.UTF-8
0964d76f 140Interfejs CGI dla Nagiosa.
1b3d1540 141
20145354
ER
142%package theme-default
143Summary: Default Nagios theme
a02dfee5 144Summary(pl.UTF-8): Domyślny motyw Nagiosa
7c33b67a 145Group: Applications/WWW
73072fcf 146Requires: nagios-cgi = %{version}-%{release}
fdea6415 147Requires: webserver(php)
60238ce7
JB
148Provides: nagios-theme
149Obsoletes: nagios-theme
20145354
ER
150
151%description theme-default
152Original theme from Nagios.
153
eb034f05 154%description theme-default -l pl.UTF-8
60238ce7
JB
155Oryginalny motyw z Nagiosa.
156
1b3d1540 157%package devel
e5fcc454 158Summary: Include files that Nagios-related applications may compile against
a02dfee5
ER
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
1b3d1540 161Group: Development/Libraries
e1f9e4d5 162# doesn't require base
1b3d1540
TO
163
164%description devel
e5fcc454 165This package provides include files that Nagios-related applications
1b3d1540
TO
166may compile against.
167
eb034f05
JR
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.
1b3d1540 171
eb034f05
JR
172%description devel -l pt_BR.UTF-8
173Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
1b3d1540
TO
174aplicativos para o Nagios.
175
176%prep
fdea6415 177%setup -q -a5
b24b4667
ER
178%patch0 -p0
179%patch1 -p1
4a3af0fb 180%patch2 -p1
f29ace4f 181%patch3 -p1
d39e610a 182%patch4 -p1
744a134f 183%patch5 -p1
156a07c5 184
fdea6415
ER
185find -name .cvsignore | xargs rm
186
187mv nagios-config-*/objects/*.cfg sample-config/template-object
188mv nagios-config-*/*.cfg sample-config
189
156a07c5
ER
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)
1b3d1540 194
078e0b6e 195sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
e785f9d9 196sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE6} > lighttpd.conf
078e0b6e 197
744a134f
ER
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
4af19791 206' sample-config/*.cfg.in
744a134f 207
1b3d1540 208%build
156a07c5 209cp -f /usr/share/automake/config.sub .
a9824b3a
TO
210%{__aclocal}
211%{__autoconf}
212%configure \
37af85b3 213 --datarootdir=%{_datadir} \
1b3d1540
TO
214 --with-nagios-user=%{name} \
215 --with-nagios-grp=%{name} \
156a07c5
ER
216 --with-command-user=%{name} \
217 --with-command-grp=%{name} \
218 --with-lockfile=%{_localstatedir}/%{name}.pid \
e56088ed 219 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
0964d76f 220 --with-ping_command='/bin/ping -n %%s -c %%d' \
8c8f3904
AM
221 %{!?with_gd:--disable-statusmap --disable-trends} \
222 %{?with_tests:--enable-libtap} \
223 --enable-event-broker
1b3d1540
TO
224
225%{__make} all
226
8c8f3904
AM
227%{?with_tests:%{__make} test}
228
1b3d1540
TO
229%install
230rm -rf $RPM_BUILD_ROOT
4a5ea7ae
ER
231install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
232 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
fdea6415 233 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
4a5ea7ae
ER
234 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins} \
235%if "%{_lib}" != "lib"
236 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
237%endif
1b3d1540 238
4a5ea7ae 239install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
a937d63b 240install include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
1b3d1540 241
aca04140 242%{__make} install-unstripped \
1b3d1540
TO
243 DESTDIR=$RPM_BUILD_ROOT \
244 INSTALL_OPTS="" \
245 INIT_OPTS="" \
246 COMMAND_OPTS=""
247
3f16fe73 248install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
156a07c5
ER
249install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
250install %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}
251
252# install templated configuration files
fdea6415
ER
253for a in nagios.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
254 cp -a sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
255done
c0350ebc 256
31f3ed2f 257# webserver files
078e0b6e
ER
258install apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
259install apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
e785f9d9 260install lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
744a134f 261cp -a sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
31f3ed2f
ER
262> $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
263echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
156a07c5 264
fdea6415 265# install event handlers, sample config
4a5ea7ae 266install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
156a07c5 267cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
fdea6415
ER
268cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
269find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
156a07c5
ER
270
271# Object data/cache files
19cc8e59 272for i in {objects.{cache,precache},{comments,downtime,retention,status}.dat,nagios.tmp}; do
156a07c5 273 > $RPM_BUILD_ROOT%{_localstatedir}/$i
b0a1a45f 274done
156a07c5 275> $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
e58661fb 276
1b3d1540
TO
277%clean
278rm -rf $RPM_BUILD_ROOT
279
1b3d1540 280%post
19cc8e59 281for i in %{_localstatedir}/{objects.{cache,precache},{comments,downtime,retention,status}.dat}; do
156a07c5
ER
282 [ ! -f $i ] && touch $i
283 chown root:nagios $i
284 chmod 664 $i
285done
286
fe2307cb 287/sbin/chkconfig --add %{name}
09b7a682 288%service %{name} restart "Nagios service"
fe2307cb 289
1b3d1540
TO
290%preun
291if [ "$1" = "0" ] ; then
fe2307cb 292 %service %{name} stop
1b3d1540
TO
293 /sbin/chkconfig --del %{name}
294fi
295
901d97df 296%pre common
15281e6a 297if [ "`getgid netsaint 2>/dev/null`" = "72" ]; then
901d97df
ER
298 /usr/sbin/groupmod -n nagios netsaint
299fi
300%groupadd -g 72 nagios
301%groupadd -g 147 -f nagios-data
302if [ -n "`id -u netsaint 2>/dev/null`" ] && [ "`id -u netsaint`" = "72" ]; then
3615cee8 303 /usr/sbin/usermod -d %{_libdir}/nagios -l nagios -c "Nagios Daemon" -G nagios-data netsaint
901d97df 304fi
3615cee8 305%useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "Nagios Daemon" -g nagios -G nagios-data nagios
901d97df
ER
306
307%postun common
4b3055f2 308if [ "$1" = "0" ]; then
56d92939 309 %userremove nagios
310 %groupremove nagios
156a07c5 311 %groupremove nagios-data
4b3055f2 312fi
313
7441a39b 314%post cgi
156a07c5
ER
315if [ "$1" = 1 ]; then
316%banner %{name} -e <<EOF
317NOTE:
31f3ed2f 318You need to add user to %{_webapps}/%{_webapp}/passwd and
fe2307cb 319%{_webapps}/%{_webapp}/group to access Nagios via web.
156a07c5
ER
320
321EOF
322fi
323
91b73a43 324%triggerin cgi -- apache1 < 1.3.37-3, apache1-base
a0abc943 325%addusertogroup http nagios-data
31f3ed2f 326%webapp_register apache %{_webapp}
26c807b6 327
91b73a43 328%triggerun cgi -- apache1 < 1.3.37-3, apache1-base
31f3ed2f 329%webapp_unregister apache %{_webapp}
26c807b6 330
44abff38 331%triggerin cgi -- apache < 2.2.0, apache-base
a0abc943 332%addusertogroup http nagios-data
31f3ed2f 333%webapp_register httpd %{_webapp}
26c807b6 334
44abff38 335%triggerun cgi -- apache < 2.2.0, apache-base
31f3ed2f 336%webapp_unregister httpd %{_webapp}
156a07c5 337
e785f9d9
ER
338%triggerin cgi -- lighttpd
339%addusertogroup lighttpd nagios-data
340%webapp_register lighttpd %{_webapp}
341
342%triggerun cgi -- lighttpd
343%webapp_unregister lighttpd %{_webapp}
344
156a07c5
ER
345%triggerpostun -- nagios-cgi < 2.0-0.b3.21
346chown root:http %{_sysconfdir}/cgi.cfg
347
e56088ed 348%triggerpostun -- nagios < 3.1.2-4
fdea6415 349# restore lost files
53326298 350for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
fdea6415
ER
351 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
352 mv -f %{_sysconfdir}/$a{.rpmsave,}
31f3ed2f
ER
353 fi
354done
e56088ed 355%{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/nagios.cfg
31f3ed2f 356
1b3d1540
TO
357%files
358%defattr(644,root,root,755)
156a07c5 359%doc Changelog README* UPGRADING INSTALLING LICENSE
156a07c5
ER
360%attr(640,root,nagios-data) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nagios.cfg
361%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/[!n]*.cfg
156a07c5 362
3f16fe73 363%attr(754,root,root) /etc/rc.d/init.d/%{name}
156a07c5
ER
364%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
365
e1f9e4d5 366%attr(755,root,root) %{_bindir}/%{name}
156a07c5
ER
367%attr(755,root,root) %{_bindir}/nagiostats
368
cccd1837 369%attr(770,root,nagios-data) %dir %{_var}/log/%{name}
156a07c5
ER
370%attr(770,root,nagios-data) %dir %{_var}/log/%{name}/archives
371
372%attr(770,root,nagios-data) %dir %{_localstatedir}
373%attr(2770,root,nagios-data) %dir %{_localstatedir}/rw
3e125558
ER
374%attr(660,nagios,nagios-data) %ghost %{_localstatedir}/rw/nagios.cmd
375%attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
19cc8e59 376%attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
3e125558
ER
377%attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
378%attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
156a07c5 379
3d336594 380%dir %{_var}/spool
f57d3787 381%attr(770,root,nagios) %dir %{_var}/spool/%{name}
e56088ed 382%attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
3d336594 383
156a07c5
ER
384%{_examplesdir}/%{name}-%{version}
385
901d97df
ER
386%files common
387%defattr(644,root,root,755)
388%attr(750,root,nagios-data) %dir %{_sysconfdir}
3e125558 389%attr(2750,root,nagios) %dir %{_sysconfdir}/plugins
fdea6415 390%attr(2750,root,nagios) %dir %{_sysconfdir}/objects
901d97df
ER
391%dir %{_libdir}/%{name}
392%dir %{_libdir}/%{name}/plugins
156a07c5 393%dir %{_libdir}/%{name}/eventhandlers
1b3d1540 394
4a5ea7ae
ER
395%if "%{_lib}" != "lib"
396%dir %{_prefix}/lib/%{name}
397%dir %{_prefix}/lib/%{name}/plugins
398%dir %{_prefix}/lib/%{name}/eventhandlers
399%endif
400
1b3d1540
TO
401%files cgi
402%defattr(644,root,root,755)
31f3ed2f
ER
403%dir %attr(750,root,http) %{_webapps}/%{_webapp}
404%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
405%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
e785f9d9 406%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
31f3ed2f
ER
407%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
408%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
409%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
156a07c5
ER
410%dir %{_sbindir}
411%attr(755,root,root) %{_sbindir}/*.cgi
20145354
ER
412
413%dir %{_datadir}
37af85b3 414%dir %{_datadir}/includes
73072fcf
ER
415%dir %{_datadir}/images
416%dir %{_datadir}/stylesheets
20145354
ER
417%{_datadir}/favicon.ico
418%{_datadir}/robots.txt
73072fcf
ER
419%{_datadir}/contexthelp
420%{_datadir}/docs
421%{_datadir}/media
422%{_datadir}/ssi
20145354
ER
423
424%files theme-default
425%defattr(644,root,root,755)
37af85b3
AM
426%{_datadir}/*.php
427%{_datadir}/includes/*
73072fcf
ER
428%{_datadir}/images/*
429%{_datadir}/stylesheets/*
1b3d1540
TO
430
431%files devel
432%defattr(644,root,root,755)
433%dir %{_includedir}/%{name}
434%{_includedir}/%{name}/*.h
This page took 0.617836 seconds and 4 git commands to generate.