2 # - /var/log/nagios/archives -> /var/log/archive/nagios
5 %bcond_without gd # without statusmap and trends, which require gd library
6 %bcond_with epn # with 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/nagios-4.x/%{name}-%{version}/%{name}-%{version}.tar.gz
19 # Source0-md5: bfe64774766e32b6f6130493c52ed7f6
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 Source9: %{name}wall.php
32 Source10: %{name}-httpd.conf
33 Patch0: %{name}-resources.patch
34 Patch1: %{name}-iconv-in-libc.patch
35 Patch2: %{name}-webapps.patch
36 Patch3: %{name}-cgi-http_charset.patch
37 Patch4: %{name}-cmd-typo.patch
39 Patch6: %{name}-googlemap.patch
40 Patch7: %{name}-doc-usermacros.patch
41 Patch8: archivelog-timeformat.patch
42 Patch9: system-magpierss.patch
43 Patch10: system-jquery.patch
44 Patch11: do-not-fetch-rss.patch
45 URL: http://www.nagios.org/
46 BuildRequires: autoconf
47 BuildRequires: automake
48 BuildRequires: rpmbuild(macros) >= 1.268
49 BuildRequires: sed >= 4.0
51 BuildRequires: gd-devel
52 BuildRequires: libjpeg-devel
53 BuildRequires: libpng-devel
56 BuildRequires: perl-HTML-Lint
57 BuildRequires: perl-Test-WWW-Mechanize-CGI
59 Requires(post,preun): /sbin/chkconfig
60 Requires: %{name}-common = %{version}-%{release}
61 Requires: rc-scripts >= 0.4.5.5
63 Suggests: nagios-notify >= 0.13
64 Suggests: nagios-plugin-check_load
65 Suggests: nagios-plugin-check_ping
66 Suggests: nagios-plugins
69 Conflicts: iputils-ping < 1:ss020124
70 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
72 %define _sysconfdir /etc/%{name}
73 %define cgidir %{_libdir}/%{name}/cgi
74 %define htmldir %{_prefix}/share/%{name}
75 %define _localstatedir /var/lib/%{name}
76 %define _webapps /etc/webapps
77 %define _webapp %{name}
80 Nagios is a program that will monitor hosts and services on your
81 network. It has the ability to email or page you when a problem arises
82 and when a problem is resolved. Nagios is written in C and is designed
83 to run under Linux (and some other *NIX variants) as a background
84 process, intermittently running checks on various services that you
87 The actual service checks are performed by separate "plugin" programs
88 which return the status of the checks to Nagios. The plugins are
89 available in nagios-plugins packages.
91 Nagios is successor to NetSaint.
93 %description -l pl.UTF-8
94 Nagios to program, który monitoruje serwery oraz usługi w naszej
95 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
96 rozwiązaniu problemu. Nagios został napisany w C oraz jest
97 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
98 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
101 Właściwe sprawdzanie jest wykonywane przez osobne programy
102 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
103 są dostępne na stronie w pakietach nagios-plugins.
105 Nagios jest następcą NetSainta.
107 %description -l pt_BR.UTF-8
108 O Nagios é um programa que monitora máquinas e serviços na sua rede.
109 Ele pode enviar um email ou um aviso de pager para o administrador
110 quando surgir um problema e quando ele for resolvido. Nagios é escrito
111 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
112 variações de *NIX) como um processo em segundo plano, periodicamente
113 executando checagens nos diversos serviços que forem especificados.
116 Summary: Common files needed by both nagios and nrpe
117 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
119 Requires(postun): /usr/sbin/groupdel
120 Requires(postun): /usr/sbin/userdel
121 Requires(pre): /bin/id
122 Requires(pre): /usr/bin/getgid
123 Requires(pre): /usr/sbin/groupadd
124 Requires(pre): /usr/sbin/groupmod
125 Requires(pre): /usr/sbin/useradd
126 Requires(pre): /usr/sbin/usermod
127 Provides: group(nagcmd)
128 Provides: group(nagios)
129 Provides: user(nagios)
132 Common files needed by both nagios and nrpe.
134 %description common -l pl.UTF-8
135 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
138 Summary: CGI webinterface for Nagios
139 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
140 Group: Applications/WWW
141 # for dirs... and accessing local logs, nagios config
142 Requires: %{name} = %{version}-%{release}
143 Requires: %{name}-imagepaks
144 Requires: %{name}-theme
145 Requires: group(http)
149 Requires: webserver(access)
150 Requires: webserver(alias)
151 Requires: webserver(auth)
152 Requires: webserver(cgi)
153 Requires: webserver(indexfile)
154 Suggests: %{name}-doc
155 Suggests: php-magpierss >= 0.72
156 Conflicts: apache-base < 2.4.0-1
159 CGI webinterface for Nagios.
161 %description cgi -l pl.UTF-8
162 Interfejs CGI dla Nagiosa.
165 Summary: MRTG Graphs: Nagios Statistics
166 Group: Applications/Networking
167 Requires: %{name} = %{version}-%{release}
170 %description mrtggraphs
171 This pacakge graphs several Nagios statistics which can be useful for
172 debugging and trending purposes. The nagiostats binary is used to
176 Summary: HTML Documentation for Nagios
178 # does not require base
181 HTML Documentation for Nagios.
183 %package theme-classicui
184 Summary: ClassicUI Nagios theme
185 Group: Applications/WWW
186 Requires: %{name}-cgi = %{version}-%{release}
187 Requires: webserver(php)
188 Provides: nagios-theme
189 Obsoletes: nagios-theme
191 %description theme-classicui
192 Original theme from Nagios.
194 %description theme-classicui -l pl.UTF-8
195 Oryginalny motyw z Nagiosa.
197 %package theme-default
198 Summary: Virtual package to handle Nagios theme migration
199 Group: Applications/WWW
200 Requires: nagios-theme
201 Suggests: nagios-theme-classicui
202 Suggests: nagios-theme-exfoliation
203 Suggests: nagios-theme-nuvola
204 Obsoletes: nagios-theme-default < 3.3.1-1.4
206 %description theme-default
207 Virtual package to handle Nagios theme migration
210 Summary: Include files that Nagios-related applications may compile against
211 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
212 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
213 Group: Development/Libraries
214 # doesn't require base
217 This package provides include files that Nagios-related applications
220 %description devel -l pl.UTF-8
221 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
222 przez aplikacje związane z nagiosem podczas kompilacji.
224 %description devel -l pt_BR.UTF-8
225 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
226 aplicativos para o Nagios.
248 find -name .cvsignore -o -name .gitignore | xargs rm
250 mv nagios-config-*/objects/*.cfg sample-config/template-object
251 mv nagios-config-*/*.cfg sample-config
253 # cleanup backups after patching
254 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
257 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
258 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
259 ' $(find contrib/eventhandlers -type f)
261 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
262 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE10} > httpd.conf
263 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
267 # kill trailing spaces
270 s,/usr/local/%{name}/share,@datadir@,g
271 # we want all authorized users have default access
273 ' sample-config/*.cfg.in
277 # s,/usr/local/%{name}/var/archives/,/var/log/%{name}/archives/,
278 #' html/docs/configmain.html
280 #rm t/611cgistatus-hosturgencies.t
283 cp -f /usr/share/automake/config.sub .
294 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
295 --bindir=%{_sbindir} \
296 --sbindir=%{cgidir} \
297 --datadir=%{htmldir} \
298 --with-nagios-user=%{name} \
299 --with-nagios-grp=%{name} \
300 --with-command-user=%{name} \
301 --with-command-grp=%{name} \
302 --with-lockfile=%{_localstatedir}/%{name}.pid \
303 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
304 --with-ping_command='/bin/ping -n %%s -c %%d' \
305 %{!?with_gd:--disable-statusmap --disable-trends} \
306 %{?with_epn:--enable-embedded-perl --with-perlcache} \
307 %{?with_tests:--enable-libtap} \
308 --enable-event-broker
313 %{__make} -C contrib mini_epn
316 %{?with_tests:%{__make} test}
319 rm -rf $RPM_BUILD_ROOT
320 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
321 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
322 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
323 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
324 %if "%{_lib}" != "lib"
325 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
328 %{__make} install-unstripped install-headers \
329 DESTDIR=$RPM_BUILD_ROOT \
335 install -d $RPM_BUILD_ROOT%{_bindir}
336 install -p contrib/mini_epn $RPM_BUILD_ROOT%{_bindir}
339 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
340 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
342 # install templated configuration files
343 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
344 cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
348 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
349 cp -p httpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
350 cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
351 cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
352 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
353 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
354 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
355 cp -p %{SOURCE9} $RPM_BUILD_ROOT%{htmldir}
356 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
357 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
359 # install event handlers, sample config
360 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
361 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
362 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
363 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
366 install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d
367 cp -a sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg
369 # Object data/cache files
370 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
371 > $RPM_BUILD_ROOT%{_localstatedir}/$i
373 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
375 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
376 mv $RPM_BUILD_ROOT{%{htmldir}/docs/*,%{_docdir}/%{name}}
379 rm -rf $RPM_BUILD_ROOT
382 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
383 [ ! -f $i ] && touch $i
388 /sbin/chkconfig --add %{name}
389 %service %{name} restart "Nagios service"
392 if [ "$1" = "0" ] ; then
393 %service %{name} stop
394 /sbin/chkconfig --del %{name}
398 # rename group netsaint -> nagios
399 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
400 /usr/sbin/groupmod -n nagios netsaint
402 # rename group nagios-data -> nagcmd
403 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
404 /usr/sbin/groupmod -n nagcmd nagios-data
406 %groupadd -g 72 nagios
407 %groupadd -g 147 -f nagcmd
408 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
409 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
411 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
414 if [ "$1" = "0" ]; then
421 if [ "$1" = 1 ]; then
422 %banner %{name} -e <<EOF
424 You need to add user to %{_webapps}/%{_webapp}/passwd and
425 %{_webapps}/%{_webapp}/group to access Nagios via web.
430 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
431 %addusertogroup http nagcmd
432 %webapp_register apache %{_webapp}
434 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
435 %webapp_unregister apache %{_webapp}
437 %triggerin cgi -- apache-base
438 %addusertogroup http nagcmd
439 %webapp_register httpd %{_webapp}
441 %triggerun cgi -- apache-base
442 %webapp_unregister httpd %{_webapp}
444 %triggerin cgi -- lighttpd
445 %addusertogroup lighttpd nagcmd
446 %webapp_register lighttpd %{_webapp}
448 %triggerun cgi -- lighttpd
449 %webapp_unregister lighttpd %{_webapp}
451 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
452 chown root:http %{_sysconfdir}/cgi.cfg
454 %triggerpostun -- nagios < 3.1.2-4
456 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
457 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
458 mv -f %{_sysconfdir}/$a{.rpmsave,}
461 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
464 %defattr(644,root,root,755)
465 %doc Changelog README* UPGRADING INSTALLING LICENSE
466 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
468 # leave main nagios config readable for -cgi.
469 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
471 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
472 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
473 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
474 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
475 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
476 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
478 %attr(754,root,root) /etc/rc.d/init.d/%{name}
479 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
481 %attr(755,root,root) %{_sbindir}/%{name}
482 %attr(755,root,root) %{_sbindir}/nagiostats
483 %dir %{_libdir}/%{name}/brokers
485 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
486 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
488 %attr(770,root,nagcmd) %dir %{_localstatedir}
489 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
490 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
491 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
492 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
493 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
494 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
495 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
497 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}/checkresults
499 %{_examplesdir}/%{name}-%{version}
503 %attr(755,root,root) %{_bindir}/mini_epn
507 %defattr(644,root,root,755)
508 %attr(750,root,nagcmd) %dir %{_sysconfdir}
509 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
510 %dir %{_libdir}/%{name}
511 %dir %{_libdir}/%{name}/plugins
512 %dir %{_libdir}/%{name}/eventhandlers
514 %if "%{_lib}" != "lib"
515 %dir %{_prefix}/lib/%{name}
516 %dir %{_prefix}/lib/%{name}/plugins
517 %dir %{_prefix}/lib/%{name}/eventhandlers
520 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}
523 %defattr(644,root,root,755)
524 %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg
527 %defattr(644,root,root,755)
531 %defattr(644,root,root,755)
532 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
533 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
534 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
535 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
536 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
537 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
538 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
540 %attr(755,root,root) %{cgidir}/*.cgi
543 %dir %{htmldir}/includes
544 %dir %{htmldir}/images
545 %dir %{htmldir}/stylesheets
546 %{htmldir}/robots.txt
547 %{htmldir}/contexthelp
550 %{htmldir}/images/favicon.ico
551 %{htmldir}/images/marker.png
552 %{htmldir}/images/shadow50.png
553 %{htmldir}/nagioswall.php
555 %files theme-classicui
556 %defattr(644,root,root,755)
557 %exclude %{htmldir}/nagioswall.php
559 %{htmldir}/includes/*
561 %exclude %{htmldir}/images/favicon.ico
562 %exclude %{htmldir}/images/marker.png
563 %exclude %{htmldir}/images/shadow50.png
564 %{htmldir}/stylesheets/*
567 %defattr(644,root,root,755)
570 %defattr(644,root,root,755)
571 %dir %{_includedir}/%{name}
572 %{_includedir}/%{name}/*.h