3 %bcond_without gd # without statusmap and trends, which require gd library
4 # reeenable when http://tracker.nagios.org/view.php?id=51 is fixed
7 Summary: Host/service/network monitoring program
8 Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci
9 Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços
15 Source0: http://dl.sourceforge.net/nagios/%{name}-%{version}.tar.gz
16 # Source0-md5: f3c60428cba14264c709749182b8d93e
17 Source1: %{name}-apache.conf
19 Source3: %{name}.sysconfig
20 Source4: http://www.nagios.org/images/favicon.ico
21 # Source4-md5: 1c4201c7da53d6c7e48251d3a9680449
22 Source5: %{name}-config-20071217.tar.bz2
23 # Source5-md5: c50e60b73f86b8bfbc36f486d583f67b
24 Source6: %{name}-lighttpd.conf
25 Patch0: %{name}-resources.patch
26 Patch1: %{name}-iconv-in-libc.patch
27 Patch2: %{name}-webapps.patch
28 Patch3: %{name}-cgi-http_charset.patch
29 Patch4: %{name}-cmd-typo.patch
30 URL: http://www.nagios.org/
31 BuildRequires: autoconf
32 BuildRequires: automake
34 BuildRequires: gd-devel
35 BuildRequires: libjpeg-devel
36 BuildRequires: libpng-devel
38 BuildRequires: rpmbuild(macros) >= 1.268
39 BuildRequires: sed >= 4.0
40 BuildRequires: tar >= 1:1.15.1
41 Requires(post,preun): /sbin/chkconfig
42 Requires(triggerpostun): sed >= 4.0
43 Requires: %{name}-common = %{version}-%{release}
49 Conflicts: iputils-ping < 1:ss020124
50 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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}
57 %define _webapps /etc/webapps
58 %define _webapp %{name}
61 Nagios is a program that will monitor hosts and services on your
62 network. It has the ability to email or page you when a problem arises
63 and when a problem is resolved. Nagios is written in C and is designed
64 to run under Linux (and some other *NIX variants) as a background
65 process, intermittently running checks on various services that you
68 The actual service checks are performed by separate "plugin" programs
69 which return the status of the checks to Nagios. The plugins are
70 available in nagios-plugins packages.
72 Nagios is successor to NetSaint.
74 %description -l pl.UTF-8
75 Nagios to program, który monitoruje serwery oraz usługi w naszej
76 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
77 rozwiązaniu problemu. Nagios został napisany w C oraz jest
78 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
79 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
82 Właściwe sprawdzanie jest wykonywane przez osobne programy
83 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
84 są dostępne na stronie w pakietach nagios-plugins.
86 Nagios jest następcą NetSainta.
88 %description -l pt_BR.UTF-8
89 O Nagios é um programa que monitora máquinas e serviços na sua rede.
90 Ele pode enviar um email ou um aviso de pager para o administrador
91 quando surgir um problema e quando ele for resolvido. Nagios é escrito
92 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
93 variações de *NIX) como um processo em segundo plano, periodicamente
94 executando checagens nos diversos serviços que forem especificados.
97 Summary: Common files needed by both nagios and nrpe
98 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
100 Requires(postun): /usr/sbin/groupdel
101 Requires(postun): /usr/sbin/userdel
102 Requires(pre): /bin/id
103 Requires(pre): /usr/bin/getgid
104 Requires(pre): /usr/sbin/groupadd
105 Requires(pre): /usr/sbin/groupmod
106 Requires(pre): /usr/sbin/useradd
107 Requires(pre): /usr/sbin/usermod
108 Provides: group(nagios)
109 Provides: group(nagios-data)
110 Provides: user(nagios)
113 Common files needed by both nagios and nrpe.
115 %description common -l pl.UTF-8
116 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
119 Summary: CGI webinterface for Nagios
120 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
121 Group: Applications/WWW
122 # for dirs... and accessing local logs.
123 Requires: %{name} = %{version}-%{release}
124 Requires: %{name}-imagepaks
125 Requires: %{name}-theme
126 Requires: group(http)
129 Requires: webserver(access)
130 Requires: webserver(alias)
131 Requires: webserver(auth)
132 Requires: webserver(cgi)
133 Requires: webserver(indexfile)
136 CGI webinterface for Nagios.
138 %description cgi -l pl.UTF-8
139 Interfejs CGI dla Nagiosa.
141 %package theme-default
142 Summary: Default Nagios theme
143 Summary(pl.UTF-8): Domyślny motyw Nagiosa
144 Group: Applications/WWW
145 Requires: webserver(php)
146 Requires: nagios-cgi = %{version}-%{release}
147 Provides: nagios-theme
148 Obsoletes: nagios-theme
150 %description theme-default
151 Original theme from Nagios.
153 %description theme-default -l pl.UTF-8
154 Oryginalny motyw z Nagiosa.
157 Summary: Include files that Nagios-related applications may compile against
158 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
159 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
160 Group: Development/Libraries
161 # doesn't require base
164 This package provides include files that Nagios-related applications
167 %description devel -l pl.UTF-8
168 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
169 przez aplikacje związane z nagiosem podczas kompilacji.
171 %description devel -l pt_BR.UTF-8
172 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
173 aplicativos para o Nagios.
184 s,".*/var/rw/nagios.cmd,"%{_localstatedir}/rw/nagios.cmd,
185 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
186 ' $(find contrib/eventhandlers -type f)
188 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
189 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE6} > lighttpd.conf
192 cp -f /usr/share/automake/config.sub .
196 --datarootdir=%{_datadir} \
197 --with-nagios-user=%{name} \
198 --with-nagios-grp=%{name} \
199 --with-command-user=%{name} \
200 --with-command-grp=%{name} \
201 --with-lockfile=%{_localstatedir}/%{name}.pid \
202 --with-ping_command='/bin/ping -n %%s -c %%d' \
203 %{!?with_gd:--disable-statusmap --disable-trends} \
204 %{?with_tests:--enable-libtap} \
205 --enable-event-broker
209 %{?with_tests:%{__make} test}
212 rm -rf $RPM_BUILD_ROOT
213 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
214 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
215 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,local} \
216 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins} \
217 %if "%{_lib}" != "lib"
218 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
221 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
222 install include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
224 %{__make} install-unstripped \
225 DESTDIR=$RPM_BUILD_ROOT \
230 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
231 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
232 install %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}
234 # install templated configuration files
235 tar jxf %{SOURCE5} --strip-components=1 -C $RPM_BUILD_ROOT%{_sysconfdir}
236 sed -i -e 's,%{_prefix}/lib/,%{_libdir}/,' $RPM_BUILD_ROOT%{_sysconfdir}/resource.cfg
239 install apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
240 install apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
241 install lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
242 mv $RPM_BUILD_ROOT{%{_sysconfdir}/cgi.cfg,%{_webapps}/%{_webapp}}
243 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
244 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
246 # install event handlers
247 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
248 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
250 # Object data/cache files
251 for i in {objects.cache,{comments,downtime,retention,status}.dat,nagios.tmp}; do
252 > $RPM_BUILD_ROOT%{_localstatedir}/$i
254 > $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
257 rm -rf $RPM_BUILD_ROOT
260 for i in %{_localstatedir}/{objects.cache,{comments,downtime,retention,status}.dat}; do
261 [ ! -f $i ] && touch $i
266 /sbin/chkconfig --add %{name}
267 %service %{name} restart "Nagios service"
270 if [ "$1" = "0" ] ; then
271 %service %{name} stop
272 /sbin/chkconfig --del %{name}
276 if [ "`getgid netsaint 2>/dev/null`" = "72" ]; then
277 /usr/sbin/groupmod -n nagios netsaint
279 %groupadd -g 72 nagios
280 %groupadd -g 147 -f nagios-data
281 if [ -n "`id -u netsaint 2>/dev/null`" ] && [ "`id -u netsaint`" = "72" ]; then
282 /usr/sbin/usermod -d %{_libdir}/nagios -l nagios -c "Nagios Daemon" -G nagios-data netsaint
284 %useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "Nagios Daemon" -g nagios -G nagios-data nagios
287 if [ "$1" = "0" ]; then
290 %groupremove nagios-data
294 if [ "$1" = 1 ]; then
295 %banner %{name} -e <<EOF
297 You need to add user to %{_webapps}/%{_webapp}/passwd and
298 %{_webapps}/%{_webapp}/group to access Nagios via web.
303 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
304 %addusertogroup http nagios-data
305 %webapp_register apache %{_webapp}
307 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
308 %webapp_unregister apache %{_webapp}
310 %triggerin cgi -- apache < 2.2.0, apache-base
311 %addusertogroup http nagios-data
312 %webapp_register httpd %{_webapp}
314 %triggerun cgi -- apache < 2.2.0, apache-base
315 %webapp_unregister httpd %{_webapp}
317 %triggerin cgi -- lighttpd
318 %addusertogroup lighttpd nagios-data
319 %webapp_register lighttpd %{_webapp}
321 %triggerun cgi -- lighttpd
322 %webapp_unregister lighttpd %{_webapp}
324 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
325 chown root:http %{_sysconfdir}/cgi.cfg
327 %triggerpostun -- nagios < 2.0-0.b3.21
328 chown root:nagios %{_sysconfdir}/*.cfg
329 chown root:nagios-data %{_sysconfdir}/nagios.cfg
330 %addusertogroup nagios nagios-data
332 # must unify nagios.cfg
334 s,^status_file=.*,status_file=%{_localstatedir}/status.dat,
335 s,^comment_file=.*,comment_file=%{_localstatedir}/comments.dat,
336 s,^downtime_file=.*,downtime_file=%{_localstatedir}/downtime.dat,
337 s,^lock_file=.*,lock_file=%{_localstatedir}/nagios.pid,
338 s,^temp_file=.*,temp_file=%{_localstatedir}/nagios.tmp,
339 s,^state_retention_file=.*,state_retention_file=%{_localstatedir}/retention.dat,
342 s,^log_passive_service_checks=,log_passive_checks=,
343 s,^inter_check_delay_method=,service_inter_check_delay_method=,
344 s,^use_agressive_host_checking=,use_aggressive_host_checking=,
345 s,^freshness_check_interval=,service_freshness_check_interval=,
347 ' %{_sysconfdir}/nagios.cfg
350 s,\$DATETIME\$,$LONGDATETIME$,g
351 s,Nagios/1.2,Nagios/%{version},g
352 ' %{_sysconfdir}/misccommands.cfg
354 mv -f /var/log/nagios/status.log %{_localstatedir}/status.dat 2>/dev/null
355 mv -f /var/log/nagios/comment.log %{_localstatedir}/comments.dat 2>/dev/null
356 mv -f /var/log/nagios/downtime.log %{_localstatedir}/downtime.dat 2>/dev/null
357 mv -f /var/run/nagios.pid %{_localstatedir}/nagios.pid 2>/dev/null
358 mv -f /var/log/nagios/nagios.tmp %{_localstatedir}/nagios.tmp 2>/dev/null
359 mv -f /var/log/nagios/status.sav %{_localstatedir}/retention.dat 2>/dev/null
360 chown nagios:nagios %{_localstatedir}/nagios.pid 2>/dev/null
361 chown nagios:nagios-data %{_localstatedir}/rw/nagios.cmd 2>/dev/null
363 %service -q %{name} restart
365 %banner -e %{name}-2.0 <<'EOF'
366 Please read <http://nagios.sourceforge.net/docs/2_0/whatsnew.html>
367 there are changes that no longer work in Nagios 2.0.
369 You could also try use <http://oss.op5.se/nagios/object_config_fix.php.gz>
370 to convert your config (yes i know it's too late to say it now, after
371 the upgrade, but still :))
376 %triggerpostun cgi -- %{name}-cgi < 2.0-0.b6.0.2
377 for i in cgi.cfg group passwd; do
378 if [ -f /etc/nagios/$i.rpmsave ]; then
379 mv -f %{_webapps}/%{_webapp}/$i{,.rpmnew}
380 mv -f /etc/nagios/$i.rpmsave %{_webapps}/%{_webapp}/$i
384 # migrate from httpd (apache2) config dir
385 if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
386 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
387 mv -f /etc/httpd/%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
390 # migrate from apache-config macros
391 if [ -f /etc/%{name}/apache-nagios.conf.rpmsave ]; then
392 if [ -d /etc/apache/webapps.d ]; then
393 cp -f %{_webapps}/%{_webapp}/apache.conf{,.rpmnew}
394 cp -f /etc/%{name}/apache-nagios.conf.rpmsave %{_webapps}/%{_webapp}/apache.conf
397 if [ -d /etc/httpd/webapps.d ]; then
398 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
399 cp -f /etc/%{name}/apache-nagios.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
401 rm -f /etc/%{name}/apache-nagios.conf.rpmsave
404 # place new config location, as trigger puts config only on first install, do it here.
405 if [ -L /etc/apache/conf.d/99_%{name}.conf ]; then
406 rm -f /etc/apache/conf.d/99_%{name}.conf
409 if [ -L /etc/httpd/httpd.conf/99_%{name}.conf ]; then
410 rm -f /etc/httpd/httpd.conf/99_%{name}.conf
414 if [ "$apache_reload" ]; then
415 /usr/sbin/webapp register apache %{_webapp}
416 %service -q apache reload
418 if [ "$httpd_reload" ]; then
419 /usr/sbin/webapp register httpd %{_webapp}
420 %service -q httpd reload
424 %defattr(644,root,root,755)
425 %doc Changelog README* UPGRADING INSTALLING LICENSE
426 %doc sample-config/template-object/{localhost,commands}.cfg
427 %attr(640,root,nagios-data) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nagios.cfg
428 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/[!n]*.cfg
430 %attr(754,root,root) /etc/rc.d/init.d/%{name}
431 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
433 %attr(755,root,root) %{_bindir}/%{name}
434 %attr(755,root,root) %{_bindir}/nagiostats
436 %attr(770,root,nagios-data) %dir %{_var}/log/%{name}
437 %attr(770,root,nagios-data) %dir %{_var}/log/%{name}/archives
439 %attr(770,root,nagios-data) %dir %{_localstatedir}
440 %attr(2770,root,nagios-data) %dir %{_localstatedir}/rw
441 %attr(660,nagios,nagios-data) %ghost %{_localstatedir}/rw/nagios.cmd
442 %attr(2770,root,nagios-data) %dir %{_localstatedir}/spool
443 %attr(2770,root,nagios-data) %dir %{_localstatedir}/spool/checkresults
444 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
445 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
446 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
448 %{_examplesdir}/%{name}-%{version}
451 %defattr(644,root,root,755)
452 %attr(750,root,nagios-data) %dir %{_sysconfdir}
453 %attr(2750,root,nagios) %dir %{_sysconfdir}/plugins
454 %attr(2750,root,nagios) %dir %{_sysconfdir}/local
455 %dir %{_libdir}/%{name}
456 %dir %{_libdir}/%{name}/plugins
457 %dir %{_libdir}/%{name}/eventhandlers
459 %if "%{_lib}" != "lib"
460 %dir %{_prefix}/lib/%{name}
461 %dir %{_prefix}/lib/%{name}/plugins
462 %dir %{_prefix}/lib/%{name}/eventhandlers
466 %defattr(644,root,root,755)
467 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
468 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
469 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
470 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
471 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
472 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
473 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
475 %attr(755,root,root) %{_sbindir}/*.cgi
478 %dir %{_datadir}/includes
479 %dir %{_datadir}/images
480 %dir %{_datadir}/stylesheets
481 %{_datadir}/favicon.ico
482 %{_datadir}/robots.txt
483 %{_datadir}/contexthelp
489 %defattr(644,root,root,755)
491 %{_datadir}/includes/*
493 %{_datadir}/stylesheets/*
496 %defattr(644,root,root,755)
497 %dir %{_includedir}/%{name}
498 %{_includedir}/%{name}/*.h