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