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-classicui
173 Summary: ClassicUI Nagios theme
174 Group: Applications/WWW
175 Requires: %{name}-cgi = %{version}-%{release}
176 Requires: webserver(php)
177 Provides: nagios-theme
178 Obsoletes: nagios-theme
180 %description theme-classicui
181 Original theme from Nagios.
183 %description theme-classicui -l pl.UTF-8
184 Oryginalny motyw z Nagiosa.
186 %package theme-default
187 Summary: Virtual package to handle Nagios theme migration
188 Group: Applications/WWW
189 Requires: nagios-theme
190 Obsoletes: nagios-theme-default < 3.3.1-1.4
192 %description theme-default
193 Virtual package to handle Nagios theme migration
196 Summary: Include files that Nagios-related applications may compile against
197 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
198 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
199 Group: Development/Libraries
200 # doesn't require base
203 This package provides include files that Nagios-related applications
206 %description devel -l pl.UTF-8
207 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
208 przez aplikacje związane z nagiosem podczas kompilacji.
210 %description devel -l pt_BR.UTF-8
211 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
212 aplicativos para o Nagios.
233 find -name .cvsignore -o -name .gitignore | xargs rm
235 mv nagios-config-*/objects/*.cfg sample-config/template-object
236 mv nagios-config-*/*.cfg sample-config
238 # cleanup backups after patching
239 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
242 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
243 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
244 ' $(find contrib/eventhandlers -type f)
247 s,/usr/local/nagios/var/,/var/log/%{name}/,g
250 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
251 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
255 # kill trailing spaces
258 s,/usr/local/%{name}/share,@datadir@,g
259 # we want all authorized users have default access
261 ' sample-config/*.cfg.in
265 # s,/usr/local/%{name}/var/archives/,/var/log/%{name}/archives/,
266 #' html/docs/configmain.html
269 cp -f /usr/share/automake/config.sub .
273 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
274 --bindir=%{_sbindir} \
275 --sbindir=%{cgidir} \
276 --datadir=%{htmldir} \
277 --with-nagios-user=%{name} \
278 --with-nagios-grp=%{name} \
279 --with-command-user=%{name} \
280 --with-command-grp=%{name} \
281 --with-lockfile=%{_localstatedir}/%{name}.pid \
282 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
283 --with-ping_command='/bin/ping -n %%s -c %%d' \
284 %{!?with_gd:--disable-statusmap --disable-trends} \
285 %{?with_epn:--enable-embedded-perl --with-perlcache} \
286 %{?with_tests:--enable-libtap} \
287 --enable-event-broker
292 %{__make} -C contrib mini_epn
295 %{?with_tests:%{__make} test}
298 rm -rf $RPM_BUILD_ROOT
299 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
300 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
301 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
302 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
303 %if "%{_lib}" != "lib"
304 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
307 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
308 cp -p include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
310 %{__make} install-unstripped \
311 DESTDIR=$RPM_BUILD_ROOT \
317 mv $RPM_BUILD_ROOT{%{_sbindir},%{_libdir}/%{name}}/p1.pl
318 install -d $RPM_BUILD_ROOT%{_bindir}
319 install -p contrib/mini_epn $RPM_BUILD_ROOT%{_bindir}
322 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
323 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
325 # install templated configuration files
326 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
327 cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
331 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
332 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
333 cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
334 cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
335 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
336 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
337 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
338 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
339 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
341 # install event handlers, sample config
342 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
343 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
344 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
345 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
348 install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d
349 cp -a sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg
351 # Object data/cache files
352 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
353 > $RPM_BUILD_ROOT%{_localstatedir}/$i
355 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
357 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
358 mv $RPM_BUILD_ROOT{%{htmldir}/docs/*,%{_docdir}/%{name}}
361 rm -rf $RPM_BUILD_ROOT
364 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
365 [ ! -f $i ] && touch $i
370 /sbin/chkconfig --add %{name}
371 %service %{name} restart "Nagios service"
374 if [ "$1" = "0" ] ; then
375 %service %{name} stop
376 /sbin/chkconfig --del %{name}
380 # rename group netsaint -> nagios
381 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
382 /usr/sbin/groupmod -n nagios netsaint
384 # rename group nagios-data -> nagcmd
385 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
386 /usr/sbin/groupmod -n nagcmd nagios-data
388 %groupadd -g 72 nagios
389 %groupadd -g 147 -f nagcmd
390 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
391 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
393 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
396 if [ "$1" = "0" ]; then
403 if [ "$1" = 1 ]; then
404 %banner %{name} -e <<EOF
406 You need to add user to %{_webapps}/%{_webapp}/passwd and
407 %{_webapps}/%{_webapp}/group to access Nagios via web.
412 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
413 %addusertogroup http nagcmd
414 %webapp_register apache %{_webapp}
416 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
417 %webapp_unregister apache %{_webapp}
419 %triggerin cgi -- apache < 2.2.0, apache-base
420 %addusertogroup http nagcmd
421 %webapp_register httpd %{_webapp}
423 %triggerun cgi -- apache < 2.2.0, apache-base
424 %webapp_unregister httpd %{_webapp}
426 %triggerin cgi -- lighttpd
427 %addusertogroup lighttpd nagcmd
428 %webapp_register lighttpd %{_webapp}
430 %triggerun cgi -- lighttpd
431 %webapp_unregister lighttpd %{_webapp}
433 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
434 chown root:http %{_sysconfdir}/cgi.cfg
436 %triggerpostun -- nagios < 3.1.2-4
438 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
439 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
440 mv -f %{_sysconfdir}/$a{.rpmsave,}
443 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
446 %defattr(644,root,root,755)
447 %doc Changelog README* UPGRADING INSTALLING LICENSE
448 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
450 # leave main nagios config readable for -cgi.
451 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
453 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
454 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
455 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
456 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
457 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
458 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
460 %attr(754,root,root) /etc/rc.d/init.d/%{name}
461 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
463 %attr(755,root,root) %{_sbindir}/%{name}
464 %attr(755,root,root) %{_sbindir}/nagiostats
465 %dir %{_libdir}/%{name}/brokers
467 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
468 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
470 %attr(770,root,nagcmd) %dir %{_localstatedir}
471 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
472 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
473 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
474 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
475 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
476 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
477 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
479 %attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
481 %{_examplesdir}/%{name}-%{version}
485 %attr(755,root,root) %{_libdir}/%{name}/p1.pl
486 %attr(755,root,root) %{_bindir}/mini_epn
490 %defattr(644,root,root,755)
491 %attr(750,root,nagcmd) %dir %{_sysconfdir}
492 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
493 %dir %{_libdir}/%{name}
494 %dir %{_libdir}/%{name}/plugins
495 %dir %{_libdir}/%{name}/eventhandlers
497 %if "%{_lib}" != "lib"
498 %dir %{_prefix}/lib/%{name}
499 %dir %{_prefix}/lib/%{name}/plugins
500 %dir %{_prefix}/lib/%{name}/eventhandlers
503 %attr(770,root,nagios) %dir %{_var}/spool/%{name}
506 %defattr(644,root,root,755)
507 %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg
510 %defattr(644,root,root,755)
514 %defattr(644,root,root,755)
515 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
516 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
517 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
518 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
519 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
520 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
521 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
523 %attr(755,root,root) %{cgidir}/*.cgi
526 %dir %{htmldir}/includes
527 %dir %{htmldir}/images
528 %dir %{htmldir}/stylesheets
529 %{htmldir}/robots.txt
530 %{htmldir}/contexthelp
533 %{htmldir}/images/favicon.ico
534 %{htmldir}/images/marker.png
535 %{htmldir}/images/shadow50.png
537 %files theme-classicui
538 %defattr(644,root,root,755)
540 %{htmldir}/includes/*
542 %exclude %{htmldir}/images/favicon.ico
543 %exclude %{htmldir}/images/marker.png
544 %exclude %{htmldir}/images/shadow50.png
545 %{htmldir}/stylesheets/*
548 %defattr(644,root,root,755)
551 %defattr(644,root,root,755)
552 %dir %{_includedir}/%{name}
553 %{_includedir}/%{name}/*.h