2 # - check if default config works out of box
5 %bcond_without gd # without statusmap and trends, which require gd library
7 Summary: Host/service/network monitoring program
8 Summary(pl): Program do monitorowania serwerów/us³ug/sieci
9 Summary(pt_BR): Programa para monitoração de máquinas e serviços
14 Release: 0.%{_rc}.%{_rel}
17 Source0: http://dl.sourceforge.net/nagios/%{name}-%{version}%{_rc}.tar.gz
18 # Source0-md5: c4a08697f852b0d535bf34fff0bf8b1f
19 Source1: %{name}-apache.conf
21 Source3: %{name}.sysconfig
22 Source4: http://www.nagios.org/images/favicon.ico
23 # Source4-md5: 1c4201c7da53d6c7e48251d3a9680449
24 Source5: %{name}-config-20050514.tar.bz2
25 # Source5-md5: a2883c65377ef7beb55d48af85ec7ef7
26 Patch0: %{name}-resources.patch
27 Patch1: %{name}-iconv-in-libc.patch
28 Patch2: %{name}-favicon.patch
29 Patch3: %{name}-webapps.patch
30 URL: http://www.nagios.org/
31 BuildRequires: autoconf
32 BuildRequires: automake
34 BuildRequires: gd-devel
35 BuildRequires: libjpeg-devel
36 BuildRequires: libpng-devel
38 BuildRequires: sed >= 4.0
39 BuildRequires: rpmbuild(macros) >= 1.264
40 BuildRequires: tar >= 1:1.15.1
41 Requires: %{name}-common = %{version}-%{release}
45 Requires: nagios-plugins
46 Requires(post,postun): /sbin/chkconfig
47 Requires(triggerpostun): sed >= 4.0
49 Conflicts: iputils-ping < 1:ss020124
51 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
53 %define _sysconfdir /etc/%{name}
54 %define _bindir %{_prefix}/sbin
55 %define _sbindir %{_libdir}/%{name}/cgi
56 %define _datadir %{_prefix}/share/%{name}
57 %define _localstatedir /var/lib/%{name}
58 %define _webapps /etc/webapps
59 %define _webapp %{name}
62 Nagios is a program that will monitor hosts and services on your
63 network. It has the ability to email or page you when a problem arises
64 and when a problem is resolved. Nagios is written in C and is designed
65 to run under Linux (and some other *NIX variants) as a background
66 process, intermittently running checks on various services that you
69 The actual service checks are performed by separate "plugin" programs
70 which return the status of the checks to Nagios. The plugins are
71 available in nagios-plugins packages.
73 Nagios is successor to NetSaint.
76 Nagios to program, który monitoruje serwery oraz us³ugi w naszej
77 sieci. Posiada on mo¿liwo¶æ wysy³ania informacji o wyst±pieniu oraz
78 rozwi±zaniu problemu. Nagios zosta³ napisany w C oraz jest
79 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
80 jako proces pracuj±cy w tle i bezustannie wykonuj±cy pewne operacje
83 W³a¶ciwe sprawdzanie jest wykonywane przez osobne programy
84 ("wtyczki"), które zwracaj± informacje o statusie do Nagiosa. Wtyczki
85 s± dostêpne na stronie w pakietach nagios-plugins.
87 Nagios jest nastêpc± NetSainta.
90 O Nagios é um programa que monitora máquinas e serviços na sua rede.
91 Ele pode enviar um email ou um aviso de pager para o administrador
92 quando surgir um problema e quando ele for resolvido. Nagios é escrito
93 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
94 variações de *NIX) como um processo em segundo plano, periodicamente
95 executando checagens nos diversos serviços que forem especificados.
98 Summary: Common files needed by both nagios and nrpe
99 Summary(pl): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe
101 Requires(pre): /usr/bin/getgid
102 Requires(pre): /bin/id
103 Requires(pre): /usr/sbin/groupadd
104 Requires(pre): /usr/sbin/groupmod
105 Requires(pre): /usr/sbin/useradd
106 Requires(pre): /usr/sbin/usermod
107 Requires(postun): /usr/sbin/groupdel
108 Requires(postun): /usr/sbin/userdel
109 Provides: user(nagios)
110 Provides: group(nagios)
111 Provides: group(nagios-data)
114 Common files needed by both nagios and nrpe.
116 %description common -l pl
117 Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe.
120 Summary: CGI webinterface for Nagios
121 Summary(pl): Interfejs WWW/CGI dla Nagiosa
122 Group: Applications/WWW
123 # for dirs... and accessing local logs.
124 Requires: %{name} = %{version}-%{release}
125 Requires: %{name}-imagepaks
126 Requires: %{name}-theme
128 Requires: webserver = apache
129 Requires: apache(mod_alias)
130 Requires: apache(mod_cgi)
131 Requires: apache(mod_auth)
132 Requires: group(http)
135 CGI webinterface for Nagios.
137 %description cgi -l pl
138 Interfejs CGI dla Nagiosa.
140 %package theme-default
141 Summary: Default Nagios theme
142 Summary(pl): Domy¶lny motyw Nagiosa
143 Group: Applications/WWW
144 Requires: nagios-cgi = %{version}-%{release}
145 Provides: nagios-theme
146 Obsoletes: nagios-theme
148 %description theme-default
149 Original theme from Nagios.
151 %description theme-default -l pl
152 Oryginalny motyw z Nagiosa.
155 Summary: Include files that Nagios-related applications may compile against
156 Summary(pl): Pliki nag³ówkowe, wykorzystywane przez aplikacje nagiosa
157 Summary(pt_BR): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
158 Group: Development/Libraries
159 # doesn't require base
162 This package provides include files that Nagios-related applications
165 %description devel -l pl
166 Ten pakiet dostarcza pliki nag³ówkowe, które mog± byæ wykorzystywane
167 przez aplikacje zwi±zane z nagiosem podczas kompilacji.
169 %description devel -l pt_BR
170 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
171 aplicativos para o Nagios.
174 %setup -q -n %{name}-%{version}%{?_rc}
181 s,".*/var/rw/nagios.cmd,"%{_localstatedir}/rw/nagios.cmd,
182 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
183 ' $(find contrib/eventhandlers -type f)
186 cp -f /usr/share/automake/config.sub .
190 --with-nagios-user=%{name} \
191 --with-nagios-grp=%{name} \
192 --with-command-user=%{name} \
193 --with-command-grp=%{name} \
194 --with-lockfile=%{_localstatedir}/%{name}.pid \
195 --with-ping_command='/bin/ping -n %%s -c %%d' \
196 %{!?with_gd:--disable-statusmap --disable-trends}
201 rm -rf $RPM_BUILD_ROOT
202 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_includedir}/%{name},%{_libdir}/%{name}/{eventhandlers,plugins}} \
203 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir},%{_sysconfdir}/{plugins,local},%{_examplesdir}/%{name}-%{version}} \
204 $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
206 install include/locations.h $RPM_BUILD_ROOT%{_includedir}/%{name}
208 %{__make} install install-html install-init install-commandmode fullinstall \
209 DESTDIR=$RPM_BUILD_ROOT \
214 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
215 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
216 install %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}
218 # install templated configuration files
219 tar jxf %{SOURCE5} --strip-components=1 -C $RPM_BUILD_ROOT%{_sysconfdir}
222 install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
223 install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
224 mv $RPM_BUILD_ROOT{%{_sysconfdir}/cgi.cfg,%{_webapps}/%{_webapp}}
225 > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd
226 echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group
228 # install event handlers
229 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
231 # Object data/cache files
232 for i in {objects.cache,{comments,downtime,retention,status}.dat,nagios.tmp}; do
233 > $RPM_BUILD_ROOT%{_localstatedir}/$i
235 > $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
238 rm -rf $RPM_BUILD_ROOT
241 /sbin/chkconfig --add %{name}
242 if [ -f /var/lock/subsys/%{name} ]; then
243 /etc/rc.d/init.d/%{name} restart 1>&2
246 for i in %{_localstatedir}/{objects.cache,{comments,downtime,retention,status}.dat}; do
247 [ ! -f $i ] && touch $i
253 if [ "$1" = "0" ] ; then
254 if [ -f /var/lock/subsys/%{name} ]; then
255 /etc/rc.d/init.d/%{name} stop 1>&2
257 /sbin/chkconfig --del %{name}
261 if [ "`getgid netsaint`" = "72" ]; then
262 /usr/sbin/groupmod -n nagios netsaint
264 %groupadd -g 72 nagios
265 %groupadd -g 147 -f nagios-data
266 if [ -n "`id -u netsaint 2>/dev/null`" ] && [ "`id -u netsaint`" = "72" ]; then
267 /usr/sbin/usermod -d %{_libdir}/nagios -l nagios -c "Nagios User" -G nagios-data netsaint
269 %useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "Nagios User" -g nagios -G nagios-data nagios
272 if [ "$1" = "0" ]; then
275 %groupremove nagios-data
279 if [ "$1" = 1 ]; then
280 %banner %{name} -e <<EOF
282 You need to add user to %{_webapps}/%{_webapp}/passwd and
283 %{_webapps}/%{_webapp}/group to access nagios via web.
288 %triggerin cgi -- apache1
289 %addusertogroup http nagios-data
290 %webapp_register apache %{_webapp}
292 %triggerun cgi -- apache1
293 %webapp_unregister apache %{_webapp}
295 %triggerin cgi -- apache >= 2.0.0
296 %addusertogroup http nagios-data
297 %webapp_register httpd %{_webapp}
299 %triggerun -- apache >= 2.0.0
300 %webapp_unregister httpd %{_webapp}
302 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
303 chown root:http %{_sysconfdir}/cgi.cfg
305 %triggerpostun -- nagios < 2.0-0.b3.21
306 chown root:nagios %{_sysconfdir}/*.cfg
307 chown root:nagios-data %{_sysconfdir}/nagios.cfg
308 %addusertogroup nagios nagios-data
310 # must unify nagios.cfg
312 s,^status_file=.*,status_file=%{_localstatedir}/status.dat,
313 s,^comment_file=.*,comment_file=%{_localstatedir}/comments.dat,
314 s,^downtime_file=.*,downtime_file=%{_localstatedir}/downtime.dat,
315 s,^lock_file=.*,lock_file=%{_localstatedir}/nagios.pid,
316 s,^temp_file=.*,temp_file=%{_localstatedir}/nagios.tmp,
317 s,^state_retention_file=.*,state_retention_file=%{_localstatedir}/retention.dat,
320 s,^log_passive_service_checks=,log_passive_checks=,
321 s,^inter_check_delay_method=,service_inter_check_delay_method=,
322 s,^use_agressive_host_checking=,use_aggressive_host_checking=,
323 s,^freshness_check_interval=,service_freshness_check_interval=,
325 ' %{_sysconfdir}/nagios.cfg
328 s,\$DATETIME\$,$LONGDATETIME$,g
329 s,Nagios/1.2,Nagios/%{version},g
330 ' %{_sysconfdir}/misccommands.cfg
332 mv -f /var/log/nagios/status.log %{_localstatedir}/status.dat 2>/dev/null
333 mv -f /var/log/nagios/comment.log %{_localstatedir}/comments.dat 2>/dev/null
334 mv -f /var/log/nagios/downtime.log %{_localstatedir}/downtime.dat 2>/dev/null
335 mv -f /var/run/nagios.pid %{_localstatedir}/nagios.pid 2>/dev/null
336 mv -f /var/log/nagios/nagios.tmp %{_localstatedir}/nagios.tmp 2>/dev/null
337 mv -f /var/log/nagios/status.sav %{_localstatedir}/retention.dat 2>/dev/null
338 chown nagios:nagios %{_localstatedir}/nagios.pid 2>/dev/null
339 chown nagios:nagios-data %{_localstatedir}/rw/nagios.cmd 2>/dev/null
341 %service %{name} restart
343 %banner -e %{name}-2.0 <<'EOF'
344 Please read <http://nagios.sourceforge.net/docs/2_0/whatsnew.html>
345 there are changes that no longer work in Nagios 2.0.
347 You could also try use <http://oss.op5.se/nagios/object_config_fix.php.gz>
348 to convert your config (yes i know it's too late to say it now, after
349 the upgrade, but still :))
354 %triggerpostun cgi -- %{name}-cgi < 2.0-0.b4.3.8
355 for i in cgi.cfg group passwd; do
356 if [ -f /etc/nagios/$i.rpmsave ]; then
357 mv -f %{_webapps}/%{_webapp}/$i{,.rpmnew}
358 mv -f /etc/nagios/$i.rpmsave %{_webapps}/%{_webapp}/$i
362 # migrate from httpd (apache2) config dir
363 if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
364 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
365 mv -f /etc/httpd/%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
368 # migrate from apache-config macros
369 if [ -f /etc/%{name}/apache-nagios.conf.rpmsave ]; then
370 if [ -d /etc/apache/webapps.d ]; then
371 cp -f %{_webapps}/%{_webapp}/apache.conf{,.rpmnew}
372 cp -f /etc/%{name}/apache-nagios.conf.rpmsave %{_webapps}/%{_webapp}/apache.conf
375 if [ -d /etc/httpd/webapps.d ]; then
376 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
377 cp -f /etc/%{name}/apache-nagios.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
379 rm -f /etc/%{name}/apache-nagios.conf.rpmsave
382 # place new config location, as trigger puts config only on first install, do it here.
384 if [ -d /etc/apache/webapps.d ]; then
385 /usr/sbin/webapp register apache %{_webapp}
389 if [ -d /etc/httpd/webapps.d ]; then
390 /usr/sbin/webapp register httpd %{_webapp}
394 if [ "$httpd_reload" ]; then
395 if [ -f /var/lock/subsys/httpd ]; then
396 /etc/rc.d/init.d/httpd reload 1>&2
399 if [ "$apache_reload" ]; then
400 if [ -f /var/lock/subsys/apache ]; then
401 /etc/rc.d/init.d/apache reload 1>&2
406 %defattr(644,root,root,755)
407 %doc Changelog README* UPGRADING INSTALLING LICENSE
408 %doc sample-config/template-object/{bigger,minimal}.cfg
409 %attr(640,root,nagios-data) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nagios.cfg
410 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/[!n]*.cfg
412 %attr(754,root,root) /etc/rc.d/init.d/%{name}
413 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
415 %attr(755,root,root) %{_bindir}/%{name}
416 %attr(755,root,root) %{_bindir}/nagiostats
418 %attr(770,root,nagios-data) %dir %{_var}/log/%{name}
419 %attr(770,root,nagios-data) %dir %{_var}/log/%{name}/archives
421 %attr(770,root,nagios-data) %dir %{_localstatedir}
422 %attr(2770,root,nagios-data) %dir %{_localstatedir}/rw
423 %attr(660,nagios,nagios-data) %ghost %{_localstatedir}/rw/nagios.cmd
424 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
425 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
426 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
428 %{_examplesdir}/%{name}-%{version}
431 %defattr(644,root,root,755)
432 %attr(750,root,nagios-data) %dir %{_sysconfdir}
433 %attr(2750,root,nagios) %dir %{_sysconfdir}/plugins
434 %attr(2750,root,nagios) %dir %{_sysconfdir}/local
435 %dir %{_libdir}/%{name}
436 %dir %{_libdir}/%{name}/plugins
437 %dir %{_libdir}/%{name}/eventhandlers
440 %defattr(644,root,root,755)
441 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
442 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
443 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
444 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg
445 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd
446 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group
448 %attr(755,root,root) %{_sbindir}/*.cgi
451 %dir %{_datadir}/images
452 %dir %{_datadir}/stylesheets
453 %{_datadir}/favicon.ico
454 %{_datadir}/robots.txt
455 %{_datadir}/contexthelp
461 %defattr(644,root,root,755)
464 %{_datadir}/stylesheets/*
467 %defattr(644,root,root,755)
468 %dir %{_includedir}/%{name}
469 %{_includedir}/%{name}/*.h