3 %bcond_without gd # without statusmap and trends, which require gd library
4 # reeenable when http://tracker.nagios.org/view.php?id=51 is fixed
7 Summary: Host/service/network monitoring program
8 Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci
9 Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços
15 Source0: http://dl.sourceforge.net/nagios/%{name}-%{version}.tar.gz
16 # Source0-md5: 3566167cc60ddeaad34e7d2e26ed4a58
17 Source1: %{name}-apache.conf
19 Source3: %{name}.sysconfig
20 Source4: %{name}-config-20090914.tar.bz2
21 # Source4-md5: 605f1cd28c00db961dad6f529d849f16
22 Source5: %{name}-lighttpd.conf
23 Patch0: %{name}-resources.patch
24 Patch1: %{name}-iconv-in-libc.patch
25 Patch2: %{name}-webapps.patch
26 Patch3: %{name}-cgi-http_charset.patch
27 Patch4: %{name}-cmd-typo.patch
29 URL: http://www.nagios.org/
30 BuildRequires: autoconf
31 BuildRequires: automake
33 BuildRequires: gd-devel
34 BuildRequires: libjpeg-devel
35 BuildRequires: libpng-devel
37 BuildRequires: rpmbuild(macros) >= 1.268
38 BuildRequires: sed >= 4.0
39 Requires(post,preun): /sbin/chkconfig
40 Requires: %{name}-common = %{version}-%{release}
43 Suggests: nagios-notify >= 0.13
46 Conflicts: iputils-ping < 1:ss020124
47 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49 %define _sysconfdir /etc/%{name}
50 %define _bindir %{_prefix}/sbin
51 %define _sbindir %{_libdir}/%{name}/cgi
52 %define _datadir %{_prefix}/share/%{name}
53 %define _localstatedir /var/lib/%{name}
54 %define _webapps /etc/webapps
55 %define _webapp %{name}
58 Nagios is a program that will monitor hosts and services on your
59 network. It has the ability to email or page you when a problem arises
60 and when a problem is resolved. Nagios is written in C and is designed
61 to run under Linux (and some other *NIX variants) as a background
62 process, intermittently running checks on various services that you
65 The actual service checks are performed by separate "plugin" programs
66 which return the status of the checks to Nagios. The plugins are
67 available in nagios-plugins packages.
69 Nagios is successor to NetSaint.
71 %description -l pl.UTF-8
72 Nagios to program, który monitoruje serwery oraz usługi w naszej
73 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
74 rozwiązaniu problemu. Nagios został napisany w C oraz jest
75 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
76 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
79 Właściwe sprawdzanie jest wykonywane przez osobne programy
80 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
81 są dostępne na stronie w pakietach nagios-plugins.
83 Nagios jest następcą NetSainta.
85 %description -l pt_BR.UTF-8
86 O Nagios é um programa que monitora máquinas e serviços na sua rede.
87 Ele pode enviar um email ou um aviso de pager para o administrador
88 quando surgir um problema e quando ele for resolvido. Nagios é escrito
89 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
90 variações de *NIX) como um processo em segundo plano, periodicamente
91 executando checagens nos diversos serviços que forem especificados.
94 Summary: Common files needed by both nagios and nrpe
95 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
97 Requires(postun): /usr/sbin/groupdel
98 Requires(postun): /usr/sbin/userdel
99 Requires(pre): /bin/id
100 Requires(pre): /usr/bin/getgid
101 Requires(pre): /usr/sbin/groupadd
102 Requires(pre): /usr/sbin/groupmod
103 Requires(pre): /usr/sbin/useradd
104 Requires(pre): /usr/sbin/usermod
105 Provides: group(nagcmd)
106 Provides: group(nagios)
107 Provides: user(nagios)
110 Common files needed by both nagios and nrpe.
112 %description common -l pl.UTF-8
113 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
116 Summary: CGI webinterface for Nagios
117 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
118 Group: Applications/WWW
119 # for dirs... and accessing local logs.
120 Requires: %{name} = %{version}-%{release}
121 Requires: %{name}-imagepaks
122 Requires: %{name}-theme
123 Requires: group(http)
126 Requires: webserver(access)
127 Requires: webserver(alias)
128 Requires: webserver(auth)
129 Requires: webserver(cgi)
130 Requires: webserver(indexfile)
133 CGI webinterface for Nagios.
135 %description cgi -l pl.UTF-8
136 Interfejs CGI dla Nagiosa.
138 %package theme-default
139 Summary: Default Nagios theme
140 Summary(pl.UTF-8): Domyślny motyw Nagiosa
141 Group: Applications/WWW
142 Requires: nagios-cgi = %{version}-%{release}
143 Requires: webserver(php)
144 Provides: nagios-theme
145 Obsoletes: nagios-theme
147 %description theme-default
148 Original theme from Nagios.
150 %description theme-default -l pl.UTF-8
151 Oryginalny motyw z Nagiosa.
154 Summary: Include files that Nagios-related applications may compile against
155 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
156 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
157 Group: Development/Libraries
158 # doesn't require base
161 This package provides include files that Nagios-related applications
164 %description devel -l pl.UTF-8
165 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
166 przez aplikacje związane z nagiosem podczas kompilacji.
168 %description devel -l pt_BR.UTF-8
169 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
170 aplicativos para o Nagios.
181 find -name .cvsignore -o -name .gitignore | xargs rm
183 mv nagios-config-*/objects/*.cfg sample-config/template-object
184 mv nagios-config-*/*.cfg sample-config
186 # cleanup backups after patching
187 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
190 s,".*/var/rw/nagios.cmd,"%{_localstatedir}/rw/nagios.cmd,
191 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
192 ' $(find contrib/eventhandlers -type f)
194 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
195 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf
199 # kill trailing spaces
202 s,/usr/local/nagios/share,@datadir@,g
203 # we want all authorized users have default access
205 ' sample-config/*.cfg.in
208 cp -f /usr/share/automake/config.sub .
212 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
213 --with-nagios-user=%{name} \
214 --with-nagios-grp=%{name} \
215 --with-command-user=%{name} \
216 --with-command-grp=%{name} \
217 --with-lockfile=%{_localstatedir}/%{name}.pid \
218 --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \
219 --with-ping_command='/bin/ping -n %%s -c %%d' \
220 %{!?with_gd:--disable-statusmap --disable-trends} \
221 %{?with_tests:--enable-libtap} \
222 --enable-event-broker
226 %{?with_tests:%{__make} test}
229 rm -rf $RPM_BUILD_ROOT
230 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
231 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
232 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
233 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins} \
234 %if "%{_lib}" != "lib"
235 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
238 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
239 cp -a include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
241 %{__make} install-unstripped \
242 DESTDIR=$RPM_BUILD_ROOT \
247 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
248 cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
250 # install templated configuration files
251 for a in nagios.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
252 cp -a sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
256 cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
257 cp -a apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
258 cp -a lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
259 cp -a sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
260 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
261 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
263 # install event handlers, sample config
264 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
265 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
266 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
267 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
269 # Object data/cache files
270 for i in {objects.{cache,precache},{comments,downtime,retention,status}.dat,nagios.tmp}; do
271 > $RPM_BUILD_ROOT%{_localstatedir}/$i
273 > $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
276 rm -rf $RPM_BUILD_ROOT
279 for i in %{_localstatedir}/{objects.{cache,precache},{comments,downtime,retention,status}.dat}; do
280 [ ! -f $i ] && touch $i
285 /sbin/chkconfig --add %{name}
286 %service %{name} restart "Nagios service"
289 if [ "$1" = "0" ] ; then
290 %service %{name} stop
291 /sbin/chkconfig --del %{name}
295 # rename group netsaint -> nagios
296 if [ "`getgid netsaint 2>/dev/null`" = "72" ]; then
297 /usr/sbin/groupmod -n nagios netsaint
299 # rename group nagios-data -> nagcmd
300 if [ "`getgid nagios-data 2>/dev/null`" = "147" ]; then
301 /usr/sbin/groupmod -n nagcmd nagios-data
303 %groupadd -g 72 nagios
304 %groupadd -g 147 -f nagcmd
305 if [ -n "`id -u netsaint 2>/dev/null`" ] && [ "`id -u netsaint`" = "72" ]; then
306 /usr/sbin/usermod -d %{_libdir}/nagios -l nagios -c "Nagios Daemon" -G nagcmd netsaint
308 %useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios
311 if [ "$1" = "0" ]; then
318 if [ "$1" = 1 ]; then
319 %banner %{name} -e <<EOF
321 You need to add user to %{_webapps}/%{_webapp}/passwd and
322 %{_webapps}/%{_webapp}/group to access Nagios via web.
327 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
328 %addusertogroup http nagcmd
329 %webapp_register apache %{_webapp}
331 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
332 %webapp_unregister apache %{_webapp}
334 %triggerin cgi -- apache < 2.2.0, apache-base
335 %addusertogroup http nagcmd
336 %webapp_register httpd %{_webapp}
338 %triggerun cgi -- apache < 2.2.0, apache-base
339 %webapp_unregister httpd %{_webapp}
341 %triggerin cgi -- lighttpd
342 %addusertogroup lighttpd nagcmd
343 %webapp_register lighttpd %{_webapp}
345 %triggerun cgi -- lighttpd
346 %webapp_unregister lighttpd %{_webapp}
348 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
349 chown root:http %{_sysconfdir}/cgi.cfg
351 %triggerpostun -- nagios < 3.1.2-4
353 for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
354 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
355 mv -f %{_sysconfdir}/$a{.rpmsave,}
358 %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/nagios.cfg
361 %defattr(644,root,root,755)
362 %doc Changelog README* UPGRADING INSTALLING LICENSE
363 %attr(750,root,nagios) %dir %{_sysconfdir}/objects
364 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.cfg
366 %attr(754,root,root) /etc/rc.d/init.d/%{name}
367 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
369 %attr(755,root,root) %{_bindir}/%{name}
370 %attr(755,root,root) %{_bindir}/nagiostats
372 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}
373 %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives
375 %attr(770,root,nagcmd) %dir %{_localstatedir}
376 %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw
377 %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/nagios.cmd
378 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
379 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
380 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
381 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
384 %attr(770,root,nagios) %dir %{_var}/spool/%{name}
385 %attr(770,root,nagios) %dir %{_var}/spool/%{name}/checkresults
387 %{_examplesdir}/%{name}-%{version}
390 %defattr(644,root,root,755)
391 %attr(750,root,nagcmd) %dir %{_sysconfdir}
392 %attr(750,root,nagios) %dir %{_sysconfdir}/plugins
393 %dir %{_libdir}/%{name}
394 %dir %{_libdir}/%{name}/plugins
395 %dir %{_libdir}/%{name}/eventhandlers
397 %if "%{_lib}" != "lib"
398 %dir %{_prefix}/lib/%{name}
399 %dir %{_prefix}/lib/%{name}/plugins
400 %dir %{_prefix}/lib/%{name}/eventhandlers
404 %defattr(644,root,root,755)
405 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
406 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
407 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
408 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
409 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
410 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
411 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
413 %attr(755,root,root) %{_sbindir}/*.cgi
416 %dir %{_datadir}/includes
417 %dir %{_datadir}/images
418 %dir %{_datadir}/stylesheets
419 %{_datadir}/robots.txt
420 %{_datadir}/contexthelp
424 %{_datadir}/images/favicon.ico
427 %defattr(644,root,root,755)
429 %{_datadir}/includes/*
431 %exclude %{_datadir}/images/favicon.ico
432 %{_datadir}/stylesheets/*
435 %defattr(644,root,root,755)
436 %dir %{_includedir}/%{name}
437 %{_includedir}/%{name}/*.h