2 # - /var/log/nagios/archives -> /var/log/archive/nagios
5 %bcond_without gd # without statusmap and trends, which require gd library
6 %bcond_without epn # without Embedded Perl
7 # reeenable when http://tracker.nagios.org/view.php?id=51 is fixed
10 Summary: Host/service/network monitoring program
11 Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci
12 Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços
18 Source0: http://downloads.sourceforge.net/nagios/%{name}-%{version}.tar.gz
19 # Source0-md5: c935354ce0d78a63bfabc3055fa77ad5
20 Source1: %{name}-apache.conf
22 Source3: %{name}.sysconfig
23 Source4: %{name}-config-20090914.tar.bz2
24 # Source4-md5: 605f1cd28c00db961dad6f529d849f16
25 Source5: %{name}-lighttpd.conf
26 Source6: http://www.google.com/mapfiles/shadow50.png
27 # Source6-md5: eff99f302f21b95a900d321743fce72b
28 Source7: http://www.google.com/mapfiles/marker.png
29 # Source7-md5: edefef4bdfc29e1c953694651f05b466
31 Patch0: %{name}-resources.patch
32 Patch1: %{name}-iconv-in-libc.patch
33 Patch2: %{name}-webapps.patch
34 Patch3: %{name}-cgi-http_charset.patch
35 Patch4: %{name}-cmd-typo.patch
37 Patch6: %{name}-googlemap.patch
38 Patch7: %{name}-doc-usermacros.patch
39 Patch8: archivelog-timeformat.patch
40 Patch9: %{name}-html-Makefile.in.patch
41 URL: http://www.nagios.org/
42 BuildRequires: autoconf
43 BuildRequires: automake
44 BuildRequires: rpmbuild(macros) >= 1.268
45 BuildRequires: sed >= 4.0
47 BuildRequires: gd-devel
48 BuildRequires: libjpeg-devel
49 BuildRequires: libpng-devel
52 BuildRequires: perl-HTML-Lint
53 BuildRequires: perl-Test-WWW-Mechanize-CGI
55 Requires(post,preun): /sbin/chkconfig
56 Requires: %{name}-common = %{version}-%{release}
59 Suggests: nagios-notify >= 0.13
60 Suggests: nagios-plugin-check_load
61 Suggests: nagios-plugin-check_ping
62 Suggests: nagios-plugins
65 Conflicts: iputils-ping < 1:ss020124
66 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
68 %define _sysconfdir /etc/%{name}
69 %define cgidir %{_libdir}/%{name}/cgi
70 %define htmldir %{_prefix}/share/%{name}
71 %define _localstatedir /var/lib/%{name}
72 %define _webapps /etc/webapps
73 %define _webapp %{name}
76 Nagios is a program that will monitor hosts and services on your
77 network. It has the ability to email or page you when a problem arises
78 and when a problem is resolved. Nagios is written in C and is designed
79 to run under Linux (and some other *NIX variants) as a background
80 process, intermittently running checks on various services that you
83 The actual service checks are performed by separate "plugin" programs
84 which return the status of the checks to Nagios. The plugins are
85 available in nagios-plugins packages.
87 Nagios is successor to NetSaint.
89 %description -l pl.UTF-8
90 Nagios to program, który monitoruje serwery oraz usługi w naszej
91 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
92 rozwiązaniu problemu. Nagios został napisany w C oraz jest
93 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
94 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
97 Właściwe sprawdzanie jest wykonywane przez osobne programy
98 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
99 są dostępne na stronie w pakietach nagios-plugins.
101 Nagios jest następcą NetSainta.
103 %description -l pt_BR.UTF-8
104 O Nagios é um programa que monitora máquinas e serviços na sua rede.
105 Ele pode enviar um email ou um aviso de pager para o administrador
106 quando surgir um problema e quando ele for resolvido. Nagios é escrito
107 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
108 variações de *NIX) como um processo em segundo plano, periodicamente
109 executando checagens nos diversos serviços que forem especificados.
112 Summary: Common files needed by both nagios and nrpe
113 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
115 Requires(postun): /usr/sbin/groupdel
116 Requires(postun): /usr/sbin/userdel
117 Requires(pre): /bin/id
118 Requires(pre): /usr/bin/getgid
119 Requires(pre): /usr/sbin/groupadd
120 Requires(pre): /usr/sbin/groupmod
121 Requires(pre): /usr/sbin/useradd
122 Requires(pre): /usr/sbin/usermod
123 Provides: group(nagcmd)
124 Provides: group(nagios)
125 Provides: user(nagios)
128 Common files needed by both nagios and nrpe.
130 %description common -l pl.UTF-8
131 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
134 Summary: CGI webinterface for Nagios
135 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
136 Group: Applications/WWW
137 # for dirs... and accessing local logs, nagios config
138 Requires: %{name} = %{version}-%{release}
139 Requires: %{name}-imagepaks
140 Requires: %{name}-theme
141 Requires: group(http)
144 Requires: webserver(access)
145 Requires: webserver(alias)
146 Requires: webserver(auth)
147 Requires: webserver(cgi)
148 Requires: webserver(indexfile)
149 Suggests: %{name}-doc
152 CGI webinterface for Nagios.
154 %description cgi -l pl.UTF-8
155 Interfejs CGI dla Nagiosa.
158 Summary: MRTG Graphs: Nagios Statistics
159 Group: Applications/Networking
160 Requires: %{name} = %{version}-%{release}
163 %description mrtggraphs
164 This pacakge graphs several Nagios statistics which can be useful for
165 debugging and trending purposes. The nagiostats binary is used to
169 Summary: HTML Documentation for Nagios
171 # does not require base
174 HTML Documentation for Nagios.
176 %package theme-classicui
177 Summary: ClassicUI Nagios theme
178 Group: Applications/WWW
179 Requires: %{name}-cgi = %{version}-%{release}
180 Requires: webserver(php)
181 Provides: nagios-theme
182 Obsoletes: nagios-theme
184 %description theme-classicui
185 Original theme from Nagios.
187 %description theme-classicui -l pl.UTF-8
188 Oryginalny motyw z Nagiosa.
190 %package theme-default
191 Summary: Virtual package to handle Nagios theme migration
192 Group: Applications/WWW
193 Requires: nagios-theme
194 Obsoletes: nagios-theme-default < 3.3.1-1.4
196 %description theme-default
197 Virtual package to handle Nagios theme migration
200 Summary: Include files that Nagios-related applications may compile against
201 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
202 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
203 Group: Development/Libraries
204 # doesn't require base
207 This package provides include files that Nagios-related applications
210 %description devel -l pl.UTF-8
211 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
212 przez aplikacje związane z nagiosem podczas kompilacji.
214 %description devel -l pt_BR.UTF-8
215 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
216 aplicativos para o Nagios.
219 %setup -qc -a4 -n%{name}
235 find -name .cvsignore -o -name .gitignore | xargs rm
237 mv nagios-config-*/objects/*.cfg sample-config/template-object
238 mv nagios-config-*/*.cfg sample-config
240 # cleanup backups after patching
241 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
244 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
245 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
246 ' $(find contrib/eventhandlers -type f)
248 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
249 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
253 # kill trailing spaces
256 s,/usr/local/%{name}/share,@datadir@,g
257 # we want all authorized users have default access
259 ' sample-config/*.cfg.in
263 # s,/usr/local/%{name}/var/archives/,/var/log/%{name}/archives/,
264 #' html/docs/configmain.html
266 #rm t/611cgistatus-hosturgencies.t
269 cp -f /usr/share/automake/config.sub .
280 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
281 --bindir=%{_sbindir} \
282 --sbindir=%{cgidir} \
283 --datadir=%{htmldir} \
284 --with-nagios-user=%{name} \
285 --with-nagios-grp=%{name} \
286 --with-command-user=%{name} \
287 --with-command-grp=%{name} \
288 --with-lockfile=%{_localstatedir}/%{name}.pid \
289 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
290 --with-ping_command='/bin/ping -n %%s -c %%d' \
291 %{!?with_gd:--disable-statusmap --disable-trends} \
292 %{?with_tests:--enable-libtap} \
293 --enable-event-broker
297 %{?with_tests:%{__make} test}
300 rm -rf $RPM_BUILD_ROOT
301 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
302 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
303 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
304 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
305 %if "%{_lib}" != "lib"
306 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
309 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
310 cp -p include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
312 %{__make} install-unstripped \
313 DESTDIR=$RPM_BUILD_ROOT \
318 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
319 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
321 # install templated configuration files
322 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
323 cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
327 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
328 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
329 cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
330 cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
331 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
332 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
333 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
334 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
335 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
337 # install event handlers, sample config
338 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
339 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
340 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
341 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
344 install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d
345 cp -a sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg
347 # Object data/cache files
348 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
349 > $RPM_BUILD_ROOT%{_localstatedir}/$i
351 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
353 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
354 mv $RPM_BUILD_ROOT{%{htmldir}/docs/*,%{_docdir}/%{name}}
357 rm -rf $RPM_BUILD_ROOT
360 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
361 [ ! -f $i ] && touch $i
366 /sbin/chkconfig --add %{name}
367 %service %{name} restart "Nagios service"
370 if [ "$1" = "0" ] ; then
371 %service %{name} stop
372 /sbin/chkconfig --del %{name}
376 # rename group netsaint -> nagios
377 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
378 /usr/sbin/groupmod -n nagios netsaint
380 # rename group nagios-data -> nagcmd
381 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
382 /usr/sbin/groupmod -n nagcmd nagios-data
384 %groupadd -g 72 nagios
385 %groupadd -g 147 -f nagcmd
386 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
387 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
389 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
392 if [ "$1" = "0" ]; then
399 if [ "$1" = 1 ]; then
400 %banner %{name} -e <<EOF
402 You need to add user to %{_webapps}/%{_webapp}/passwd and
403 %{_webapps}/%{_webapp}/group to access Nagios via web.
408 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
409 %addusertogroup http nagcmd
410 %webapp_register apache %{_webapp}
412 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
413 %webapp_unregister apache %{_webapp}
415 %triggerin cgi -- apache < 2.2.0, apache-base
416 %addusertogroup http nagcmd
417 %webapp_register httpd %{_webapp}
419 %triggerun cgi -- apache < 2.2.0, apache-base
420 %webapp_unregister httpd %{_webapp}
422 %triggerin cgi -- lighttpd
423 %addusertogroup lighttpd nagcmd
424 %webapp_register lighttpd %{_webapp}
426 %triggerun cgi -- lighttpd
427 %webapp_unregister lighttpd %{_webapp}
429 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
430 chown root:http %{_sysconfdir}/cgi.cfg
432 %triggerpostun -- nagios < 3.1.2-4
434 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
435 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
436 mv -f %{_sysconfdir}/$a{.rpmsave,}
439 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
442 %defattr(644,root,root,755)
443 %doc Changelog README* UPGRADING INSTALLING LICENSE
444 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
446 # leave main nagios config readable for -cgi.
447 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
449 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
450 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
451 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
452 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
453 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
454 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
456 %attr(754,root,root) /etc/rc.d/init.d/%{name}
457 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
459 %attr(755,root,root) %{_sbindir}/%{name}
460 %attr(755,root,root) %{_sbindir}/nagiostats
461 %dir %{_libdir}/%{name}/brokers
463 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
464 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
466 %attr(770,root,nagcmd) %dir %{_localstatedir}
467 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
468 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
469 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
470 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
471 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
472 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
473 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
475 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}/checkresults
477 %{_examplesdir}/%{name}-%{version}
480 %defattr(644,root,root,755)
481 %attr(750,root,nagcmd) %dir %{_sysconfdir}
482 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
483 %dir %{_libdir}/%{name}
484 %dir %{_libdir}/%{name}/plugins
485 %dir %{_libdir}/%{name}/eventhandlers
487 %if "%{_lib}" != "lib"
488 %dir %{_prefix}/lib/%{name}
489 %dir %{_prefix}/lib/%{name}/plugins
490 %dir %{_prefix}/lib/%{name}/eventhandlers
493 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}
496 %defattr(644,root,root,755)
497 %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg
500 %defattr(644,root,root,755)
504 %defattr(644,root,root,755)
505 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
506 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
507 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
508 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
509 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
510 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
511 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
513 %attr(755,root,root) %{cgidir}/*.cgi
516 %dir %{htmldir}/includes
517 %dir %{htmldir}/images
518 %dir %{htmldir}/stylesheets
519 %{htmldir}/robots.txt
520 %{htmldir}/contexthelp
523 %{htmldir}/images/favicon.ico
524 %{htmldir}/images/marker.png
525 %{htmldir}/images/shadow50.png
527 %files theme-classicui
528 %defattr(644,root,root,755)
530 %{htmldir}/includes/*
532 %exclude %{htmldir}/images/favicon.ico
533 %exclude %{htmldir}/images/marker.png
534 %exclude %{htmldir}/images/shadow50.png
535 %{htmldir}/stylesheets/*
538 %defattr(644,root,root,755)
541 %defattr(644,root,root,755)
542 %dir %{_includedir}/%{name}
543 %{_includedir}/%{name}/*.h