]> git.pld-linux.org Git - packages/nagios.git/blame_incremental - nagios.spec
- fixed include install.
[packages/nagios.git] / nagios.spec
... / ...
CommitLineData
1# TODO
2# - /var/log/nagios/archives -> /var/log/archive/nagios
3#
4# Conditional build:
5%bcond_without gd # without statusmap and trends, which require gd library
6# reeenable when http://tracker.nagios.org/view.php?id=51 is fixed
7%bcond_with tests
8
9Summary: Host/service/network monitoring program
10Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci
11Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços
12Name: nagios
13Version: 3.3.1
14Release: 0.1
15License: GPL v2+
16Group: Networking
17Source0: http://downloads.sourceforge.net/nagios/%{name}-%{version}.tar.gz
18# Source0-md5: c935354ce0d78a63bfabc3055fa77ad5
19Source1: %{name}-apache.conf
20Source2: %{name}.init
21Source3: %{name}.sysconfig
22Source4: %{name}-config-20090914.tar.bz2
23# Source4-md5: 605f1cd28c00db961dad6f529d849f16
24Source5: %{name}-lighttpd.conf
25Source6: http://www.google.com/mapfiles/shadow50.png
26# Source6-md5: eff99f302f21b95a900d321743fce72b
27Source7: http://www.google.com/mapfiles/marker.png
28# Source7-md5: edefef4bdfc29e1c953694651f05b466
29Source8: googlemap.js
30Patch0: %{name}-resources.patch
31Patch1: %{name}-iconv-in-libc.patch
32Patch2: %{name}-webapps.patch
33Patch3: %{name}-cgi-http_charset.patch
34Patch4: %{name}-cmd-typo.patch
35Patch5: config.patch
36Patch6: %{name}-googlemap.patch
37Patch7: %{name}-doc-usermacros.patch
38Patch8: archivelog-timeformat.patch
39Patch9: %{name}-html-Makefile.in.patch
40URL: http://www.nagios.org/
41BuildRequires: autoconf
42BuildRequires: automake
43%if %{with gd}
44BuildRequires: gd-devel
45BuildRequires: libjpeg-devel
46BuildRequires: libpng-devel
47%endif
48BuildRequires: rpmbuild(macros) >= 1.268
49BuildRequires: sed >= 4.0
50Requires(post,preun): /sbin/chkconfig
51Requires: %{name}-common = %{version}-%{release}
52Requires: rc-scripts
53Requires: sh-utils
54Suggests: nagios-notify >= 0.13
55Suggests: nagios-plugin-check_load
56Suggests: nagios-plugin-check_ping
57Suggests: nagios-plugins
58Provides: nagios-core
59Obsoletes: netsaint
60Conflicts: iputils-ping < 1:ss020124
61BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
62
63%define _sysconfdir /etc/%{name}
64%define cgidir %{_libdir}/%{name}/cgi
65%define htmldir %{_prefix}/share/%{name}
66%define _localstatedir /var/lib/%{name}
67%define _webapps /etc/webapps
68%define _webapp %{name}
69
70%description
71Nagios is a program that will monitor hosts and services on your
72network. It has the ability to email or page you when a problem arises
73and when a problem is resolved. Nagios is written in C and is designed
74to run under Linux (and some other *NIX variants) as a background
75process, intermittently running checks on various services that you
76specify.
77
78The actual service checks are performed by separate "plugin" programs
79which return the status of the checks to Nagios. The plugins are
80available in nagios-plugins packages.
81
82Nagios is successor to NetSaint.
83
84%description -l pl.UTF-8
85Nagios to program, który monitoruje serwery oraz usługi w naszej
86sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
87rozwiązaniu problemu. Nagios został napisany w C oraz jest
88zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
89jako proces pracujący w tle i bezustannie wykonujący pewne operacje
90sprawdzające.
91
92Właściwe sprawdzanie jest wykonywane przez osobne programy
93("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
94są dostępne na stronie w pakietach nagios-plugins.
95
96Nagios jest następcą NetSainta.
97
98%description -l pt_BR.UTF-8
99O Nagios é um programa que monitora máquinas e serviços na sua rede.
100Ele pode enviar um email ou um aviso de pager para o administrador
101quando surgir um problema e quando ele for resolvido. Nagios é escrito
102em C e foi desenvolvido para rodar em plataformas Linux (e algumas
103variações de *NIX) como um processo em segundo plano, periodicamente
104executando checagens nos diversos serviços que forem especificados.
105
106%package common
107Summary: Common files needed by both nagios and nrpe
108Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
109Group: Networking
110Requires(postun): /usr/sbin/groupdel
111Requires(postun): /usr/sbin/userdel
112Requires(pre): /bin/id
113Requires(pre): /usr/bin/getgid
114Requires(pre): /usr/sbin/groupadd
115Requires(pre): /usr/sbin/groupmod
116Requires(pre): /usr/sbin/useradd
117Requires(pre): /usr/sbin/usermod
118Provides: group(nagcmd)
119Provides: group(nagios)
120Provides: user(nagios)
121
122%description common
123Common files needed by both nagios and nrpe.
124
125%description common -l pl.UTF-8
126Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
127
128%package cgi
129Summary: CGI webinterface for Nagios
130Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
131Group: Applications/WWW
132# for dirs... and accessing local logs, nagios config
133Requires: %{name} = %{version}-%{release}
134Requires: %{name}-imagepaks
135Requires: %{name}-theme
136Requires: group(http)
137Requires: webapps
138Requires: webserver
139Requires: webserver(access)
140Requires: webserver(alias)
141Requires: webserver(auth)
142Requires: webserver(cgi)
143Requires: webserver(indexfile)
144Suggests: %{name}-doc
145
146%description cgi
147CGI webinterface for Nagios.
148
149%description cgi -l pl.UTF-8
150Interfejs CGI dla Nagiosa.
151
152%package doc
153Summary: HTML Documentation for Nagios
154Group: Documentation
155# does not require base
156
157%description doc
158HTML Documentation for Nagios.
159
160%package theme-default
161Summary: Default Nagios theme
162Summary(pl.UTF-8): Domyślny motyw Nagiosa
163Group: Applications/WWW
164Requires: %{name}-cgi = %{version}-%{release}
165Requires: webserver(php)
166Provides: nagios-theme
167Obsoletes: nagios-theme
168
169%description theme-default
170Original theme from Nagios.
171
172%description theme-default -l pl.UTF-8
173Oryginalny motyw z Nagiosa.
174
175%package devel
176Summary: Include files that Nagios-related applications may compile against
177Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
178Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
179Group: Development/Libraries
180# doesn't require base
181
182%description devel
183This package provides include files that Nagios-related applications
184may compile against.
185
186%description devel -l pl.UTF-8
187Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
188przez aplikacje związane z nagiosem podczas kompilacji.
189
190%description devel -l pt_BR.UTF-8
191Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
192aplicativos para o Nagios.
193
194%prep
195%setup -q -a4 -n %{name}
196%undos cgi/*.c
197%undos include/*.h
198%undos base/*
199%patch0 -p0
200%patch1 -p1
201%patch2 -p1
202%patch3 -p1
203#fixed
204#%patch4 -p1
205%patch5 -p1
206%patch6 -p1
207%patch7 -p1
208%patch8 -p1
209%patch9 -p1
210
211find -name .cvsignore -o -name .gitignore | xargs rm
212
213mv nagios-config-*/objects/*.cfg sample-config/template-object
214mv nagios-config-*/*.cfg sample-config
215
216# cleanup backups after patching
217find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
218
219sed -i -e '
220 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
221 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
222' $(find contrib/eventhandlers -type f)
223
224sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
225sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
226
227# fixup cgi config
228%{__sed} -i -e '
229 # kill trailing spaces
230 s, \+$,,
231 # use real paths
232 s,/usr/local/%{name}/share,@datadir@,g
233 # we want all authorized users have default access
234 s,=nagiosadmin,=*,g
235' sample-config/*.cfg.in
236
237# fixup paths in doc
238#%{__sed} -i -e '
239# s,/usr/local/%{name}/var/archives/,/var/log/%{name}/archives/,
240#' html/docs/configmain.html
241
242%build
243cp -f /usr/share/automake/config.sub .
244%{__aclocal}
245%{__autoconf}
246%configure \
247 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
248 --bindir=%{_sbindir} \
249 --sbindir=%{cgidir} \
250 --datadir=%{htmldir} \
251 --with-nagios-user=%{name} \
252 --with-nagios-grp=%{name} \
253 --with-command-user=%{name} \
254 --with-command-grp=%{name} \
255 --with-lockfile=%{_localstatedir}/%{name}.pid \
256 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
257 --with-ping_command='/bin/ping -n %%s -c %%d' \
258 %{!?with_gd:--disable-statusmap --disable-trends} \
259 %{?with_tests:--enable-libtap} \
260 --enable-event-broker
261
262%{__make} all
263
264%{?with_tests:%{__make} test}
265
266%install
267rm -rf $RPM_BUILD_ROOT
268install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
269 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
270 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
271 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
272%if "%{_lib}" != "lib"
273 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
274%endif
275
276install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
277cp -a include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
278
279%{__make} install-unstripped \
280 DESTDIR=$RPM_BUILD_ROOT \
281 INSTALL_OPTS="" \
282 INIT_OPTS="" \
283 COMMAND_OPTS=""
284
285install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
286cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
287
288# install templated configuration files
289for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
290 cp -a sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
291done
292
293# webserver files
294cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
295cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
296cp -a lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
297cp -a sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
298cp -a %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
299cp -a %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
300cp -a %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
301> $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
302echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
303
304# install event handlers, sample config
305install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
306cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
307cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
308find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
309
310# Object data/cache files
311for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
312 > $RPM_BUILD_ROOT%{_localstatedir}/$i
313done
314> $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
315
316install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
317mv $RPM_BUILD_ROOT{%{htmldir}/docs/*,%{_docdir}/%{name}}
318
319%clean
320rm -rf $RPM_BUILD_ROOT
321
322%post
323for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
324 [ ! -f $i ] && touch $i
325 chown root:nagios $i
326 chmod 664 $i
327done
328
329/sbin/chkconfig --add %{name}
330%service %{name} restart "Nagios service"
331
332%preun
333if [ "$1" = "0" ] ; then
334 %service %{name} stop
335 /sbin/chkconfig --del %{name}
336fi
337
338%pre common
339# rename group netsaint -> nagios
340if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
341 /usr/sbin/groupmod -n nagios netsaint
342fi
343# rename group nagios-data -> nagcmd
344if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
345 /usr/sbin/groupmod -n nagcmd nagios-data
346fi
347%groupadd -g 72 nagios
348%groupadd -g 147 -f nagcmd
349if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
350 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
351fi
352%useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
353
354%postun common
355if [ "$1" = "0" ]; then
356 %userremove nagios
357 %groupremove nagios
358 %groupremove nagcmd
359fi
360
361%post cgi
362if [ "$1" = 1 ]; then
363%banner %{name} -e <<EOF
364NOTE:
365You need to add user to %{_webapps}/%{_webapp}/passwd and
366%{_webapps}/%{_webapp}/group to access Nagios via web.
367
368EOF
369fi
370
371%triggerin cgi -- apache1 < 1.3.37-3, apache1-base
372%addusertogroup http nagcmd
373%webapp_register apache %{_webapp}
374
375%triggerun cgi -- apache1 < 1.3.37-3, apache1-base
376%webapp_unregister apache %{_webapp}
377
378%triggerin cgi -- apache < 2.2.0, apache-base
379%addusertogroup http nagcmd
380%webapp_register httpd %{_webapp}
381
382%triggerun cgi -- apache < 2.2.0, apache-base
383%webapp_unregister httpd %{_webapp}
384
385%triggerin cgi -- lighttpd
386%addusertogroup lighttpd nagcmd
387%webapp_register lighttpd %{_webapp}
388
389%triggerun cgi -- lighttpd
390%webapp_unregister lighttpd %{_webapp}
391
392%triggerpostun -- nagios-cgi < 2.0-0.b3.21
393chown root:http %{_sysconfdir}/cgi.cfg
394
395%triggerpostun -- nagios < 3.1.2-4
396# restore lost files
397for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
398 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
399 mv -f %{_sysconfdir}/$a{.rpmsave,}
400 fi
401done
402%{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
403
404%files
405%defattr(644,root,root,755)
406%doc Changelog README* UPGRADING INSTALLING LICENSE
407%attr(750,root,nagios) %dir %{_sysconfdir}/objects
408
409# leave main nagios config readable for -cgi.
410%attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
411
412%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
413%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
414%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
415%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
416%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
417%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
418
419%attr(754,root,root) /etc/rc.d/init.d/%{name}
420%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
421
422%attr(755,root,root) %{_sbindir}/%{name}
423%attr(755,root,root) %{_sbindir}/nagiostats
424%dir %{_libdir}/%{name}/brokers
425
426%attr(770,root,nagcmd) %dir %{_var}/log/%{name}
427%attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
428
429%attr(770,root,nagcmd) %dir %{_localstatedir}
430%attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
431%attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
432%attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
433%attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
434%attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
435%attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
436%attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
437
438%attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
439
440%{_examplesdir}/%{name}-%{version}
441
442%files common
443%defattr(644,root,root,755)
444%attr(750,root,nagcmd) %dir %{_sysconfdir}
445%attr(750,root,nagios) %dir %{_sysconfdir}/plugins
446%dir %{_libdir}/%{name}
447%dir %{_libdir}/%{name}/plugins
448%dir %{_libdir}/%{name}/eventhandlers
449
450%if "%{_lib}" != "lib"
451%dir %{_prefix}/lib/%{name}
452%dir %{_prefix}/lib/%{name}/plugins
453%dir %{_prefix}/lib/%{name}/eventhandlers
454%endif
455
456%attr(770,root,nagios) %dir %{_var}/spool/%{name}
457
458%files doc
459%defattr(644,root,root,755)
460%{_docdir}/%{name}
461
462%files cgi
463%defattr(644,root,root,755)
464%dir %attr(750,root,http) %{_webapps}/%{_webapp}
465%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
466%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
467%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
468%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
469%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
470%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
471%dir %{cgidir}
472%attr(755,root,root) %{cgidir}/*.cgi
473
474%dir %{htmldir}
475%dir %{htmldir}/includes
476%dir %{htmldir}/images
477%dir %{htmldir}/stylesheets
478%{htmldir}/robots.txt
479%{htmldir}/contexthelp
480%{htmldir}/media
481%{htmldir}/ssi
482%{htmldir}/images/favicon.ico
483%{htmldir}/images/marker.png
484%{htmldir}/images/shadow50.png
485
486%files theme-default
487%defattr(644,root,root,755)
488%{htmldir}/*.php
489%{htmldir}/includes/*
490%{htmldir}/images/*
491%exclude %{htmldir}/images/favicon.ico
492%exclude %{htmldir}/images/marker.png
493%exclude %{htmldir}/images/shadow50.png
494%{htmldir}/stylesheets/*
495
496%files devel
497%defattr(644,root,root,755)
498%dir %{_includedir}/%{name}
499%{_includedir}/%{name}/*.h
This page took 0.033842 seconds and 4 git commands to generate.