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: fe1be46e6976a52acdb021a782b5d04b
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.
205 find -name .cvsignore -o -name .gitignore | xargs rm
207 mv nagios-config-*/objects/*.cfg sample-config/template-object
208 mv nagios-config-*/*.cfg sample-config
210 # cleanup backups after patching
211 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
214 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
215 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
216 ' $(find contrib/eventhandlers -type f)
218 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
219 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
223 # kill trailing spaces
226 s,/usr/local/%{name}/share,@datadir@,g
227 # we want all authorized users have default access
229 ' sample-config/*.cfg.in
233 s,/usr/local/%{name}/var/archives/,/var/log/%{name}/archives/,
234 ' html/docs/configmain.html
237 cp -f /usr/share/automake/config.sub .
241 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
242 --bindir=%{_sbindir} \
243 --sbindir=%{cgidir} \
244 --datadir=%{htmldir} \
245 --with-nagios-user=%{name} \
246 --with-nagios-grp=%{name} \
247 --with-command-user=%{name} \
248 --with-command-grp=%{name} \
249 --with-lockfile=%{_localstatedir}/%{name}.pid \
250 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
251 --with-ping_command='/bin/ping -n %%s -c %%d' \
252 %{!?with_gd:--disable-statusmap --disable-trends} \
253 %{?with_tests:--enable-libtap} \
254 --enable-event-broker
258 %{?with_tests:%{__make} test}
261 rm -rf $RPM_BUILD_ROOT
262 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
263 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
264 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
265 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
266 %if "%{_lib}" != "lib"
267 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
270 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
271 cp -a include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
273 %{__make} install-unstripped \
274 DESTDIR=$RPM_BUILD_ROOT \
279 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
280 cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
282 # install templated configuration files
283 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
284 cp -a sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
288 cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
289 cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
290 cp -a lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
291 cp -a sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
292 cp -a %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
293 cp -a %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
294 cp -a %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
295 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
296 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
298 # install event handlers, sample config
299 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
300 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
301 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
302 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
304 # Object data/cache files
305 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
306 > $RPM_BUILD_ROOT%{_localstatedir}/$i
308 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
310 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
311 mv $RPM_BUILD_ROOT{%{htmldir}/docs/*,%{_docdir}/%{name}}
314 rm -rf $RPM_BUILD_ROOT
317 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
318 [ ! -f $i ] && touch $i
323 /sbin/chkconfig --add %{name}
324 %service %{name} restart "Nagios service"
327 if [ "$1" = "0" ] ; then
328 %service %{name} stop
329 /sbin/chkconfig --del %{name}
333 # rename group netsaint -> nagios
334 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
335 /usr/sbin/groupmod -n nagios netsaint
337 # rename group nagios-data -> nagcmd
338 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
339 /usr/sbin/groupmod -n nagcmd nagios-data
341 %groupadd -g 72 nagios
342 %groupadd -g 147 -f nagcmd
343 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
344 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
346 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
349 if [ "$1" = "0" ]; then
356 if [ "$1" = 1 ]; then
357 %banner %{name} -e <<EOF
359 You need to add user to %{_webapps}/%{_webapp}/passwd and
360 %{_webapps}/%{_webapp}/group to access Nagios via web.
365 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
366 %addusertogroup http nagcmd
367 %webapp_register apache %{_webapp}
369 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
370 %webapp_unregister apache %{_webapp}
372 %triggerin cgi -- apache < 2.2.0, apache-base
373 %addusertogroup http nagcmd
374 %webapp_register httpd %{_webapp}
376 %triggerun cgi -- apache < 2.2.0, apache-base
377 %webapp_unregister httpd %{_webapp}
379 %triggerin cgi -- lighttpd
380 %addusertogroup lighttpd nagcmd
381 %webapp_register lighttpd %{_webapp}
383 %triggerun cgi -- lighttpd
384 %webapp_unregister lighttpd %{_webapp}
386 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
387 chown root:http %{_sysconfdir}/cgi.cfg
389 %triggerpostun -- nagios < 3.1.2-4
391 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
392 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
393 mv -f %{_sysconfdir}/$a{.rpmsave,}
396 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
399 %defattr(644,root,root,755)
400 %doc Changelog README* UPGRADING INSTALLING LICENSE
401 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
403 # leave main nagios config readable for -cgi.
404 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
406 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
407 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
408 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
409 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
410 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
411 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
413 %attr(754,root,root) /etc/rc.d/init.d/%{name}
414 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
416 %attr(755,root,root) %{_sbindir}/%{name}
417 %attr(755,root,root) %{_sbindir}/nagiostats
418 %dir %{_libdir}/%{name}/brokers
420 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
421 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
423 %attr(770,root,nagcmd) %dir %{_localstatedir}
424 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
425 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
426 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
427 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
428 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
429 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
430 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
432 %attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
434 %{_examplesdir}/%{name}-%{version}
437 %defattr(644,root,root,755)
438 %attr(750,root,nagcmd) %dir %{_sysconfdir}
439 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
440 %dir %{_libdir}/%{name}
441 %dir %{_libdir}/%{name}/plugins
442 %dir %{_libdir}/%{name}/eventhandlers
444 %if "%{_lib}" != "lib"
445 %dir %{_prefix}/lib/%{name}
446 %dir %{_prefix}/lib/%{name}/plugins
447 %dir %{_prefix}/lib/%{name}/eventhandlers
450 %attr(770,root,nagios) %dir %{_var}/spool/%{name}
453 %defattr(644,root,root,755)
457 %defattr(644,root,root,755)
458 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
459 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
460 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
461 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
462 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
463 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
464 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
466 %attr(755,root,root) %{cgidir}/*.cgi
469 %dir %{htmldir}/includes
470 %dir %{htmldir}/images
471 %dir %{htmldir}/stylesheets
472 %{htmldir}/robots.txt
473 %{htmldir}/contexthelp
476 %{htmldir}/images/favicon.ico
477 %{htmldir}/images/marker.png
478 %{htmldir}/images/shadow50.png
481 %defattr(644,root,root,755)
483 %{htmldir}/includes/*
485 %exclude %{htmldir}/images/favicon.ico
486 %exclude %{htmldir}/images/marker.png
487 %exclude %{htmldir}/images/shadow50.png
488 %{htmldir}/stylesheets/*
491 %defattr(644,root,root,755)
492 %dir %{_includedir}/%{name}
493 %{_includedir}/%{name}/*.h