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 Source0: http://downloads.sourceforge.net/nagios/nagios-4.x/%{name}-%{version}/%{name}-%{version}.tar.gz
20 # Source0-md5: 4bba4eef427cfb113fb513b6166a6af6
21 Source1: %{name}-apache.conf
23 Source3: %{name}.sysconfig
24 # http://git.pld-linux.org/projects/nagios-config/
25 Source4: %{name}-config-20090914.tar.bz2
26 # Source4-md5: 605f1cd28c00db961dad6f529d849f16
27 Source5: %{name}-lighttpd.conf
28 Source6: http://www.google.com/mapfiles/shadow50.png
29 # Source6-md5: eff99f302f21b95a900d321743fce72b
30 Source7: http://www.google.com/mapfiles/marker.png
31 # Source7-md5: edefef4bdfc29e1c953694651f05b466
33 Source9: %{name}wall.php
34 Patch0: %{name}-resources.patch
35 Patch1: %{name}-iconv-in-libc.patch
36 Patch2: %{name}-webapps.patch
37 Patch3: %{name}-cgi-http_charset.patch
38 Patch4: %{name}-cmd-typo.patch
40 Patch6: %{name}-googlemap.patch
41 Patch7: %{name}-doc-usermacros.patch
42 Patch8: archivelog-timeformat.patch
43 Patch9: system-magpierss.patch
44 Patch10: system-jquery.patch
45 Patch11: do-not-fetch-rss.patch
46 URL: http://www.nagios.org/
47 BuildRequires: autoconf
48 BuildRequires: automake
49 %{?with_doc:BuildRequires: doxygen}
50 BuildRequires: rpmbuild(macros) >= 1.268
51 BuildRequires: sed >= 4.0
53 BuildRequires: gd-devel
54 BuildRequires: libjpeg-devel
55 BuildRequires: libpng-devel
58 BuildRequires: perl-HTML-Lint
59 BuildRequires: perl-Test-WWW-Mechanize-CGI
61 Requires(post,preun): /sbin/chkconfig
62 Requires: %{name}-common = %{version}-%{release}
63 Requires: rc-scripts >= 0.4.5.5
65 Suggests: nagios-notify >= 0.13
66 Suggests: nagios-plugin-check_load
67 Suggests: nagios-plugin-check_ping
68 Suggests: nagios-plugins
71 Conflicts: iputils-ping < 1:ss020124
72 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
74 %define _sysconfdir /etc/%{name}
75 %define cgidir %{_libdir}/%{name}/cgi
76 %define htmldir %{_prefix}/share/%{name}
77 %define _localstatedir /var/lib/%{name}
78 %define _webapps /etc/webapps
79 %define _webapp %{name}
82 Nagios is a program that will monitor hosts and services on your
83 network. It has the ability to email or page you when a problem arises
84 and when a problem is resolved. Nagios is written in C and is designed
85 to run under Linux (and some other *NIX variants) as a background
86 process, intermittently running checks on various services that you
89 The actual service checks are performed by separate "plugin" programs
90 which return the status of the checks to Nagios. The plugins are
91 available in nagios-plugins packages.
93 Nagios is successor to NetSaint.
95 %description -l pl.UTF-8
96 Nagios to program, który monitoruje serwery oraz usługi w naszej
97 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
98 rozwiązaniu problemu. Nagios został napisany w C oraz jest
99 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
100 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
103 Właściwe sprawdzanie jest wykonywane przez osobne programy
104 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
105 są dostępne na stronie w pakietach nagios-plugins.
107 Nagios jest następcą NetSainta.
109 %description -l pt_BR.UTF-8
110 O Nagios é um programa que monitora máquinas e serviços na sua rede.
111 Ele pode enviar um email ou um aviso de pager para o administrador
112 quando surgir um problema e quando ele for resolvido. Nagios é escrito
113 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
114 variações de *NIX) como um processo em segundo plano, periodicamente
115 executando checagens nos diversos serviços que forem especificados.
118 Summary: Common files needed by both nagios and nrpe
119 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
121 Requires(postun): /usr/sbin/groupdel
122 Requires(postun): /usr/sbin/userdel
123 Requires(pre): /bin/id
124 Requires(pre): /usr/bin/getgid
125 Requires(pre): /usr/sbin/groupadd
126 Requires(pre): /usr/sbin/groupmod
127 Requires(pre): /usr/sbin/useradd
128 Requires(pre): /usr/sbin/usermod
129 Provides: group(nagcmd)
130 Provides: group(nagios)
131 Provides: user(nagios)
134 Common files needed by both nagios and nrpe.
136 %description common -l pl.UTF-8
137 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
140 Summary: CGI webinterface for Nagios
141 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
142 Group: Applications/WWW
143 # for dirs... and accessing local logs, nagios config
144 Requires: %{name} = %{version}-%{release}
145 Requires: %{name}-imagepaks
146 Requires: %{name}-theme
147 Requires: group(http)
151 Requires: webserver(access)
152 Requires: webserver(alias)
153 Requires: webserver(auth)
154 Requires: webserver(cgi)
155 Requires: webserver(indexfile)
156 Suggests: %{name}-doc
157 Suggests: php-magpierss >= 0.72
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}
170 %if "%{_rpmversion}" >= "5"
174 %description mrtggraphs
175 This pacakge graphs several Nagios statistics which can be useful for
176 debugging and trending purposes. The nagiostats binary is used to
180 Summary: HTML Documentation for Nagios
182 %if "%{_rpmversion}" >= "5"
185 # does not require base
188 HTML Documentation for Nagios.
190 %package theme-classicui
191 Summary: ClassicUI Nagios theme
192 Group: Applications/WWW
193 Requires: %{name}-cgi = %{version}-%{release}
194 Requires: webserver(php)
195 Provides: nagios-theme
196 Obsoletes: nagios-theme
197 %if "%{_rpmversion}" >= "5"
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
215 %if "%{_rpmversion}" >= "5"
219 %description theme-default
220 Virtual package to handle Nagios theme migration
223 Summary: Include files that Nagios-related applications may compile against
224 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
225 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
226 Group: Development/Libraries
227 # doesn't require base
230 This package contains the header files, static libraries and
231 development documentation for Nagios. If you are a NEB-module author
232 or wish to write addons for Nagios using Nagios' own API's, you should
233 install this package.
235 %description devel -l pl.UTF-8
236 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
237 przez aplikacje związane z nagiosem podczas kompilacji.
239 %description devel -l pt_BR.UTF-8
240 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
241 aplicativos para o Nagios.
245 mv %{name}-%{version}/* .
263 find -name .cvsignore -o -name .gitignore | xargs rm
265 mv nagios-config-*/objects/*.cfg sample-config/template-object
266 mv nagios-config-*/*.cfg sample-config
268 # cleanup backups after patching
269 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
272 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
273 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
274 ' $(find contrib/eventhandlers -type f)
276 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
277 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
281 # kill trailing spaces
284 s,/usr/local/%{name}/share,@datadir@,g
285 # we want all authorized users have default access
287 ' sample-config/*.cfg.in
289 #rm t/611cgistatus-hosturgencies.t
292 cp -f /usr/share/automake/config.sub .
303 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
304 --bindir=%{_sbindir} \
305 --sbindir=%{cgidir} \
306 --datadir=%{htmldir} \
307 --with-nagios-user=%{name} \
308 --with-nagios-grp=%{name} \
309 --with-command-user=%{name} \
310 --with-command-grp=%{name} \
311 --with-lockfile=%{_localstatedir}/%{name}.pid \
312 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
313 --with-ping_command='/bin/ping -n %%s -c %%d' \
314 %{!?with_gd:--disable-statusmap --disable-trends} \
315 %{?with_tests:--enable-libtap} \
316 --enable-event-broker
320 %{?with_doc:%{__make} dox}
322 %{?with_tests:%{__make} test}
325 rm -rf $RPM_BUILD_ROOT
326 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
327 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
328 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
329 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
330 %if "%{_lib}" != "lib"
331 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
334 %{__make} install-unstripped install-devel \
335 DESTDIR=$RPM_BUILD_ROOT \
340 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
341 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
343 # install templated configuration files
344 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
345 cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
349 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
350 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
351 cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
352 cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
353 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
354 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
355 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
356 cp -p %{SOURCE9} $RPM_BUILD_ROOT%{htmldir}
357 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
358 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
360 # install event handlers, sample config
361 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
362 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
363 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
364 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
367 install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d
368 cp -p sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg
370 # Object data/cache files
371 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
372 > $RPM_BUILD_ROOT%{_localstatedir}/$i
374 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
375 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.qh
377 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
378 %{__cp} -a Documentation/html/* $RPM_BUILD_ROOT%{_docdir}/%{name}
381 rm -rf $RPM_BUILD_ROOT
384 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
385 [ ! -f $i ] && touch $i
390 /sbin/chkconfig --add %{name}
391 %service %{name} restart "Nagios service"
394 if [ "$1" = "0" ] ; then
395 %service %{name} stop
396 /sbin/chkconfig --del %{name}
400 # rename group netsaint -> nagios
401 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
402 /usr/sbin/groupmod -n nagios netsaint
404 # rename group nagios-data -> nagcmd
405 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
406 /usr/sbin/groupmod -n nagcmd nagios-data
408 %groupadd -g 72 nagios
409 %groupadd -g 147 -f nagcmd
410 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
411 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
413 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
416 if [ "$1" = "0" ]; then
423 if [ "$1" = 1 ]; then
424 %banner %{name} -e <<EOF
426 You need to add user to %{_webapps}/%{_webapp}/passwd and
427 %{_webapps}/%{_webapp}/group to access Nagios via web.
432 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
433 %addusertogroup http nagcmd
434 %webapp_register apache %{_webapp}
436 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
437 %webapp_unregister apache %{_webapp}
439 %triggerin cgi -- apache < 2.2.0, apache-base
440 %addusertogroup http nagcmd
441 %webapp_register httpd %{_webapp}
443 %triggerun cgi -- apache < 2.2.0, apache-base
444 %webapp_unregister httpd %{_webapp}
446 %triggerin cgi -- lighttpd
447 %addusertogroup lighttpd nagcmd
448 %webapp_register lighttpd %{_webapp}
450 %triggerun cgi -- lighttpd
451 %webapp_unregister lighttpd %{_webapp}
453 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
454 chown root:http %{_sysconfdir}/cgi.cfg
456 %triggerpostun -- nagios < 3.1.2-4
458 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
459 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
460 mv -f %{_sysconfdir}/$a{.rpmsave,}
463 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
466 %defattr(644,root,root,755)
467 %doc Changelog README* UPGRADING INSTALLING LICENSE
468 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
470 # leave main nagios config readable for -cgi.
471 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
473 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
474 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
475 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
476 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
477 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
478 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
480 %attr(754,root,root) /etc/rc.d/init.d/%{name}
481 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
483 %attr(755,root,root) %{_sbindir}/%{name}
484 %attr(755,root,root) %{_sbindir}/nagiostats
485 %dir %{_libdir}/%{name}/brokers
487 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
488 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
490 %attr(770,root,nagcmd) %dir %{_localstatedir}
491 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
492 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
493 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.qh
494 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
495 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
496 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
497 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
498 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
500 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}/checkresults
502 %{_examplesdir}/%{name}-%{version}
505 %defattr(644,root,root,755)
506 %attr(750,root,nagcmd) %dir %{_sysconfdir}
507 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
508 %dir %{_libdir}/%{name}
509 %dir %{_libdir}/%{name}/plugins
510 %dir %{_libdir}/%{name}/eventhandlers
512 %if "%{_lib}" != "lib"
513 %dir %{_prefix}/lib/%{name}
514 %dir %{_prefix}/lib/%{name}/plugins
515 %dir %{_prefix}/lib/%{name}/eventhandlers
518 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}
521 %defattr(644,root,root,755)
522 %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg
525 %defattr(644,root,root,755)
529 %defattr(644,root,root,755)
530 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
531 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
532 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
533 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
534 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
535 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
536 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
538 %attr(755,root,root) %{cgidir}/*.cgi
541 %dir %{htmldir}/includes
542 %dir %{htmldir}/images
543 %dir %{htmldir}/stylesheets
544 %{htmldir}/robots.txt
545 %{htmldir}/contexthelp
546 %{htmldir}/jsonquery.html
549 %{htmldir}/images/favicon.ico
550 %{htmldir}/images/marker.png
551 %{htmldir}/images/shadow50.png
552 %{htmldir}/nagioswall.php
553 %{htmldir}/rss-corefeed.html
554 %{htmldir}/rss-newsfeed.html
556 %files theme-classicui
557 %defattr(644,root,root,755)
558 %exclude %{htmldir}/nagioswall.php
560 %{htmldir}/includes/*
562 %exclude %{htmldir}/images/favicon.ico
563 %exclude %{htmldir}/images/marker.png
564 %exclude %{htmldir}/images/shadow50.png
565 %{htmldir}/stylesheets/*
568 %defattr(644,root,root,755)
571 %defattr(644,root,root,755)
572 %dir %{_includedir}/%{name}
573 %{_includedir}/%{name}/*.h
574 %{_includedir}/%{name}/lib
575 %{_libdir}/libnagios.a