3 %bcond_without gd # without statusmap and trends, which require gd library
6 # - permissions in /etc. things to consider:
7 # - cgi.cfg contains sensitive information
8 # - /etc/nagios/*.cfg should be readable by nagios (and webserver if -cgi is used)
9 # - all files should be owned by root as there's no write permission needed
10 # - create group "nagios-data" for sharing access with httpd user (/etc/nagios/*.cfg)
12 Summary: Host/service/network monitoring program
13 Summary(pl): Program do monitorowania serwerów/us³ug/sieci
14 Summary(pt_BR): Programa para monitoração de máquinas e serviços
21 Source0: http://dl.sourceforge.net/nagios/%{name}-%{version}%{_rc}.tar.gz
22 # Source0-md5: 051760458d961b6ee015b5932a8437c4
23 Source1: %{name}-apache.conf
25 Source3: %{name}.sysconfig
26 Source4: http://www.nagios.org/images/favicon.ico
27 # Source4-md5: 1c4201c7da53d6c7e48251d3a9680449
28 Patch1: %{name}-resources.patch
29 Patch2: %{name}-iconv-in-libc.patch
30 Patch3: %{name}-config.patch
31 Patch4: %{name}-favicon.patch
32 URL: http://www.nagios.org/
33 BuildRequires: autoconf
34 BuildRequires: automake
36 BuildRequires: gd-devel
37 BuildRequires: libjpeg-devel
38 BuildRequires: libpng-devel
39 BuildRequires: sed >= 4.0
41 BuildRequires: rpmbuild(macros) >= 1.202
45 Requires: nagios-plugins
46 Requires(pre): /usr/bin/getgid
47 Requires(pre): /bin/id
48 Requires(pre): /usr/sbin/groupadd
49 Requires(pre): /usr/sbin/groupmod
50 Requires(pre): /usr/sbin/useradd
51 Requires(pre): /usr/sbin/usermod
52 Requires(post,postun): /sbin/chkconfig
53 Requires(postun): /usr/sbin/groupdel
54 Requires(postun): /usr/sbin/userdel
55 Requires(triggerpostun): sed >= 4.0
57 Provides: user(nagios)
58 Provides: group(nagios)
59 Provides: group(nagios-data)
60 Conflicts: iputils-ping < 1:ss020124
62 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
64 %define _sysconfdir /etc/%{name}
65 %define _bindir %{_prefix}/sbin
66 %define _sbindir %{_libdir}/%{name}/cgi
67 %define _datadir %{_prefix}/share/%{name}
68 %define _localstatedir /var/lib/%{name}
70 %define _apache1dir /etc/apache
71 %define _apache2dir /etc/httpd
74 Nagios is a program that will monitor hosts and services on your
75 network. It has the ability to email or page you when a problem arises
76 and when a problem is resolved. Nagios is written in C and is designed
77 to run under Linux (and some other *NIX variants) as a background
78 process, intermittently running checks on various services that you
81 The actual service checks are performed by separate "plugin" programs
82 which return the status of the checks to Nagios. The plugins are
83 available in nagios-plugins packages.
85 Nagios is successor to NetSaint.
88 Nagios to program, który monitoruje serwery oraz us³ugi w naszej
89 sieci. Posiada on mo¿liwo¶æ wysy³ania informacji o wyst±pieniu oraz
90 rozwi±zaniu problemu. Nagios zosta³ napisany w C oraz jest
91 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
92 jako proces pracuj±cy w tle i bezustannie wykonuj±cy pewne operacje
95 W³a¶ciwe sprawdzanie jest wykonywane przez osobne programy
96 ("wtyczki"), które zwracaj± informacje o statusie do Nagiosa. Wtyczki
97 s± dostêpne na stronie w pakietach nagios-plugins.
99 Nagios jest nastêpc± NetSainta.
101 %description -l pt_BR
102 O Nagios é um programa que monitora máquinas e serviços na sua rede.
103 Ele pode enviar um email ou um aviso de pager para o administrador
104 quando surgir um problema e quando ele for resolvido. Nagios é escrito
105 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
106 variações de *NIX) como um processo em segundo plano, periodicamente
107 executando checagens nos diversos serviços que forem especificados.
110 Summary: CGI webinterface for Nagios
111 Summary(pl): Interfejs WWW/CGI dla Nagiosa
113 # for dirs... and accessing local logs(?)
114 Requires: %{name} = %{version}-%{release}
115 Requires: %{name}-imagepaks
116 Requires: webserver = apache
117 Requires: apache(mod_alias)
118 Requires: apache(mod_cgi)
119 Requires: apache(mod_auth)
120 Requires: group(http)
123 CGI webinterface for Nagios.
125 %description cgi -l pl
126 Interfejs CGI dla Nagiosa.
129 Summary: Include files that Nagios-related applications may compile against
130 Summary(pl): Pliki nag³ówkowe, wykorzystywane przez aplikacje nagiosa
131 Summary(pt_BR): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
132 Group: Development/Libraries
133 # doesn't require base
136 This package provides include files that Nagios-related applications
139 %description devel -l pl
140 Ten pakiet dostarcza pliki nag³ówkowe, które mog± byæ wykorzystywane
141 przez aplikacje zwi±zane z nagiosem podczas kompilacji.
143 %description devel -l pt_BR
144 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
145 aplicativos para o Nagios.
148 %setup -q -n %{name}-%{version}%{?_rc}
155 s,".*/var/rw/nagios.cmd,"%{_localstatedir}/rw/nagios.cmd,
156 s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers,
157 ' $(find contrib/eventhandlers -type f)
160 cp -f /usr/share/automake/config.sub .
164 --with-nagios-user=%{name} \
165 --with-nagios-grp=%{name} \
166 --with-command-user=%{name} \
167 --with-command-grp=%{name} \
168 --with-lockfile=%{_localstatedir}/%{name}.pid \
169 --with-ping_command='/bin/ping -n %%s -c %%d' \
170 %{!?with_gd:--disable-statusmap --disable-trends}
175 rm -rf $RPM_BUILD_ROOT
176 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_includedir}/%{name},%{_libdir}/%{name}/{eventhandlers,plugins}} \
177 $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir},%{_sysconfdir},%{_examplesdir}/%{name}-%{version}}
179 install include/locations.h $RPM_BUILD_ROOT%{_includedir}/%{name}
181 %{__make} install install-html install-init install-commandmode fullinstall \
182 DESTDIR=$RPM_BUILD_ROOT \
187 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf
188 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
189 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
190 install %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}
192 # install templated configuration files
193 install sample-config/{nagios,cgi,resource}.cfg $RPM_BUILD_ROOT%{_sysconfdir}
194 install sample-config/{contact{s,groups},{misccommand,dependencie,escalation,hostgroup,host,service,timeperiod,checkcommand}s}.cfg $RPM_BUILD_ROOT%{_sysconfdir}
195 install sample-config/{service,host}extinfo.cfg $RPM_BUILD_ROOT%{_sysconfdir}
196 > $RPM_BUILD_ROOT%{_sysconfdir}/passwd
197 echo 'nagios:' > $RPM_BUILD_ROOT%{_sysconfdir}/group
199 # install event handlers
200 cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
202 # Object data/cache files
203 for i in {objects.cache,{comments,downtime,retention,status}.dat,nagios.tmp}; do
204 > $RPM_BUILD_ROOT%{_localstatedir}/$i
206 > $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
209 rm -rf $RPM_BUILD_ROOT
212 if [ "`getgid netsaint`" = "72" ]; then
213 /usr/sbin/groupmod -n nagios netsaint
215 %groupadd -g 72 nagios
216 %groupadd -g 147 -f nagios-data
217 if [ -n "`id -u netsaint 2>/dev/null`" ] && [ "`id -u netsaint`" = "72" ]; then
218 /usr/sbin/usermod -d %{_libdir}/nagios -l nagios -c "Nagios User" -G nagios-data netsaint
220 %useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "Nagios User" -g nagios -G nagios-data nagios
223 /sbin/chkconfig --add %{name}
224 if [ -f /var/lock/subsys/%{name} ]; then
225 /etc/rc.d/init.d/%{name} restart 1>&2
228 for i in %{_localstatedir}/{objects.cache,{comments,downtime,retention,status}.dat}; do
229 [ ! -f $i ] && touch $i
235 if [ "$1" = "0" ] ; then
236 if [ -f /var/lock/subsys/%{name} ]; then
237 /etc/rc.d/init.d/%{name} stop 1>&2
239 /sbin/chkconfig --del %{name}
243 if [ "$1" = "0" ]; then
246 %groupremove nagios-data
250 %addusertogroup http nagios-data
253 if [ -d %{_apache1dir}/conf.d ]; then
254 ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache1dir}/conf.d/99_%{name}.conf
255 if [ -f /var/lock/subsys/apache ]; then
256 /etc/rc.d/init.d/apache restart 1>&2
260 if [ -d %{_apache2dir}/httpd.conf ]; then
261 ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache2dir}/httpd.conf/99_%{name}.conf
262 if [ -f /var/lock/subsys/httpd ]; then
263 /etc/rc.d/init.d/httpd restart 1>&2
267 if [ "$1" = 1 ]; then
268 %banner %{name} -e <<EOF
270 You need to add user to %{_sysconfdir}/passwd and %{_sysconfdir}/group to acccess nagios via web.
276 if [ "$1" = "0" ]; then
278 if [ -d %{_apache1dir}/conf.d ]; then
279 rm -f %{_apache1dir}/conf.d/99_%{name}.conf
280 if [ -f /var/lock/subsys/apache ]; then
281 /etc/rc.d/init.d/apache restart 1>&2
285 if [ -d %{_apache2dir}/httpd.conf ]; then
286 rm -f %{_apache2dir}/httpd.conf/99_%{name}.conf
287 if [ -f /var/lock/subsys/httpd ]; then
288 /etc/rc.d/init.d/httpd restart 1>&2
293 %triggerpostun -- nagios-cgi < 2.0-0.b3.21
294 chown root:http %{_sysconfdir}/cgi.cfg
296 %triggerpostun -- nagios < 2.0-0.b3.21
297 chown root:nagios %{_sysconfdir}/*.cfg
298 chown root:nagios-data %{_sysconfdir}/nagios.cfg
299 %addusertogroup nagios nagios-data
301 # must unify nagios.cfg
303 s,^status_file=.*,status_file=%{_localstatedir}/status.dat,
304 s,^comment_file=.*,comment_file=%{_localstatedir}/comments.dat,
305 s,^downtime_file=.*,downtime_file=%{_localstatedir}/downtime.dat,
306 s,^lock_file=.*,lock_file=%{_localstatedir}/nagios.pid,
307 s,^temp_file=.*,temp_file=%{_localstatedir}/nagios.tmp,
308 s,^state_retention_file=.*,state_retention_file=%{_localstatedir}/retention.dat,
311 s,^log_passive_service_checks=,log_passive_checks=,
312 s,^inter_check_delay_method=,service_inter_check_delay_method=,
313 s,^use_agressive_host_checking=,use_aggressive_host_checking=,
314 s,^freshness_check_interval=,service_freshness_check_interval=,
316 ' %{_sysconfdir}/nagios.cfg
319 s,\$DATETIME\$,$LONGDATETIME$,g
320 s,Nagios/1.2,Nagios/%{version},g
321 ' %{_sysconfdir}/misccommands.cfg
323 mv -f /var/log/nagios/status.log %{_localstatedir}/status.dat 2>/dev/null
324 mv -f /var/log/nagios/comment.log %{_localstatedir}/comments.dat 2>/dev/null
325 mv -f /var/log/nagios/downtime.log %{_localstatedir}/downtime.dat 2>/dev/null
326 mv -f /var/run/nagios.pid %{_localstatedir}/nagios.pid 2>/dev/null
327 mv -f /var/log/nagios/nagios.tmp %{_localstatedir}/nagios.tmp 2>/dev/null
328 mv -f /var/log/nagios/status.sav %{_localstatedir}/retention.dat 2>/dev/null
329 chown nagios:nagios %{_localstatedir}/nagios.pid 2>/dev/null
330 chown nagios:nagios-data %{_localstatedir}/rw/nagios.cmd 2>/dev/null
332 if [ -f /var/lock/subsys/%{name} ]; then
333 /etc/rc.d/init.d/%{name} restart 1>&2 || :
336 # apache2 config was also moved.
337 if [ -f /etc/httpd/nagios.conf.rpmsave ]; then
338 cp -f %{_sysconfdir}/apache-%{name}.conf{,.rpmnew}
339 mv -f /etc/httpd/nagios.conf.rpmsave %{_sysconfdir}/apache-%{name}.conf
341 if [ -f /var/lock/subsys/httpd ]; then
342 /etc/rc.d/init.d/httpd restart 1>&2 || :
346 echo "Please read http://nagios.sourceforge.net/docs/2_0/whatsnew.html
347 there are changes that no longer work in Nagios 2.0"
350 %defattr(644,root,root,755)
351 %doc Changelog README* UPGRADING INSTALLING LICENSE
352 %doc sample-config/template-object/{bigger,minimal}.cfg
353 %attr(750,root,nagios-data) %dir %{_sysconfdir}
354 %attr(640,root,nagios-data) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nagios.cfg
355 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/[!n]*.cfg
356 %exclude %{_sysconfdir}/cgi.cfg
358 %attr(754,root,root) /etc/rc.d/init.d/%{name}
359 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
361 %dir %{_libdir}/%{name}
362 %dir %{_libdir}/%{name}/plugins
364 %attr(755,root,root) %{_bindir}/%{name}
365 %attr(755,root,root) %{_bindir}/nagiostats
367 %attr(770,root,nagios-data) %{_var}/log/%{name}
368 %attr(770,root,nagios-data) %dir %{_var}/log/%{name}/archives
370 %attr(770,root,nagios-data) %dir %{_localstatedir}
371 %attr(2770,root,nagios-data) %dir %{_localstatedir}/rw
372 # NOTE: the permissions are set in post script
373 %ghost %{_localstatedir}/rw/nagios.cmd
374 %ghost %{_localstatedir}/objects.cache
375 %ghost %{_localstatedir}/*.dat
376 %ghost %{_localstatedir}/%{name}.tmp
378 %{_examplesdir}/%{name}-%{version}
380 %dir %{_libdir}/%{name}/eventhandlers
383 %defattr(644,root,root,755)
384 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache-%{name}.conf
385 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/cgi.cfg
386 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/passwd
387 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/group
389 %attr(755,root,root) %{_sbindir}/*.cgi
393 %defattr(644,root,root,755)
394 %dir %{_includedir}/%{name}
395 %{_includedir}/%{name}/*.h