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
45 BuildRequires: gd-devel
46 BuildRequires: libjpeg-devel
47 BuildRequires: libpng-devel
49 BuildRequires: rpmbuild(macros) >= 1.268
50 BuildRequires: sed >= 4.0
51 Requires(post,preun): /sbin/chkconfig
52 Requires: %{name}-common = %{version}-%{release}
55 Suggests: nagios-notify >= 0.13
56 Suggests: nagios-plugin-check_load
57 Suggests: nagios-plugin-check_ping
58 Suggests: nagios-plugins
61 Conflicts: iputils-ping < 1:ss020124
62 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
64 %define _sysconfdir /etc/%{name}
65 %define cgidir %{_libdir}/%{name}/cgi
66 %define htmldir %{_prefix}/share/%{name}
67 %define _localstatedir /var/lib/%{name}
68 %define _webapps /etc/webapps
69 %define _webapp %{name}
72 Nagios is a program that will monitor hosts and services on your
73 network. It has the ability to email or page you when a problem arises
74 and when a problem is resolved. Nagios is written in C and is designed
75 to run under Linux (and some other *NIX variants) as a background
76 process, intermittently running checks on various services that you
79 The actual service checks are performed by separate "plugin" programs
80 which return the status of the checks to Nagios. The plugins are
81 available in nagios-plugins packages.
83 Nagios is successor to NetSaint.
85 %description -l pl.UTF-8
86 Nagios to program, który monitoruje serwery oraz usługi w naszej
87 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
88 rozwiązaniu problemu. Nagios został napisany w C oraz jest
89 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
90 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
93 Właściwe sprawdzanie jest wykonywane przez osobne programy
94 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
95 są dostępne na stronie w pakietach nagios-plugins.
97 Nagios jest następcą NetSainta.
99 %description -l pt_BR.UTF-8
100 O Nagios é um programa que monitora máquinas e serviços na sua rede.
101 Ele pode enviar um email ou um aviso de pager para o administrador
102 quando surgir um problema e quando ele for resolvido. Nagios é escrito
103 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
104 variações de *NIX) como um processo em segundo plano, periodicamente
105 executando checagens nos diversos serviços que forem especificados.
108 Summary: Common files needed by both nagios and nrpe
109 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
111 Requires(postun): /usr/sbin/groupdel
112 Requires(postun): /usr/sbin/userdel
113 Requires(pre): /bin/id
114 Requires(pre): /usr/bin/getgid
115 Requires(pre): /usr/sbin/groupadd
116 Requires(pre): /usr/sbin/groupmod
117 Requires(pre): /usr/sbin/useradd
118 Requires(pre): /usr/sbin/usermod
119 Provides: group(nagcmd)
120 Provides: group(nagios)
121 Provides: user(nagios)
124 Common files needed by both nagios and nrpe.
126 %description common -l pl.UTF-8
127 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
130 Summary: CGI webinterface for Nagios
131 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
132 Group: Applications/WWW
133 # for dirs... and accessing local logs, nagios config
134 Requires: %{name} = %{version}-%{release}
135 Requires: %{name}-imagepaks
136 Requires: %{name}-theme
137 Requires: group(http)
140 Requires: webserver(access)
141 Requires: webserver(alias)
142 Requires: webserver(auth)
143 Requires: webserver(cgi)
144 Requires: webserver(indexfile)
145 Suggests: %{name}-doc
148 CGI webinterface for Nagios.
150 %description cgi -l pl.UTF-8
151 Interfejs CGI dla Nagiosa.
154 Summary: MRTG Graphs: Nagios Statistics
155 Group: Applications/Networking
156 Requires: %{name} = %{version}-%{release}
159 %description mrtggraphs
160 This pacakge graphs several Nagios statistics which can be useful for
161 debugging and trending purposes. The nagiostats binary is used to
165 Summary: HTML Documentation for Nagios
167 # does not require base
170 HTML Documentation for Nagios.
172 %package theme-default
173 Summary: Default Nagios theme
174 Summary(pl.UTF-8): Domyślny motyw Nagiosa
175 Group: Applications/WWW
176 Requires: %{name}-cgi = %{version}-%{release}
177 Requires: webserver(php)
178 Provides: nagios-theme
179 Obsoletes: nagios-theme
181 %description theme-default
182 Original theme from Nagios.
184 %description theme-default -l pl.UTF-8
185 Oryginalny motyw z Nagiosa.
188 Summary: Include files that Nagios-related applications may compile against
189 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
190 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
191 Group: Development/Libraries
192 # doesn't require base
195 This package provides include files that Nagios-related applications
198 %description devel -l pl.UTF-8
199 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
200 przez aplikacje związane z nagiosem podczas kompilacji.
202 %description devel -l pt_BR.UTF-8
203 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
204 aplicativos para o Nagios.
225 find -name .cvsignore -o -name .gitignore | xargs rm
227 mv nagios-config-*/objects/*.cfg sample-config/template-object
228 mv nagios-config-*/*.cfg sample-config
230 # cleanup backups after patching
231 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
234 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
235 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
236 ' $(find contrib/eventhandlers -type f)
239 s,/usr/local/nagios/var/,/var/log/%{name}/,g
242 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
243 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
247 # kill trailing spaces
250 s,/usr/local/%{name}/share,@datadir@,g
251 # we want all authorized users have default access
253 ' sample-config/*.cfg.in
257 # s,/usr/local/%{name}/var/archives/,/var/log/%{name}/archives/,
258 #' html/docs/configmain.html
261 cp -f /usr/share/automake/config.sub .
265 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
266 --bindir=%{_sbindir} \
267 --sbindir=%{cgidir} \
268 --datadir=%{htmldir} \
269 --with-nagios-user=%{name} \
270 --with-nagios-grp=%{name} \
271 --with-command-user=%{name} \
272 --with-command-grp=%{name} \
273 --with-lockfile=%{_localstatedir}/%{name}.pid \
274 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
275 --with-ping_command='/bin/ping -n %%s -c %%d' \
276 %{!?with_gd:--disable-statusmap --disable-trends} \
277 %{?with_epn:--enable-embedded-perl --with-perlcache} \
278 %{?with_tests:--enable-libtap} \
279 --enable-event-broker
284 %{__make} -C contrib mini_epn
287 %{?with_tests:%{__make} test}
290 rm -rf $RPM_BUILD_ROOT
291 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
292 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
293 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
294 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
295 %if "%{_lib}" != "lib"
296 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
299 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
300 cp -p include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
302 %{__make} install-unstripped \
303 DESTDIR=$RPM_BUILD_ROOT \
309 mv $RPM_BUILD_ROOT{%{_sbindir},%{_libdir}/%{name}}/p1.pl
310 install -d $RPM_BUILD_ROOT%{_bindir}
311 install -p contrib/mini_epn $RPM_BUILD_ROOT%{_bindir}
314 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
315 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
317 # install templated configuration files
318 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
319 cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
323 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
324 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
325 cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
326 cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
327 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
328 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
329 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
330 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
331 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
333 # install event handlers, sample config
334 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
335 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
336 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
337 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
340 install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d
341 cp -a sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg
343 # Object data/cache files
344 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
345 > $RPM_BUILD_ROOT%{_localstatedir}/$i
347 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
349 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
350 mv $RPM_BUILD_ROOT{%{htmldir}/docs/*,%{_docdir}/%{name}}
353 rm -rf $RPM_BUILD_ROOT
356 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
357 [ ! -f $i ] && touch $i
362 /sbin/chkconfig --add %{name}
363 %service %{name} restart "Nagios service"
366 if [ "$1" = "0" ] ; then
367 %service %{name} stop
368 /sbin/chkconfig --del %{name}
372 # rename group netsaint -> nagios
373 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
374 /usr/sbin/groupmod -n nagios netsaint
376 # rename group nagios-data -> nagcmd
377 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
378 /usr/sbin/groupmod -n nagcmd nagios-data
380 %groupadd -g 72 nagios
381 %groupadd -g 147 -f nagcmd
382 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
383 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
385 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
388 if [ "$1" = "0" ]; then
395 if [ "$1" = 1 ]; then
396 %banner %{name} -e <<EOF
398 You need to add user to %{_webapps}/%{_webapp}/passwd and
399 %{_webapps}/%{_webapp}/group to access Nagios via web.
404 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
405 %addusertogroup http nagcmd
406 %webapp_register apache %{_webapp}
408 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
409 %webapp_unregister apache %{_webapp}
411 %triggerin cgi -- apache < 2.2.0, apache-base
412 %addusertogroup http nagcmd
413 %webapp_register httpd %{_webapp}
415 %triggerun cgi -- apache < 2.2.0, apache-base
416 %webapp_unregister httpd %{_webapp}
418 %triggerin cgi -- lighttpd
419 %addusertogroup lighttpd nagcmd
420 %webapp_register lighttpd %{_webapp}
422 %triggerun cgi -- lighttpd
423 %webapp_unregister lighttpd %{_webapp}
425 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
426 chown root:http %{_sysconfdir}/cgi.cfg
428 %triggerpostun -- nagios < 3.1.2-4
430 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
431 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
432 mv -f %{_sysconfdir}/$a{.rpmsave,}
435 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
438 %defattr(644,root,root,755)
439 %doc Changelog README* UPGRADING INSTALLING LICENSE
440 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
442 # leave main nagios config readable for -cgi.
443 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
445 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
446 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
447 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
448 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
449 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
450 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
452 %attr(754,root,root) /etc/rc.d/init.d/%{name}
453 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
455 %attr(755,root,root) %{_sbindir}/%{name}
456 %attr(755,root,root) %{_sbindir}/nagiostats
457 %dir %{_libdir}/%{name}/brokers
459 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
460 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
462 %attr(770,root,nagcmd) %dir %{_localstatedir}
463 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
464 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
465 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
466 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
467 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
468 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
469 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
471 %attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
473 %{_examplesdir}/%{name}-%{version}
477 %attr(755,root,root) %{_libdir}/%{name}/p1.pl
478 %attr(755,root,root) %{_bindir}/mini_epn
482 %defattr(644,root,root,755)
483 %attr(750,root,nagcmd) %dir %{_sysconfdir}
484 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
485 %dir %{_libdir}/%{name}
486 %dir %{_libdir}/%{name}/plugins
487 %dir %{_libdir}/%{name}/eventhandlers
489 %if "%{_lib}" != "lib"
490 %dir %{_prefix}/lib/%{name}
491 %dir %{_prefix}/lib/%{name}/plugins
492 %dir %{_prefix}/lib/%{name}/eventhandlers
495 %attr(770,root,nagios) %dir %{_var}/spool/%{name}
498 %defattr(644,root,root,755)
499 %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg
502 %defattr(644,root,root,755)
506 %defattr(644,root,root,755)
507 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
508 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
509 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
510 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
511 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
512 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
513 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
515 %attr(755,root,root) %{cgidir}/*.cgi
518 %dir %{htmldir}/includes
519 %dir %{htmldir}/images
520 %dir %{htmldir}/stylesheets
521 %{htmldir}/robots.txt
522 %{htmldir}/contexthelp
525 %{htmldir}/images/favicon.ico
526 %{htmldir}/images/marker.png
527 %{htmldir}/images/shadow50.png
530 %defattr(644,root,root,755)
532 %{htmldir}/includes/*
534 %exclude %{htmldir}/images/favicon.ico
535 %exclude %{htmldir}/images/marker.png
536 %exclude %{htmldir}/images/shadow50.png
537 %{htmldir}/stylesheets/*
540 %defattr(644,root,root,755)
541 %dir %{_includedir}/%{name}
542 %{_includedir}/%{name}/*.h