2 # - /var/log/nagios/archives -> /var/log/archive/nagios
5 %bcond_without gd # without statusmap and trends, which require gd library
6 %bcond_without doc # don't build html docs
7 # reeenable when http://tracker.nagios.org/view.php?id=51 is fixed
10 Summary: Open Source host, service and 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 %{?with_doc:BuildRequires: doxygen}
49 BuildRequires: rpmbuild(macros) >= 1.268
50 BuildRequires: sed >= 4.0
52 BuildRequires: gd-devel
53 BuildRequires: libjpeg-devel
54 BuildRequires: libpng-devel
57 BuildRequires: perl-HTML-Lint
58 BuildRequires: perl-Test-WWW-Mechanize-CGI
60 Requires(post,preun): /sbin/chkconfig
61 Requires: %{name}-common = %{version}-%{release}
62 Requires: rc-scripts >= 0.4.5.5
64 Suggests: nagios-notify >= 0.13
65 Suggests: nagios-plugin-check_load
66 Suggests: nagios-plugin-check_ping
67 Suggests: nagios-plugins
70 Conflicts: iputils-ping < 1:ss020124
71 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
73 %define _sysconfdir /etc/%{name}
74 %define cgidir %{_libdir}/%{name}/cgi
75 %define htmldir %{_prefix}/share/%{name}
76 %define _localstatedir /var/lib/%{name}
77 %define _webapps /etc/webapps
78 %define _webapp %{name}
81 Nagios is a program that will monitor hosts and services on your
82 network. It has the ability to email or page you when a problem arises
83 and when a problem is resolved. Nagios is written in C and is designed
84 to run under Linux (and some other *NIX variants) as a background
85 process, intermittently running checks on various services that you
88 The actual service checks are performed by separate "plugin" programs
89 which return the status of the checks to Nagios. The plugins are
90 available in nagios-plugins packages.
92 Nagios is successor to NetSaint.
94 %description -l pl.UTF-8
95 Nagios to program, który monitoruje serwery oraz usługi w naszej
96 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
97 rozwiązaniu problemu. Nagios został napisany w C oraz jest
98 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
99 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
102 Właściwe sprawdzanie jest wykonywane przez osobne programy
103 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
104 są dostępne na stronie w pakietach nagios-plugins.
106 Nagios jest następcą NetSainta.
108 %description -l pt_BR.UTF-8
109 O Nagios é um programa que monitora máquinas e serviços na sua rede.
110 Ele pode enviar um email ou um aviso de pager para o administrador
111 quando surgir um problema e quando ele for resolvido. Nagios é escrito
112 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
113 variações de *NIX) como um processo em segundo plano, periodicamente
114 executando checagens nos diversos serviços que forem especificados.
117 Summary: Common files needed by both nagios and nrpe
118 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
120 Requires(postun): /usr/sbin/groupdel
121 Requires(postun): /usr/sbin/userdel
122 Requires(pre): /bin/id
123 Requires(pre): /usr/bin/getgid
124 Requires(pre): /usr/sbin/groupadd
125 Requires(pre): /usr/sbin/groupmod
126 Requires(pre): /usr/sbin/useradd
127 Requires(pre): /usr/sbin/usermod
128 Provides: group(nagcmd)
129 Provides: group(nagios)
130 Provides: user(nagios)
133 Common files needed by both nagios and nrpe.
135 %description common -l pl.UTF-8
136 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
139 Summary: CGI webinterface for Nagios
140 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
141 Group: Applications/WWW
142 # for dirs... and accessing local logs, nagios config
143 Requires: %{name} = %{version}-%{release}
144 Requires: %{name}-imagepaks
145 Requires: %{name}-theme
146 Requires: group(http)
150 Requires: webserver(access)
151 Requires: webserver(alias)
152 Requires: webserver(auth)
153 Requires: webserver(cgi)
154 Requires: webserver(indexfile)
155 Suggests: %{name}-doc
156 Suggests: php-magpierss >= 0.72
157 Conflicts: apache-base < 2.4.0-1
160 CGI webinterface for Nagios.
162 %description cgi -l pl.UTF-8
163 Interfejs CGI dla Nagiosa.
166 Summary: MRTG Graphs: Nagios Statistics
167 Group: Applications/Networking
168 Requires: %{name} = %{version}-%{release}
171 %description mrtggraphs
172 This pacakge graphs several Nagios statistics which can be useful for
173 debugging and trending purposes. The nagiostats binary is used to
177 Summary: HTML Documentation for Nagios
179 %if "%{_rpmversion}" >= "5"
182 # does not require base
185 HTML Documentation for Nagios.
187 %package theme-classicui
188 Summary: ClassicUI Nagios theme
189 Group: Applications/WWW
190 Requires: %{name}-cgi = %{version}-%{release}
191 Requires: webserver(php)
192 Provides: nagios-theme
193 Obsoletes: nagios-theme
195 %description theme-classicui
196 Original theme from Nagios.
198 %description theme-classicui -l pl.UTF-8
199 Oryginalny motyw z Nagiosa.
201 %package theme-default
202 Summary: Virtual package to handle Nagios theme migration
203 Group: Applications/WWW
204 Requires: nagios-theme
205 Suggests: nagios-theme-classicui
206 Suggests: nagios-theme-exfoliation
207 Suggests: nagios-theme-nuvola
208 Obsoletes: nagios-theme-default < 3.3.1-1.4
210 %description theme-default
211 Virtual package to handle Nagios theme migration
214 Summary: Include files that Nagios-related applications may compile against
215 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
216 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
217 Group: Development/Libraries
218 # doesn't require base
221 This package contains the header files, static libraries and
222 development documentation for Nagios. If you are a NEB-module author
223 or wish to write addons for Nagios using Nagios' own API's, you should
224 install this package.
226 %description devel -l pl.UTF-8
227 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
228 przez aplikacje związane z nagiosem podczas kompilacji.
230 %description devel -l pt_BR.UTF-8
231 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
232 aplicativos para o Nagios.
254 find -name .cvsignore -o -name .gitignore | xargs rm
256 mv nagios-config-*/objects/*.cfg sample-config/template-object
257 mv nagios-config-*/*.cfg sample-config
259 # cleanup backups after patching
260 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
263 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
264 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
265 ' $(find contrib/eventhandlers -type f)
267 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
268 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE10} > httpd.conf
269 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
273 # kill trailing spaces
276 s,/usr/local/%{name}/share,@datadir@,g
277 # we want all authorized users have default access
279 ' sample-config/*.cfg.in
281 #rm t/611cgistatus-hosturgencies.t
284 cp -f /usr/share/automake/config.sub .
295 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
296 --bindir=%{_sbindir} \
297 --sbindir=%{cgidir} \
298 --datadir=%{htmldir} \
299 --with-nagios-user=%{name} \
300 --with-nagios-grp=%{name} \
301 --with-command-user=%{name} \
302 --with-command-grp=%{name} \
303 --with-lockfile=%{_localstatedir}/%{name}.pid \
304 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
305 --with-ping_command='/bin/ping -n %%s -c %%d' \
306 %{!?with_gd:--disable-statusmap --disable-trends} \
307 %{?with_tests:--enable-libtap} \
308 --enable-event-broker
312 %{?with_doc:%{__make} dox}
314 %{?with_tests:%{__make} test}
317 rm -rf $RPM_BUILD_ROOT
318 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
319 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
320 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
321 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
322 %if "%{_lib}" != "lib"
323 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
326 %{__make} install-unstripped install-devel \
327 DESTDIR=$RPM_BUILD_ROOT \
332 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
333 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
335 # install templated configuration files
336 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
337 cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
341 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
342 cp -p httpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
343 cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
344 cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
345 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
346 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
347 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
348 cp -p %{SOURCE9} $RPM_BUILD_ROOT%{htmldir}
349 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
350 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
352 # install event handlers, sample config
353 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
354 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
355 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
356 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
359 install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d
360 cp -p sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg
362 # Object data/cache files
363 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
364 > $RPM_BUILD_ROOT%{_localstatedir}/$i
366 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
367 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.qh
369 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
370 %{__cp} -a Documentation/html/* $RPM_BUILD_ROOT%{_docdir}/%{name}
373 rm -rf $RPM_BUILD_ROOT
376 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
377 [ ! -f $i ] && touch $i
382 /sbin/chkconfig --add %{name}
383 %service %{name} restart "Nagios service"
386 if [ "$1" = "0" ] ; then
387 %service %{name} stop
388 /sbin/chkconfig --del %{name}
392 # rename group netsaint -> nagios
393 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
394 /usr/sbin/groupmod -n nagios netsaint
396 # rename group nagios-data -> nagcmd
397 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
398 /usr/sbin/groupmod -n nagcmd nagios-data
400 %groupadd -g 72 nagios
401 %groupadd -g 147 -f nagcmd
402 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
403 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
405 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
408 if [ "$1" = "0" ]; then
415 if [ "$1" = 1 ]; then
416 %banner %{name} -e <<EOF
418 You need to add user to %{_webapps}/%{_webapp}/passwd and
419 %{_webapps}/%{_webapp}/group to access Nagios via web.
424 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
425 %addusertogroup http nagcmd
426 %webapp_register apache %{_webapp}
428 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
429 %webapp_unregister apache %{_webapp}
431 %triggerin cgi -- apache-base
432 %addusertogroup http nagcmd
433 %webapp_register httpd %{_webapp}
435 %triggerun cgi -- apache-base
436 %webapp_unregister httpd %{_webapp}
438 %triggerin cgi -- lighttpd
439 %addusertogroup lighttpd nagcmd
440 %webapp_register lighttpd %{_webapp}
442 %triggerun cgi -- lighttpd
443 %webapp_unregister lighttpd %{_webapp}
445 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
446 chown root:http %{_sysconfdir}/cgi.cfg
448 %triggerpostun -- nagios < 3.1.2-4
450 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
451 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
452 mv -f %{_sysconfdir}/$a{.rpmsave,}
455 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
458 %defattr(644,root,root,755)
459 %doc Changelog README* UPGRADING INSTALLING LICENSE
460 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
462 # leave main nagios config readable for -cgi.
463 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
465 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
466 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
467 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
468 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
469 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
470 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
472 %attr(754,root,root) /etc/rc.d/init.d/%{name}
473 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
475 %attr(755,root,root) %{_sbindir}/%{name}
476 %attr(755,root,root) %{_sbindir}/nagiostats
477 %dir %{_libdir}/%{name}/brokers
479 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
480 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
482 %attr(770,root,nagcmd) %dir %{_localstatedir}
483 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
484 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
485 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.qh
486 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
487 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
488 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
489 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
490 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
492 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}/checkresults
494 %{_examplesdir}/%{name}-%{version}
497 %defattr(644,root,root,755)
498 %attr(750,root,nagcmd) %dir %{_sysconfdir}
499 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
500 %dir %{_libdir}/%{name}
501 %dir %{_libdir}/%{name}/plugins
502 %dir %{_libdir}/%{name}/eventhandlers
504 %if "%{_lib}" != "lib"
505 %dir %{_prefix}/lib/%{name}
506 %dir %{_prefix}/lib/%{name}/plugins
507 %dir %{_prefix}/lib/%{name}/eventhandlers
510 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}
513 %defattr(644,root,root,755)
514 %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg
517 %defattr(644,root,root,755)
521 %defattr(644,root,root,755)
522 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
523 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
524 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
525 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
526 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
527 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
528 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
530 %attr(755,root,root) %{cgidir}/*.cgi
533 %dir %{htmldir}/includes
534 %dir %{htmldir}/images
535 %dir %{htmldir}/stylesheets
536 %{htmldir}/robots.txt
537 %{htmldir}/contexthelp
540 %{htmldir}/images/favicon.ico
541 %{htmldir}/images/marker.png
542 %{htmldir}/images/shadow50.png
543 %{htmldir}/nagioswall.php
545 %files theme-classicui
546 %defattr(644,root,root,755)
547 %exclude %{htmldir}/nagioswall.php
549 %{htmldir}/includes/*
551 %exclude %{htmldir}/images/favicon.ico
552 %exclude %{htmldir}/images/marker.png
553 %exclude %{htmldir}/images/shadow50.png
554 %{htmldir}/stylesheets/*
557 %defattr(644,root,root,755)
560 %defattr(644,root,root,755)
561 %dir %{_includedir}/%{name}
562 %{_includedir}/%{name}/*.h
563 %{_includedir}/%{name}/lib
564 %{_libdir}/libnagios.a