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: f3c60428cba14264c709749182b8d93e
17 Source1: %{name}-apache.conf
19 Source3: %{name}.sysconfig
20 Source4: http://www.nagios.org/images/favicon.ico
21 # Source4-md5: 1c4201c7da53d6c7e48251d3a9680449
22 Source5: %{name}-config-20090803.tar.bz2
23 # Source5-md5: e4c42ebadecef32cfe14cc3085f5bae4
24 Source6: %{name}-lighttpd.conf
25 Patch0: %{name}-resources.patch
26 Patch1: %{name}-iconv-in-libc.patch
27 Patch2: %{name}-webapps.patch
28 Patch3: %{name}-cgi-http_charset.patch
29 Patch4: %{name}-cmd-typo.patch
31 URL: http://www.nagios.org/
32 BuildRequires: autoconf
33 BuildRequires: automake
35 BuildRequires: gd-devel
36 BuildRequires: libjpeg-devel
37 BuildRequires: libpng-devel
39 BuildRequires: rpmbuild(macros) >= 1.268
40 BuildRequires: sed >= 4.0
41 BuildRequires: tar >= 1:1.15.1
42 Requires(post,preun): /sbin/chkconfig
43 Requires(triggerpostun): sed >= 4.0
44 Requires: %{name}-common = %{version}-%{release}
46 Requires: nagios-notify
51 Conflicts: iputils-ping < 1:ss020124
52 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
54 %define _sysconfdir /etc/%{name}
55 %define _bindir %{_prefix}/sbin
56 %define _sbindir %{_libdir}/%{name}/cgi
57 %define _datadir %{_prefix}/share/%{name}
58 %define _localstatedir /var/lib/%{name}
59 %define _webapps /etc/webapps
60 %define _webapp %{name}
63 Nagios is a program that will monitor hosts and services on your
64 network. It has the ability to email or page you when a problem arises
65 and when a problem is resolved. Nagios is written in C and is designed
66 to run under Linux (and some other *NIX variants) as a background
67 process, intermittently running checks on various services that you
70 The actual service checks are performed by separate "plugin" programs
71 which return the status of the checks to Nagios. The plugins are
72 available in nagios-plugins packages.
74 Nagios is successor to NetSaint.
76 %description -l pl.UTF-8
77 Nagios to program, który monitoruje serwery oraz usługi w naszej
78 sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz
79 rozwiązaniu problemu. Nagios został napisany w C oraz jest
80 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
81 jako proces pracujący w tle i bezustannie wykonujący pewne operacje
84 Właściwe sprawdzanie jest wykonywane przez osobne programy
85 ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki
86 są dostępne na stronie w pakietach nagios-plugins.
88 Nagios jest następcą NetSainta.
90 %description -l pt_BR.UTF-8
91 O Nagios é um programa que monitora máquinas e serviços na sua rede.
92 Ele pode enviar um email ou um aviso de pager para o administrador
93 quando surgir um problema e quando ele for resolvido. Nagios é escrito
94 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
95 variações de *NIX) como um processo em segundo plano, periodicamente
96 executando checagens nos diversos serviços que forem especificados.
99 Summary: Common files needed by both nagios and nrpe
100 Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
102 Requires(postun): /usr/sbin/groupdel
103 Requires(postun): /usr/sbin/userdel
104 Requires(pre): /bin/id
105 Requires(pre): /usr/bin/getgid
106 Requires(pre): /usr/sbin/groupadd
107 Requires(pre): /usr/sbin/groupmod
108 Requires(pre): /usr/sbin/useradd
109 Requires(pre): /usr/sbin/usermod
110 Provides: group(nagios)
111 Provides: group(nagios-data)
112 Provides: user(nagios)
115 Common files needed by both nagios and nrpe.
117 %description common -l pl.UTF-8
118 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
121 Summary: CGI webinterface for Nagios
122 Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa
123 Group: Applications/WWW
124 # for dirs... and accessing local logs.
125 Requires: %{name} = %{version}-%{release}
126 Requires: %{name}-imagepaks
127 Requires: %{name}-theme
128 Requires: group(http)
131 Requires: webserver(access)
132 Requires: webserver(alias)
133 Requires: webserver(auth)
134 Requires: webserver(cgi)
135 Requires: webserver(indexfile)
138 CGI webinterface for Nagios.
140 %description cgi -l pl.UTF-8
141 Interfejs CGI dla Nagiosa.
143 %package theme-default
144 Summary: Default Nagios theme
145 Summary(pl.UTF-8): Domyślny motyw Nagiosa
146 Group: Applications/WWW
147 Requires: nagios-cgi = %{version}-%{release}
148 Requires: webserver(php)
149 Provides: nagios-theme
150 Obsoletes: nagios-theme
152 %description theme-default
153 Original theme from Nagios.
155 %description theme-default -l pl.UTF-8
156 Oryginalny motyw z Nagiosa.
159 Summary: Include files that Nagios-related applications may compile against
160 Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa
161 Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
162 Group: Development/Libraries
163 # doesn't require base
166 This package provides include files that Nagios-related applications
169 %description devel -l pl.UTF-8
170 Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane
171 przez aplikacje związane z nagiosem podczas kompilacji.
173 %description devel -l pt_BR.UTF-8
174 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
175 aplicativos para o Nagios.
186 find -name .cvsignore | xargs rm
188 mv nagios-config-*/objects/*.cfg sample-config/template-object
189 mv nagios-config-*/*.cfg sample-config
192 s,".*/var/rw/nagios.cmd,"%{_localstatedir}/rw/nagios.cmd,
193 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
194 ' $(find contrib/eventhandlers -type f)
196 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf
197 sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE6} > lighttpd.conf
201 # kill trailing spaces
204 s,/usr/local/nagios/share,@datadir@,g
205 # we want all authorized users have default access
207 ' sample-config/*.cfg.in
210 cp -f /usr/share/automake/config.sub .
214 --datarootdir=%{_datadir} \
215 --with-nagios-user=%{name} \
216 --with-nagios-grp=%{name} \
217 --with-command-user=%{name} \
218 --with-command-grp=%{name} \
219 --with-lockfile=%{_localstatedir}/%{name}.pid \
220 --with-ping_command='/bin/ping -n %%s -c %%d' \
221 %{!?with_gd:--disable-statusmap --disable-trends} \
222 %{?with_tests:--enable-libtap} \
223 --enable-event-broker
227 %{?with_tests:%{__make} test}
230 rm -rf $RPM_BUILD_ROOT
231 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \
232 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \
233 $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \
234 $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins} \
235 %if "%{_lib}" != "lib"
236 $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \
239 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
240 install include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
242 %{__make} install-unstripped \
243 DESTDIR=$RPM_BUILD_ROOT \
248 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
249 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
250 install %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}
252 # install templated configuration files
253 for a in nagios.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do
254 cp -a sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir}
258 install apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
259 install apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
260 install lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
261 cp -a sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
262 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
263 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
265 # install event handlers, sample config
266 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
267 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
268 cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
269 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
271 # Object data/cache files
272 for i in {objects.cache,{comments,downtime,retention,status}.dat,nagios.tmp}; do
273 > $RPM_BUILD_ROOT%{_localstatedir}/$i
275 > $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
278 rm -rf $RPM_BUILD_ROOT
281 for i in %{_localstatedir}/{objects.cache,{comments,downtime,retention,status}.dat}; do
282 [ ! -f $i ] && touch $i
287 /sbin/chkconfig --add %{name}
288 %service %{name} restart "Nagios service"
291 if [ "$1" = "0" ] ; then
292 %service %{name} stop
293 /sbin/chkconfig --del %{name}
297 if [ "`getgid netsaint 2>/dev/null`" = "72" ]; then
298 /usr/sbin/groupmod -n nagios netsaint
300 %groupadd -g 72 nagios
301 %groupadd -g 147 -f nagios-data
302 if [ -n "`id -u netsaint 2>/dev/null`" ] && [ "`id -u netsaint`" = "72" ]; then
303 /usr/sbin/usermod -d %{_libdir}/nagios -l nagios -c "Nagios Daemon" -G nagios-data netsaint
305 %useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "Nagios Daemon" -g nagios -G nagios-data nagios
308 if [ "$1" = "0" ]; then
311 %groupremove nagios-data
315 if [ "$1" = 1 ]; then
316 %banner %{name} -e <<EOF
318 You need to add user to %{_webapps}/%{_webapp}/passwd and
319 %{_webapps}/%{_webapp}/group to access Nagios via web.
324 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
325 %addusertogroup http nagios-data
326 %webapp_register apache %{_webapp}
328 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
329 %webapp_unregister apache %{_webapp}
331 %triggerin cgi -- apache < 2.2.0, apache-base
332 %addusertogroup http nagios-data
333 %webapp_register httpd %{_webapp}
335 %triggerun cgi -- apache < 2.2.0, apache-base
336 %webapp_unregister httpd %{_webapp}
338 %triggerin cgi -- lighttpd
339 %addusertogroup lighttpd nagios-data
340 %webapp_register lighttpd %{_webapp}
342 %triggerun cgi -- lighttpd
343 %webapp_unregister lighttpd %{_webapp}
345 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
346 chown root:http %{_sysconfdir}/cgi.cfg
348 %triggerpostun -- nagios < 3.1.2-3
350 for a in services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do
351 if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then
352 mv -f %{_sysconfdir}/$a{.rpmsave,}
357 %defattr(644,root,root,755)
358 %doc Changelog README* UPGRADING INSTALLING LICENSE
359 %attr(640,root,nagios-data) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nagios.cfg
360 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/[!n]*.cfg
362 %attr(754,root,root) /etc/rc.d/init.d/%{name}
363 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
365 %attr(755,root,root) %{_bindir}/%{name}
366 %attr(755,root,root) %{_bindir}/nagiostats
368 %attr(770,root,nagios-data) %dir %{_var}/log/%{name}
369 %attr(770,root,nagios-data) %dir %{_var}/log/%{name}/archives
371 %attr(770,root,nagios-data) %dir %{_localstatedir}
372 %attr(2770,root,nagios-data) %dir %{_localstatedir}/rw
373 %attr(660,nagios,nagios-data) %ghost %{_localstatedir}/rw/nagios.cmd
374 %attr(2770,root,nagios-data) %dir %{_localstatedir}/spool
375 %attr(2770,root,nagios-data) %dir %{_localstatedir}/spool/checkresults
376 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
377 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
378 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
380 %{_examplesdir}/%{name}-%{version}
383 %defattr(644,root,root,755)
384 %attr(750,root,nagios-data) %dir %{_sysconfdir}
385 %attr(2750,root,nagios) %dir %{_sysconfdir}/plugins
386 %attr(2750,root,nagios) %dir %{_sysconfdir}/objects
387 %dir %{_libdir}/%{name}
388 %dir %{_libdir}/%{name}/plugins
389 %dir %{_libdir}/%{name}/eventhandlers
391 %if "%{_lib}" != "lib"
392 %dir %{_prefix}/lib/%{name}
393 %dir %{_prefix}/lib/%{name}/plugins
394 %dir %{_prefix}/lib/%{name}/eventhandlers
398 %defattr(644,root,root,755)
399 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
400 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
401 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
402 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
403 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
404 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
405 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
407 %attr(755,root,root) %{_sbindir}/*.cgi
410 %dir %{_datadir}/includes
411 %dir %{_datadir}/images
412 %dir %{_datadir}/stylesheets
413 %{_datadir}/favicon.ico
414 %{_datadir}/robots.txt
415 %{_datadir}/contexthelp
421 %defattr(644,root,root,755)
423 %{_datadir}/includes/*
425 %{_datadir}/stylesheets/*
428 %defattr(644,root,root,755)
429 %dir %{_includedir}/%{name}
430 %{_includedir}/%{name}/*.h