2 # - /var/log/nagios/archives -> /var/log/archive/nagios
5 %bcond_without gd # without statusmap and trends, which require gd library
6 # reeenable when http://tracker.nagios.org/view.php?id=51 is fixed
9 Summary: Open Source host, service and network monitoring program
10 Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci
11 Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços
17 Source0: http://downloads.sourceforge.net/nagios/nagios-4.x/%{name}-%{version}/%{name}-%{version}.tar.gz
18 # Source0-md5: bfe64774766e32b6f6130493c52ed7f6
19 Source1: %{name}-apache.conf
21 Source3: %{name}.sysconfig
22 Source4: %{name}-config-20090914.tar.bz2
23 # Source4-md5: 605f1cd28c00db961dad6f529d849f16
24 Source5: %{name}-lighttpd.conf
25 Source6: http://www.google.com/mapfiles/shadow50.png
26 # Source6-md5: eff99f302f21b95a900d321743fce72b
27 Source7: http://www.google.com/mapfiles/marker.png
28 # Source7-md5: edefef4bdfc29e1c953694651f05b466
30 Source9: %{name}wall.php
31 Source10: %{name}-httpd.conf
32 Patch0: %{name}-resources.patch
33 Patch1: %{name}-iconv-in-libc.patch
34 Patch2: %{name}-webapps.patch
35 Patch3: %{name}-cgi-http_charset.patch
36 Patch4: %{name}-cmd-typo.patch
38 Patch6: %{name}-googlemap.patch
39 Patch7: %{name}-doc-usermacros.patch
40 Patch8: archivelog-timeformat.patch
41 Patch9: system-magpierss.patch
42 Patch10: system-jquery.patch
43 Patch11: do-not-fetch-rss.patch
44 URL: http://www.nagios.org/
45 BuildRequires: autoconf
46 BuildRequires: automake
47 BuildRequires: rpmbuild(macros) >= 1.268
48 BuildRequires: sed >= 4.0
50 BuildRequires: gd-devel
51 BuildRequires: libjpeg-devel
52 BuildRequires: libpng-devel
55 BuildRequires: perl-HTML-Lint
56 BuildRequires: perl-Test-WWW-Mechanize-CGI
58 Requires(post,preun): /sbin/chkconfig
59 Requires: %{name}-common = %{version}-%{release}
60 Requires: rc-scripts >= 0.4.5.5
62 Suggests: nagios-notify >= 0.13
63 Suggests: nagios-plugin-check_load
64 Suggests: nagios-plugin-check_ping
65 Suggests: nagios-plugins
68 Conflicts: iputils-ping < 1:ss020124
69 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
71 %define _sysconfdir /etc/%{name}
72 %define cgidir %{_libdir}/%{name}/cgi
73 %define htmldir %{_prefix}/share/%{name}
74 %define _localstatedir /var/lib/%{name}
75 %define _webapps /etc/webapps
76 %define _webapp %{name}
79 Nagios is a program that will monitor hosts and services on your
80 network. It has the ability to email or page you when a problem arises
81 and when a problem is resolved. Nagios is written in C and is designed
82 to run under Linux (and some other *NIX variants) as a background
83 process, intermittently running checks on various services that you
86 The actual service checks are performed by separate "plugin" programs
87 which return the status of the checks to Nagios. The plugins are
88 available in nagios-plugins packages.
90 Nagios is successor to NetSaint.
92 %description -l pl.UTF-8
93 Nagios to program, który monitoruje serwery oraz usługi w naszej
94 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
95 rozwiązaniu problemu. Nagios został napisany w C oraz jest
96 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
97 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
100 Właściwe sprawdzanie jest wykonywane przez osobne programy
101 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
102 są dostępne na stronie w pakietach nagios-plugins.
104 Nagios jest następcą NetSainta.
106 %description -l pt_BR.UTF-8
107 O Nagios é um programa que monitora máquinas e serviços na sua rede.
108 Ele pode enviar um email ou um aviso de pager para o administrador
109 quando surgir um problema e quando ele for resolvido. Nagios é escrito
110 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
111 variações de *NIX) como um processo em segundo plano, periodicamente
112 executando checagens nos diversos serviços que forem especificados.
115 Summary: Common files needed by both nagios and nrpe
116 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
118 Requires(postun): /usr/sbin/groupdel
119 Requires(postun): /usr/sbin/userdel
120 Requires(pre): /bin/id
121 Requires(pre): /usr/bin/getgid
122 Requires(pre): /usr/sbin/groupadd
123 Requires(pre): /usr/sbin/groupmod
124 Requires(pre): /usr/sbin/useradd
125 Requires(pre): /usr/sbin/usermod
126 Provides: group(nagcmd)
127 Provides: group(nagios)
128 Provides: user(nagios)
131 Common files needed by both nagios and nrpe.
133 %description common -l pl.UTF-8
134 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
137 Summary: CGI webinterface for Nagios
138 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
139 Group: Applications/WWW
140 # for dirs... and accessing local logs, nagios config
141 Requires: %{name} = %{version}-%{release}
142 Requires: %{name}-imagepaks
143 Requires: %{name}-theme
144 Requires: group(http)
148 Requires: webserver(access)
149 Requires: webserver(alias)
150 Requires: webserver(auth)
151 Requires: webserver(cgi)
152 Requires: webserver(indexfile)
153 Suggests: %{name}-doc
154 Suggests: php-magpierss >= 0.72
155 Conflicts: apache-base < 2.4.0-1
158 CGI webinterface for Nagios.
160 %description cgi -l pl.UTF-8
161 Interfejs CGI dla Nagiosa.
164 Summary: MRTG Graphs: Nagios Statistics
165 Group: Applications/Networking
166 Requires: %{name} = %{version}-%{release}
169 %description mrtggraphs
170 This pacakge graphs several Nagios statistics which can be useful for
171 debugging and trending purposes. The nagiostats binary is used to
175 Summary: HTML Documentation for Nagios
177 # does not require base
180 HTML Documentation for Nagios.
182 %package theme-classicui
183 Summary: ClassicUI Nagios theme
184 Group: Applications/WWW
185 Requires: %{name}-cgi = %{version}-%{release}
186 Requires: webserver(php)
187 Provides: nagios-theme
188 Obsoletes: nagios-theme
190 %description theme-classicui
191 Original theme from Nagios.
193 %description theme-classicui -l pl.UTF-8
194 Oryginalny motyw z Nagiosa.
196 %package theme-default
197 Summary: Virtual package to handle Nagios theme migration
198 Group: Applications/WWW
199 Requires: nagios-theme
200 Suggests: nagios-theme-classicui
201 Suggests: nagios-theme-exfoliation
202 Suggests: nagios-theme-nuvola
203 Obsoletes: nagios-theme-default < 3.3.1-1.4
205 %description theme-default
206 Virtual package to handle Nagios theme migration
209 Summary: Include files that Nagios-related applications may compile against
210 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
211 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
212 Group: Development/Libraries
213 # doesn't require base
216 This package contains the header files, static libraries and
217 development documentation for Nagios. If you are a NEB-module author
218 or wish to write addons for Nagios using Nagios' own API's, you should
219 install this package.
221 %description devel -l pl.UTF-8
222 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
223 przez aplikacje związane z nagiosem podczas kompilacji.
225 %description devel -l pt_BR.UTF-8
226 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
227 aplicativos para o Nagios.
249 find -name .cvsignore -o -name .gitignore | xargs rm
251 mv nagios-config-*/objects/*.cfg sample-config/template-object
252 mv nagios-config-*/*.cfg sample-config
254 # cleanup backups after patching
255 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
258 s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd,
259 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
260 ' $(find contrib/eventhandlers -type f)
262 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
263 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE10} > httpd.conf
264 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
268 # kill trailing spaces
271 s,/usr/local/%{name}/share,@datadir@,g
272 # we want all authorized users have default access
274 ' sample-config/*.cfg.in
278 # s,/usr/local/%{name}/var/archives/,/var/log/%{name}/archives/,
279 #' html/docs/configmain.html
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_tests:%{__make} test}
315 rm -rf $RPM_BUILD_ROOT
316 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
317 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
318 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
319 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \
320 %if "%{_lib}" != "lib"
321 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
324 %{__make} install-unstripped install-devel \
325 DESTDIR=$RPM_BUILD_ROOT \
330 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
331 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
333 # install templated configuration files
334 for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
335 cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
339 cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
340 cp -p httpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
341 cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
342 cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
343 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images
344 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images
345 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images
346 cp -p %{SOURCE9} $RPM_BUILD_ROOT%{htmldir}
347 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
348 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
350 # install event handlers, sample config
351 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
352 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
353 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
354 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
357 install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d
358 cp -p sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg
360 # Object data/cache files
361 for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do
362 > $RPM_BUILD_ROOT%{_localstatedir}/$i
364 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd
365 > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.qh
367 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
368 mv $RPM_BUILD_ROOT{%{htmldir}/docs/*,%{_docdir}/%{name}}
371 rm -rf $RPM_BUILD_ROOT
374 for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do
375 [ ! -f $i ] && touch $i
380 /sbin/chkconfig --add %{name}
381 %service %{name} restart "Nagios service"
384 if [ "$1" = "0" ] ; then
385 %service %{name} stop
386 /sbin/chkconfig --del %{name}
390 # rename group netsaint -> nagios
391 if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then
392 /usr/sbin/groupmod -n nagios netsaint
394 # rename group nagios-data -> nagcmd
395 if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then
396 /usr/sbin/groupmod -n nagcmd nagios-data
398 %groupadd -g 72 nagios
399 %groupadd -g 147 -f nagcmd
400 if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then
401 /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint
403 %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
406 if [ "$1" = "0" ]; then
413 if [ "$1" = 1 ]; then
414 %banner %{name} -e <<EOF
416 You need to add user to %{_webapps}/%{_webapp}/passwd and
417 %{_webapps}/%{_webapp}/group to access Nagios via web.
422 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
423 %addusertogroup http nagcmd
424 %webapp_register apache %{_webapp}
426 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
427 %webapp_unregister apache %{_webapp}
429 %triggerin cgi -- apache-base
430 %addusertogroup http nagcmd
431 %webapp_register httpd %{_webapp}
433 %triggerun cgi -- apache-base
434 %webapp_unregister httpd %{_webapp}
436 %triggerin cgi -- lighttpd
437 %addusertogroup lighttpd nagcmd
438 %webapp_register lighttpd %{_webapp}
440 %triggerun cgi -- lighttpd
441 %webapp_unregister lighttpd %{_webapp}
443 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
444 chown root:http %{_sysconfdir}/cgi.cfg
446 %triggerpostun -- nagios < 3.1.2-4
448 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
449 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
450 mv -f %{_sysconfdir}/$a{.rpmsave,}
453 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg
456 %defattr(644,root,root,755)
457 %doc Changelog README* UPGRADING INSTALLING LICENSE
458 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
460 # leave main nagios config readable for -cgi.
461 %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg
463 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg
464 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg
465 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg
466 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg
467 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg
468 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg
470 %attr(754,root,root) /etc/rc.d/init.d/%{name}
471 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
473 %attr(755,root,root) %{_sbindir}/%{name}
474 %attr(755,root,root) %{_sbindir}/nagiostats
475 %dir %{_libdir}/%{name}/brokers
477 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
478 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
480 %attr(770,root,nagcmd) %dir %{_localstatedir}
481 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
482 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd
483 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.qh
484 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
485 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
486 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
487 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
488 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid
490 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}/checkresults
492 %{_examplesdir}/%{name}-%{version}
495 %defattr(644,root,root,755)
496 %attr(750,root,nagcmd) %dir %{_sysconfdir}
497 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
498 %dir %{_libdir}/%{name}
499 %dir %{_libdir}/%{name}/plugins
500 %dir %{_libdir}/%{name}/eventhandlers
502 %if "%{_lib}" != "lib"
503 %dir %{_prefix}/lib/%{name}
504 %dir %{_prefix}/lib/%{name}/plugins
505 %dir %{_prefix}/lib/%{name}/eventhandlers
508 %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}
511 %defattr(644,root,root,755)
512 %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg
515 %defattr(644,root,root,755)
519 %defattr(644,root,root,755)
520 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
521 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
522 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
523 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
524 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
525 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
526 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
528 %attr(755,root,root) %{cgidir}/*.cgi
531 %dir %{htmldir}/includes
532 %dir %{htmldir}/images
533 %dir %{htmldir}/stylesheets
534 %{htmldir}/robots.txt
535 %{htmldir}/contexthelp
538 %{htmldir}/images/favicon.ico
539 %{htmldir}/images/marker.png
540 %{htmldir}/images/shadow50.png
541 %{htmldir}/nagioswall.php
543 %files theme-classicui
544 %defattr(644,root,root,755)
545 %exclude %{htmldir}/nagioswall.php
547 %{htmldir}/includes/*
549 %exclude %{htmldir}/images/favicon.ico
550 %exclude %{htmldir}/images/marker.png
551 %exclude %{htmldir}/images/shadow50.png
552 %{htmldir}/stylesheets/*
555 %defattr(644,root,root,755)
558 %defattr(644,root,root,755)
559 %dir %{_includedir}/%{name}
560 %{_includedir}/%{name}/*.h
561 %{_includedir}/%{name}/lib
562 %{_libdir}/libnagios.a