2 # - /var/log/nagios/archives -> /var/log/archive/nagios
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
9 Summary: Host/service/network monitoring program
10 Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci
11 Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços
17 Source0: http://downloads.sourceforge.net/nagios/%{name}-%{version}.tar.gz
18 # Source0-md5: c935354ce0d78a63bfabc3055fa77ad5
19 Source1: %{name}-apache.conf
21 Source3: %{name}.sysconfig
22 Source4: %{name}-config-20090914.tar.bz2
23 # Source4-md5: 605f1cd28c00db961dad6f529d849f16
24 Source5: %{name}-lighttpd.conf
25 Source6: http://www.google.com/mapfiles/shadow50.png
26 # Source6-md5: eff99f302f21b95a900d321743fce72b
27 Source7: http://www.google.com/mapfiles/marker.png
28 # Source7-md5: edefef4bdfc29e1c953694651f05b466
30 Patch0: %{name}-resources.patch
31 Patch1: %{name}-iconv-in-libc.patch
32 Patch2: %{name}-webapps.patch
33 Patch3: %{name}-cgi-http_charset.patch
34 Patch4: %{name}-cmd-typo.patch
36 Patch6: %{name}-googlemap.patch
37 Patch7: %{name}-doc-usermacros.patch
38 Patch8: archivelog-timeformat.patch
39 URL: http://www.nagios.org/
40 BuildRequires: autoconf
41 BuildRequires: automake
43 BuildRequires: gd-devel
44 BuildRequires: libjpeg-devel
45 BuildRequires: libpng-devel
47 BuildRequires: rpmbuild(macros) >= 1.268
48 BuildRequires: sed >= 4.0
49 Requires(post,preun): /sbin/chkconfig
50 Requires: %{name}-common = %{version}-%{release}
53 Suggests: nagios-notify >= 0.13
54 Suggests: nagios-plugin-check_load
55 Suggests: nagios-plugin-check_ping
56 Suggests: nagios-plugins
59 Conflicts: iputils-ping < 1:ss020124
60 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
62 %define _sysconfdir /etc/%{name}
63 %define cgidir %{_libdir}/%{name}/cgi
64 %define htmldir %{_prefix}/share/%{name}
65 %define _localstatedir /var/lib/%{name}
66 %define _webapps /etc/webapps
67 %define _webapp %{name}
70 Nagios is a program that will monitor hosts and services on your
71 network. It has the ability to email or page you when a problem arises
72 and when a problem is resolved. Nagios is written in C and is designed
73 to run under Linux (and some other *NIX variants) as a background
74 process, intermittently running checks on various services that you
77 The actual service checks are performed by separate "plugin" programs
78 which return the status of the checks to Nagios. The plugins are
79 available in nagios-plugins packages.
81 Nagios is successor to NetSaint.
83 %description -l pl.UTF-8
84 Nagios to program, który monitoruje serwery oraz usługi w naszej
85 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
86 rozwiązaniu problemu. Nagios został napisany w C oraz jest
87 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
88 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
91 Właściwe sprawdzanie jest wykonywane przez osobne programy
92 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
93 są dostępne na stronie w pakietach nagios-plugins.
95 Nagios jest następcą NetSainta.
97 %description -l pt_BR.UTF-8
98 O Nagios é um programa que monitora máquinas e serviços na sua rede.
99 Ele pode enviar um email ou um aviso de pager para o administrador
100 quando surgir um problema e quando ele for resolvido. Nagios é escrito
101 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
102 variações de *NIX) como um processo em segundo plano, periodicamente
103 executando checagens nos diversos serviços que forem especificados.
106 Summary: Common files needed by both nagios and nrpe
107 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
109 Requires(postun): /usr/sbin/groupdel
110 Requires(postun): /usr/sbin/userdel
111 Requires(pre): /bin/id
112 Requires(pre): /usr/bin/getgid
113 Requires(pre): /usr/sbin/groupadd
114 Requires(pre): /usr/sbin/groupmod
115 Requires(pre): /usr/sbin/useradd
116 Requires(pre): /usr/sbin/usermod
117 Provides: group(nagcmd)
118 Provides: group(nagios)
119 Provides: user(nagios)
122 Common files needed by both nagios and nrpe.
124 %description common -l pl.UTF-8
125 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
128 Summary: CGI webinterface for Nagios
129 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
130 Group: Applications/WWW
131 # for dirs... and accessing local logs, nagios config
132 Requires: %{name} = %{version}-%{release}
133 Requires: %{name}-imagepaks
134 Requires: %{name}-theme
135 Requires: group(http)
138 Requires: webserver(access)
139 Requires: webserver(alias)
140 Requires: webserver(auth)
141 Requires: webserver(cgi)
142 Requires: webserver(indexfile)
143 Suggests: %{name}-doc
146 CGI webinterface for Nagios.
148 %description cgi -l pl.UTF-8
149 Interfejs CGI dla Nagiosa.
152 Summary: HTML Documentation for Nagios
154 # does not require base
157 HTML Documentation for Nagios.
159 %package theme-default
160 Summary: Default Nagios theme
161 Summary(pl.UTF-8): Domyślny motyw Nagiosa
162 Group: Applications/WWW
163 Requires: %{name}-cgi = %{version}-%{release}
164 Requires: webserver(php)
165 Provides: nagios-theme
166 Obsoletes: nagios-theme
168 %description theme-default
169 Original theme from Nagios.
171 %description theme-default -l pl.UTF-8
172 Oryginalny motyw z Nagiosa.
175 Summary: Include files that Nagios-related applications may compile against
176 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
177 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
178 Group: Development/Libraries
179 # doesn't require base
182 This package provides include files that Nagios-related applications
185 %description devel -l pl.UTF-8
186 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
187 przez aplikacje związane z nagiosem podczas kompilacji.
189 %description devel -l pt_BR.UTF-8
190 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
191 aplicativos para o Nagios.
194 %setup -q -a4 -n %{name}
209 find -name .cvsignore -o -name .gitignore | xargs rm
211 mv nagios-config-*/objects/*.cfg sample-config/template-object
212 mv nagios-config-*/*.cfg sample-config
214 # cleanup backups after patching
215 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
218 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
219 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
220 ' $(find contrib/eventhandlers -type f)
222 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
223 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
227 # kill trailing spaces
230 s,/usr/local/%{name}/share,@datadir@,g
231 # we want all authorized users have default access
233 ' sample-config/*.cfg.in
237 # s,/usr/local/%{name}/var/archives/,/var/log/%{name}/archives/,
238 #' html/docs/configmain.html
241 cp -f /usr/share/automake/config.sub .
245 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
246 --bindir=%{_sbindir} \
247 --sbindir=%{cgidir} \
248 --datadir=%{htmldir} \
249 --with-nagios-user=%{name} \
250 --with-nagios-grp=%{name} \
251 --with-command-user=%{name} \
252 --with-command-grp=%{name} \
253 --with-lockfile=%{_localstatedir}/%{name}.pid \
254 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
255 --with-ping_command='/bin/ping -n %%s -c %%d' \
256 %{!?with_gd:--disable-statusmap --disable-trends} \
257 %{?with_tests:--enable-libtap} \
258 --enable-event-broker
262 %{?with_tests:%{__make} test}
265 rm -rf $RPM_BUILD_ROOT
266 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
267 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
268 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
269 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
270 %if "%{_lib}" != "lib"
271 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
274 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
275 cp -a include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
277 %{__make} install-unstripped \
278 DESTDIR=$RPM_BUILD_ROOT \
283 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
284 cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
286 # install templated configuration files
287 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
288 cp -a sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
292 cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
293 cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
294 cp -a lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
295 cp -a sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
296 cp -a %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
297 cp -a %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
298 cp -a %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
299 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
300 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
302 # install event handlers, sample config
303 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
304 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
305 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
306 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
308 # Object data/cache files
309 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
310 > $RPM_BUILD_ROOT%{_localstatedir}/$i
312 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
314 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
315 mv $RPM_BUILD_ROOT{%{htmldir}/docs/*,%{_docdir}/%{name}}
318 rm -rf $RPM_BUILD_ROOT
321 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
322 [ ! -f $i ] && touch $i
327 /sbin/chkconfig --add %{name}
328 %service %{name} restart "Nagios service"
331 if [ "$1" = "0" ] ; then
332 %service %{name} stop
333 /sbin/chkconfig --del %{name}
337 # rename group netsaint -> nagios
338 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
339 /usr/sbin/groupmod -n nagios netsaint
341 # rename group nagios-data -> nagcmd
342 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
343 /usr/sbin/groupmod -n nagcmd nagios-data
345 %groupadd -g 72 nagios
346 %groupadd -g 147 -f nagcmd
347 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
348 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
350 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
353 if [ "$1" = "0" ]; then
360 if [ "$1" = 1 ]; then
361 %banner %{name} -e <<EOF
363 You need to add user to %{_webapps}/%{_webapp}/passwd and
364 %{_webapps}/%{_webapp}/group to access Nagios via web.
369 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
370 %addusertogroup http nagcmd
371 %webapp_register apache %{_webapp}
373 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
374 %webapp_unregister apache %{_webapp}
376 %triggerin cgi -- apache < 2.2.0, apache-base
377 %addusertogroup http nagcmd
378 %webapp_register httpd %{_webapp}
380 %triggerun cgi -- apache < 2.2.0, apache-base
381 %webapp_unregister httpd %{_webapp}
383 %triggerin cgi -- lighttpd
384 %addusertogroup lighttpd nagcmd
385 %webapp_register lighttpd %{_webapp}
387 %triggerun cgi -- lighttpd
388 %webapp_unregister lighttpd %{_webapp}
390 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
391 chown root:http %{_sysconfdir}/cgi.cfg
393 %triggerpostun -- nagios < 3.1.2-4
395 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
396 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
397 mv -f %{_sysconfdir}/$a{.rpmsave,}
400 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
403 %defattr(644,root,root,755)
404 %doc Changelog README* UPGRADING INSTALLING LICENSE
405 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
407 # leave main nagios config readable for -cgi.
408 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
410 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
411 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
412 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
413 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
414 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
415 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
417 %attr(754,root,root) /etc/rc.d/init.d/%{name}
418 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
420 %attr(755,root,root) %{_sbindir}/%{name}
421 %attr(755,root,root) %{_sbindir}/nagiostats
422 %dir %{_libdir}/%{name}/brokers
424 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
425 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
427 %attr(770,root,nagcmd) %dir %{_localstatedir}
428 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
429 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
430 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
431 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
432 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
433 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
434 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
436 %attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
438 %{_examplesdir}/%{name}-%{version}
441 %defattr(644,root,root,755)
442 %attr(750,root,nagcmd) %dir %{_sysconfdir}
443 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
444 %dir %{_libdir}/%{name}
445 %dir %{_libdir}/%{name}/plugins
446 %dir %{_libdir}/%{name}/eventhandlers
448 %if "%{_lib}" != "lib"
449 %dir %{_prefix}/lib/%{name}
450 %dir %{_prefix}/lib/%{name}/plugins
451 %dir %{_prefix}/lib/%{name}/eventhandlers
454 %attr(770,root,nagios) %dir %{_var}/spool/%{name}
457 %defattr(644,root,root,755)
461 %defattr(644,root,root,755)
462 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
463 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
464 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
465 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
466 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
467 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
468 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
470 %attr(755,root,root) %{cgidir}/*.cgi
473 %dir %{htmldir}/includes
474 %dir %{htmldir}/images
475 %dir %{htmldir}/stylesheets
476 %{htmldir}/robots.txt
477 %{htmldir}/contexthelp
480 %{htmldir}/images/favicon.ico
481 %{htmldir}/images/marker.png
482 %{htmldir}/images/shadow50.png
485 %defattr(644,root,root,755)
487 %{htmldir}/includes/*
489 %exclude %{htmldir}/images/favicon.ico
490 %exclude %{htmldir}/images/marker.png
491 %exclude %{htmldir}/images/shadow50.png
492 %{htmldir}/stylesheets/*
495 %defattr(644,root,root,755)
496 %dir %{_includedir}/%{name}
497 %{_includedir}/%{name}/*.h