2 # - /var/log/nagios/archives -> /var/log/archive/nagios
3 # - bundled jquery in themes
6 %bcond_without gd # without statusmap and trends, which require gd library
7 %bcond_without doc # don't build html docs
8 # reeenable when http://tracker.nagios.org/view.php?id=51 is fixed
11 Summary: Open Source host, service and network monitoring program
12 Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci
13 Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços
19 # https://www.nagios.org/downloads/nagios-core/thanks/?product_download=nagioscore-source
20 Source0: https://assets.nagios.com/downloads/nagioscore/releases/%{name}-%{version}.tar.gz
21 # Source0-md5: 193610ea3995e561c5e9bd9dcdaad529
22 Source1: %{name}-apache.conf
24 Source3: %{name}.sysconfig
25 # http://git.pld-linux.org/projects/nagios-config/
26 Source4: %{name}-config-20150805.tar.xz
27 # Source4-md5: 16683172c72cc2c09662261c82abef40
28 Source5: %{name}-lighttpd.conf
29 Source6: http://www.google.com/mapfiles/shadow50.png
30 # Source6-md5: eff99f302f21b95a900d321743fce72b
31 Source7: http://www.google.com/mapfiles/marker.png
32 # Source7-md5: edefef4bdfc29e1c953694651f05b466
34 Source9: %{name}wall.php
35 #Patch100: %{name}-git.patch
36 # Patch100-md5: 56f785241d0ed9fe51a8170b9dd50272
38 Patch0: %{name}-resources.patch
39 Patch1: %{name}-iconv-in-libc.patch
40 Patch2: %{name}-webapps.patch
41 Patch3: long-output.patch
42 Patch4: %{name}-cmd-typo.patch
44 Patch6: %{name}-googlemap.patch
46 Patch8: archivelog-timeformat.patch
48 Patch10: system-jquery.patch
49 Patch11: do-not-fetch-rss.patch
50 URL: https://www.nagios.org/projects/nagios-core/
51 BuildRequires: autoconf
52 BuildRequires: automake
53 %{?with_doc:BuildRequires: doxygen}
54 BuildRequires: rpmbuild(macros) >= 1.268
55 BuildRequires: sed >= 4.0
56 BuildRequires: tar >= 1:1.22
59 BuildRequires: gd-devel
60 BuildRequires: libjpeg-devel
61 BuildRequires: libpng-devel
64 BuildRequires: perl-HTML-Lint
65 BuildRequires: perl-Test-WWW-Mechanize-CGI
67 Requires(post,preun): /sbin/chkconfig
68 Requires: %{name}-common = %{version}-%{release}
69 Requires: rc-scripts >= 0.4.5.5
71 Suggests: nagios-notify >= 0.13
72 Suggests: nagios-plugin-check_load
73 Suggests: nagios-plugin-check_ping
74 Suggests: nagios-plugins
77 Conflicts: iputils-ping < 1:ss020124
78 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
80 %define _sysconfdir /etc/%{name}
81 %define cgidir %{_libdir}/%{name}/cgi
82 %define htmldir %{_prefix}/share/%{name}
83 %define _localstatedir /var/lib/%{name}
84 %define nagioshome %{_localstatedir}
85 %define _webapps /etc/webapps
86 %define _webapp %{name}
89 Nagios is a program that will monitor hosts and services on your
90 network. It has the ability to email or page you when a problem arises
91 and when a problem is resolved. Nagios is written in C and is designed
92 to run under Linux (and some other *NIX variants) as a background
93 process, intermittently running checks on various services that you
96 The actual service checks are performed by separate "plugin" programs
97 which return the status of the checks to Nagios. The plugins are
98 available in nagios-plugins packages.
100 Nagios is successor to NetSaint.
102 %description -l pl.UTF-8
103 Nagios to program, który monitoruje serwery oraz usługi w naszej
104 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
105 rozwiązaniu problemu. Nagios został napisany w C oraz jest
106 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
107 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
110 Właściwe sprawdzanie jest wykonywane przez osobne programy
111 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
112 są dostępne na stronie w pakietach nagios-plugins.
114 Nagios jest następcą NetSainta.
116 %description -l pt_BR.UTF-8
117 O Nagios é um programa que monitora máquinas e serviços na sua rede.
118 Ele pode enviar um email ou um aviso de pager para o administrador
119 quando surgir um problema e quando ele for resolvido. Nagios é escrito
120 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
121 variações de *NIX) como um processo em segundo plano, periodicamente
122 executando checagens nos diversos serviços que forem especificados.
125 Summary: Common files needed by both nagios and nrpe
126 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
128 Requires(postun): /usr/sbin/groupdel
129 Requires(postun): /usr/sbin/userdel
130 Requires(pre): /bin/id
131 Requires(pre): /usr/bin/getgid
132 Requires(pre): /usr/sbin/groupadd
133 Requires(pre): /usr/sbin/groupmod
134 Requires(pre): /usr/sbin/useradd
135 Requires(pre): /usr/sbin/usermod
136 Provides: group(nagcmd)
137 Provides: group(nagios)
138 Provides: user(nagios)
141 Common files needed by both nagios and nrpe.
143 %description common -l pl.UTF-8
144 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
147 Summary: CGI webinterface for Nagios
148 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
149 Group: Applications/WWW
150 # for dirs... and accessing local logs, nagios config
151 Requires: %{name} = %{version}-%{release}
152 Requires: %{name}-imagepaks
153 Requires: %{name}-theme
154 Requires: group(http)
158 Requires: webserver(access)
159 Requires: webserver(alias)
160 Requires: webserver(auth)
161 Requires: webserver(cgi)
162 Requires: webserver(indexfile)
163 Suggests: %{name}-doc
166 CGI webinterface for Nagios.
168 %description cgi -l pl.UTF-8
169 Interfejs CGI dla Nagiosa.
172 Summary: MRTG Graphs: Nagios Statistics
173 Group: Applications/Networking
174 Requires: %{name} = %{version}-%{release}
178 %description mrtggraphs
179 This pacakge graphs several Nagios statistics which can be useful for
180 debugging and trending purposes. The nagiostats binary is used to
184 Summary: HTML Documentation for Nagios
187 # does not require base
190 HTML Documentation for Nagios.
192 %package theme-classicui
193 Summary: ClassicUI Nagios theme
194 Group: Applications/WWW
195 Requires: %{name}-cgi = %{version}-%{release}
196 Requires: webserver(php)
197 Provides: nagios-theme
198 Obsoletes: nagios-theme
201 %description theme-classicui
202 Original theme from Nagios.
204 %description theme-classicui -l pl.UTF-8
205 Oryginalny motyw z Nagiosa.
207 %package theme-default
208 Summary: Virtual package to handle Nagios theme migration
209 Group: Applications/WWW
210 Requires: nagios-theme
211 Suggests: nagios-theme-classicui
212 Suggests: nagios-theme-exfoliation
213 Suggests: nagios-theme-nuvola
214 Obsoletes: nagios-theme-default < 3.3.1-1.4
217 %description theme-default
218 Virtual package to handle Nagios theme migration
221 Summary: Include files that Nagios-related applications may compile against
222 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
223 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
224 Group: Development/Libraries
225 # doesn't require base
228 This package contains the header files, static libraries and
229 development documentation for Nagios. If you are a NEB-module author
230 or wish to write addons for Nagios using Nagios' own API's, you should
231 install this package.
233 %description devel -l pl.UTF-8
234 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
235 przez aplikacje związane z nagiosem podczas kompilacji.
237 %description devel -l pt_BR.UTF-8
238 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
239 aplicativos para o Nagios.
243 mv %{name}-%{version}/* .
250 patch -p1 < ./contrib/epel-patches/nagios-0010-remove-information-leak.patch || exit 1
266 find -name .cvsignore -o -name .gitignore | xargs rm
268 mv nagios-config-*/objects/*.cfg sample-config/template-object
269 mv nagios-config-*/*.cfg sample-config
271 # cleanup backups after patching
272 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
275 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
276 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
277 ' $(find contrib/eventhandlers -type f)
279 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
280 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
284 # kill trailing spaces
287 s,/usr/local/%{name}/share,@datadir@,g
288 # we want all authorized users have default access
290 ' sample-config/*.cfg.in
292 #rm t/611cgistatus-hosturgencies.t
295 cp -f /usr/share/automake/config.sub .
306 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
307 --bindir=%{_sbindir} \
308 --sbindir=%{cgidir} \
309 --datadir=%{htmldir} \
310 --with-cgibindir=%{cgidir} \
311 --with-nagios-user=%{name} \
312 --with-nagios-grp=%{name} \
313 --with-command-user=%{name} \
314 --with-command-grp=%{name} \
315 --with-lockfile=%{_localstatedir}/%{name}.pid \
316 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
317 --with-ping_command='/bin/ping -n %%s -c %%d' \
318 %{!?with_gd:--disable-statusmap --disable-trends} \
319 %{?with_tests:--enable-libtap} \
320 --enable-event-broker
324 %{?with_doc:%{__make} dox}
326 %{?with_tests:%{__make} test}
329 rm -rf $RPM_BUILD_ROOT
330 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
331 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
332 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects,nrpe.d} \
333 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
334 %if "%{_lib}" != "lib"
335 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
338 %{__make} install-unstripped install-devel \
339 DESTDIR=$RPM_BUILD_ROOT \
344 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
345 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
347 # install templated configuration files
348 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
349 cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
353 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
354 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
355 cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
356 cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
357 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
358 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
359 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
360 cp -p %{SOURCE9} $RPM_BUILD_ROOT%{htmldir}
361 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
362 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
364 # install event handlers, sample config
365 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
366 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
367 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
368 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
371 install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d
372 cp -p sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg
374 # Object data/cache files
375 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
376 > $RPM_BUILD_ROOT%{_localstatedir}/$i
378 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
379 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.qh
381 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
382 %{?with_doc:%{__cp} -a Documentation/html/* $RPM_BUILD_ROOT%{_docdir}/%{name}}
385 rm -rf $RPM_BUILD_ROOT
388 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
389 [ ! -f $i ] && touch $i
394 /sbin/chkconfig --add %{name}
395 %service %{name} restart "Nagios service"
398 if [ "$1" = "0" ] ; then
399 %service %{name} stop
400 /sbin/chkconfig --del %{name}
404 # rename group netsaint -> nagios
405 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
406 /usr/sbin/groupmod -n nagios netsaint
408 # rename group nagios-data -> nagcmd
409 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
410 /usr/sbin/groupmod -n nagcmd nagios-data
412 %groupadd -g 72 nagios
413 %groupadd -g 147 -f nagcmd
414 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
415 /usr/sbin/usermod -d %{nagioshome} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
417 %useradd -u 72 -d %{nagioshome} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
418 # update nagios user home
419 home=$(IFS=:; set -- $(getent passwd nagios); echo $6)
420 if [ "$home" != %{nagioshome} ]; then
421 /usr/sbin/usermod -d %{nagioshome} nagios
425 if [ "$1" = "0" ]; then
432 if [ "$1" = 1 ]; then
433 %banner %{name} -e <<EOF
435 You need to add user to %{_webapps}/%{_webapp}/passwd and
436 %{_webapps}/%{_webapp}/group to access Nagios via web.
441 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
442 %addusertogroup http nagcmd
443 %webapp_register apache %{_webapp}
445 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
446 %webapp_unregister apache %{_webapp}
448 %triggerin cgi -- apache < 2.2.0, apache-base
449 %addusertogroup http nagcmd
450 %webapp_register httpd %{_webapp}
452 %triggerun cgi -- apache < 2.2.0, apache-base
453 %webapp_unregister httpd %{_webapp}
455 %triggerin cgi -- lighttpd
456 %addusertogroup lighttpd nagcmd
457 %webapp_register lighttpd %{_webapp}
459 %triggerun cgi -- lighttpd
460 %webapp_unregister lighttpd %{_webapp}
462 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
463 chown root:http %{_sysconfdir}/cgi.cfg
465 %triggerpostun -- nagios < 3.1.2-4
467 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
468 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
469 mv -f %{_sysconfdir}/$a{.rpmsave,}
472 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
475 %triggerpostun -- nagios-common < 4.0.8-2.2
476 %banner -e %{name}-common <<EOF
478 IMPORTANT: nagios user home changed to %{nagioshome}, you may need to move files from previous location %{_libdir}/%{name}.
483 %defattr(644,root,root,755)
484 %doc Changelog README* UPGRADING INSTALLING LICENSE
485 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
487 # leave main nagios config readable for -cgi.
488 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
490 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
491 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
492 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
493 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
494 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
495 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
497 %attr(754,root,root) /etc/rc.d/init.d/%{name}
498 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
500 %attr(755,root,root) %{_sbindir}/%{name}
501 %attr(755,root,root) %{_sbindir}/nagiostats
502 %dir %{_libdir}/%{name}/brokers
504 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
505 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
507 %attr(770,root,nagcmd) %dir %{_localstatedir}
508 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
509 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
510 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.qh
511 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
512 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
513 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
514 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
515 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
517 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}/checkresults
519 %{_examplesdir}/%{name}-%{version}
522 %defattr(644,root,root,755)
523 %attr(750,root,nagcmd) %dir %{_sysconfdir}
524 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
525 %attr(750,root,nagios) %dir %{_sysconfdir}/nrpe.d
526 %dir %{_libdir}/%{name}
527 %dir %{_libdir}/%{name}/plugins
528 %dir %{_libdir}/%{name}/eventhandlers
530 %if "%{_lib}" != "lib"
531 %dir %{_prefix}/lib/%{name}
532 %dir %{_prefix}/lib/%{name}/plugins
533 %dir %{_prefix}/lib/%{name}/eventhandlers
536 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}
539 %defattr(644,root,root,755)
540 %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg
544 %defattr(644,root,root,755)
549 %defattr(644,root,root,755)
550 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
551 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
552 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
553 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
554 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
555 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
556 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
558 %attr(755,root,root) %{cgidir}/*.cgi
561 %dir %{htmldir}/includes
562 %dir %{htmldir}/images
563 %dir %{htmldir}/stylesheets
564 %{htmldir}/robots.txt
565 %{htmldir}/contexthelp
566 %{htmldir}/jsonquery.html
569 %{htmldir}/images/favicon.ico
570 %{htmldir}/images/marker.png
571 %{htmldir}/images/shadow50.png
572 %{htmldir}/nagioswall.php
575 %{htmldir}/bootstrap-3.3.7
578 %{htmldir}/graph-header.html
579 %{htmldir}/histogram-form.html
580 %{htmldir}/histogram-graph.html
581 %{htmldir}/histogram-links.html
582 %{htmldir}/histogram.html
583 %{htmldir}/infobox.html
584 %{htmldir}/map-directive.html
585 %{htmldir}/map-form.html
586 %{htmldir}/map-links.html
587 %{htmldir}/map-popup.html
588 %{htmldir}/trends-form.html
589 %{htmldir}/trends-graph.html
590 %{htmldir}/trends-host-yaxis.html
591 %{htmldir}/trends-links.html
592 %{htmldir}/trends-service-yaxis.html
593 %{htmldir}/trends.html
595 %files theme-classicui
596 %defattr(644,root,root,755)
597 %exclude %{htmldir}/nagioswall.php
599 %{htmldir}/includes/*
601 %exclude %{htmldir}/images/favicon.ico
602 %exclude %{htmldir}/images/marker.png
603 %exclude %{htmldir}/images/shadow50.png
604 %{htmldir}/stylesheets/*
607 %defattr(644,root,root,755)
610 %defattr(644,root,root,755)
611 %dir %{_includedir}/%{name}
612 %{_includedir}/%{name}/*.h
613 %{_includedir}/%{name}/lib
614 %{_libdir}/libnagios.a