]> git.pld-linux.org Git - packages/nagios.git/blob - nagios.spec
- "MySQL" unification
[packages/nagios.git] / nagios.spec
1 #
2 # Conditional build:
3 %bcond_with     pgsql   # enable pgsql support
4 %bcond_with     mysql   # enable MySQL support
5 %bcond_without  gd      # without statusmap and trends, which require gd library
6 #
7 # TODO:
8 # - remove *-sample from /etc - move it to %doc or place without "-sample" suffix
9 Summary:        Host/service/network monitoring program
10 Summary(pl):    Program do monitorowania serwerów/us³ug/sieci
11 Summary(pt_BR): Programa para monitoração de máquinas e serviços
12 Name:           nagios
13 Version:        1.2
14 Release:        6
15 License:        GPL v2
16 Group:          Networking
17 Source0:        http://dl.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
18 # Source0-md5:  414d70e5269d5b8d7c21bf3ee129309f
19 Source1:        %{name}-apache.conf
20 Source2:        %{name}.init
21 Source3:        http://dl.sf.net/nagios/imagepak-base.tar.gz
22 Patch0:         %{name}-pgsql.patch
23 Patch1:         %{name}-resources.patch
24 Patch2:         %{name}-iconv-in-libc.patch
25 URL:            http://www.nagios.org/
26 BuildRequires:  autoconf
27 BuildRequires:  automake
28 %if %{with gd}
29 BuildRequires:  gd-devel
30 BuildRequires:  libjpeg-devel
31 BuildRequires:  libpng-devel
32 %endif
33 %{?with_mysql:BuildRequires:    mysql-devel}
34 %{?with_pgsql:BuildRequires:    postgresql-devel}
35 BuildRequires:  rpmbuild(macros) >= 1.159
36 PreReq:         rc-scripts
37 PreReq:         sh-utils
38 Requires(pre):  /usr/bin/getgid
39 Requires(pre):  /bin/id
40 Requires(pre):  /usr/sbin/groupadd
41 Requires(pre):  /usr/sbin/groupmod
42 Requires(pre):  /usr/sbin/useradd
43 Requires(pre):  /usr/sbin/usermod
44 Requires(post,postun):  /sbin/chkconfig
45 Requires(postun):       /usr/sbin/groupdel
46 Requires(postun):       /usr/sbin/userdel
47 Provides:       user(nagios)
48 Provides:       group(nagios)
49 Conflicts:      iputils-ping < 1:ss020124
50 Obsoletes:      netsaint
51 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
52
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
59 %description
60 Nagios is a program that will monitor hosts and services on your
61 network. It has the ability to email or page you when a problem arises
62 and when a problem is resolved. Nagios is written in C and is designed
63 to run under Linux (and some other *NIX variants) as a background
64 process, intermittently running checks on various services that you
65 specify.
66
67 The actual service checks are performed by separate "plugin" programs
68 which return the status of the checks to Nagios. The plugins are
69 available in nagios-plugins packages.
70
71 Nagios is successor to NetSaint.
72
73 %description -l pl
74 Nagios to program, który monitoruje serwery oraz us³ugi w naszej
75 sieci. Posiada on mo¿liwo¶æ wysy³ania informacji o wyst±pieniu oraz
76 rozwi±zaniu problemu. Nagios zosta³ napisany w C oraz jest
77 zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami)
78 jako proces pracuj±cy w tle i bezustannie wykonuj±cy pewne operacje
79 sprawdzaj±ce.
80
81 W³a¶ciwe sprawdzanie jest wykonywane przez osobne programy
82 ("wtyczki"), które zwracaj± informacje o statusie do Nagiosa. Wtyczki
83 s± dostêpne na stronie w pakietach nagios-plugins.
84
85 Nagios jest nastêpc± NetSainta.
86
87 %description -l pt_BR
88 O Nagios é um programa que monitora máquinas e serviços na sua rede.
89 Ele pode enviar um email ou um aviso de pager para o administrador
90 quando surgir um problema e quando ele for resolvido. Nagios é escrito
91 em C e foi desenvolvido para rodar em plataformas Linux (e algumas
92 variações de *NIX) como um processo em segundo plano, periodicamente
93 executando checagens nos diversos serviços que forem especificados.
94
95 %package cgi
96 Summary:        CGI webinterface for Nagios
97 Summary(pl):    Interfejs WWW/CGI dla Nagiosa
98 Group:          Networking
99 # for dirs... and accessing local logs(?)
100 Requires:       %{name} = %{version}-%{release}
101 Requires:       apache
102
103 %description cgi
104 CGI webinterface for Nagios.
105
106 %description cgi -l pl
107 Interfejs CGI dla Nagiosa.
108
109 %package devel
110 Summary:        Include files that Netsaint-related applications may compile against
111 Summary(pl):    Pliki nag³ówkowe, wykorzystywane przez aplikacje nagiosa
112 Summary(pt_BR): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios
113 Group:          Development/Libraries
114 # doesn't require base
115
116 %description devel
117 This package provides include files that Netsaint-related applications
118 may compile against.
119
120 %description devel -l pl
121 Ten pakiet dostarcza pliki nag³ówkowe, które mog± byæ wykorzystywane
122 przez aplikacje zwi±zane z nagiosem podczas kompilacji.
123
124 %description devel -l pt_BR
125 Este pacote contém arquivos de cabeçalho usados no desenvolvimento de
126 aplicativos para o Nagios.
127
128 %prep
129 %setup -q
130 %{?with_pgsql:%patch0 -p1}
131 %patch1 -p0
132 %patch2 -p1
133
134 %build
135 %{__aclocal}
136 %{__autoconf}
137 %configure \
138         --with-nagios-user=%{name} \
139         --with-nagios-grp=%{name} \
140         --with-command-user=nobody \
141         --with-command-grp=nobody \
142         --with-lockfile=/var/run/%{name}.pid \
143         --with-ping_command='/bin/ping -n %%s -c %%d' \
144         %{?with_mysql:--with-mysql-xdata --with-mysql-status --with-mysql-comments --with-mysql-extinfo --with-mysql-retention --with-mysql-downtime --with-mysql-lib=%{_libdir} --with-mysql-inc=%{_includedir}/mysql} \
145         %{?with_pgsql:--with-pgsql-xdata --with-pgsql-status --with-pgsql-comments --with-pgsql-extinfo --with-pgsql-retention --with-pgsql-downtime--with-pgsql-lib=%{_libdir} --with-pgsql-inc=%{_includedir}/postgresql} \
146         %{!?with_gd:--disable-statusmap --disable-trends}
147
148 %{__make} all
149
150 %install
151 rm -rf $RPM_BUILD_ROOT
152 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,httpd},%{_includedir}/%{name},%{_libdir}/%{name}/plugins} \
153         $RPM_BUILD_ROOT{%{_var}/log/%{name},%{_localstatedir}}
154
155 install common/locations.h      $RPM_BUILD_ROOT%{_includedir}/%{name}
156
157 %{__make} install install-html install-config install-init install-commandmode fullinstall \
158         DESTDIR=$RPM_BUILD_ROOT \
159         INSTALL_OPTS="" \
160         INIT_OPTS="" \
161         COMMAND_OPTS=""
162
163 install %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/%{name}.conf
164 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
165
166 ### Install logos
167 tar -xvz -C $RPM_BUILD_ROOT%{_datadir}/images/logos -f %{SOURCE3}
168
169
170 %clean
171 rm -rf $RPM_BUILD_ROOT
172
173 %pre
174 if [ -n "`getgid nagios`" ]; then
175         if [ "`getgid nagios`" != "72" ]; then
176                 echo "Error: group nagios doesn't have gid=72. Correct this before installing %{name}." 1>&2
177                 exit 1
178         fi
179 else
180         if [ -n "`getgid netsaint`" -a "`getgid netsaint`" = "72" ]; then
181                 /usr/sbin/groupmod -n nagios netsaint
182         else
183                 /usr/sbin/groupadd -g 72 -f nagios
184         fi
185 fi
186 if [ -n "`id -u nagios 2>/dev/null`" ]; then
187         if [ "`id -u nagios`" != "72" ]; then
188                 echo "Error: user nagios doesn't have uid=72. Correct this before installing %{name}." 1>&2
189                 exit 1
190         fi
191 else
192         if [ -n "`id -u netsaint 2>/dev/null`" -a "`id -u netsaint`" = "72" ]; then
193                 /usr/sbin/usermod -d /tmp -l nagios netsaint
194         else
195                 /usr/sbin/useradd -u 72 -d %{_libdir}/nagios -s /bin/false -c "%{name} User" -g nagios nagios 1>&2
196         fi
197 fi
198
199 %post
200 /sbin/chkconfig --add %{name}
201 if [ -f /var/lock/subsys/%{name} ]; then
202         /etc/rc.d/init.d/%{name} restart 1>&2
203 fi
204
205 %preun
206 if [ "$1" = "0" ] ; then
207         if [ -f /var/lock/subsys/%{name} ]; then
208                 /etc/rc.d/init.d/%{name} stop 1>&2
209         fi
210         /sbin/chkconfig --del %{name}
211 fi
212
213 %postun
214 if [ "$1" = "0" ]; then
215         %userremove nagios
216         %groupremove nagios
217 fi
218
219 %files
220 %defattr(644,root,root,755)
221 %doc Changelog README* UPGRADING contrib/database
222 %attr(754,root,root) /etc/rc.d/init.d/%{name}
223 %attr(751,root,nagios) %dir %{_sysconfdir}
224 %attr(644,root,nagios) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/[!c]*
225 %attr(644,root,nagios) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/c[!g]*
226 %dir %{_libdir}/%{name}
227 %dir %{_libdir}/%{name}/plugins
228 %attr(755,root,root) %{_bindir}/%{name}
229 %attr(771,nagios,http) %{_var}/log/%{name}
230 %attr(775,nagios,nagios) %dir %{_localstatedir}
231 %attr(775,nagios,nagios) %dir %{_localstatedir}/archives
232 %attr(2775,nagios,http) %dir %{_localstatedir}/rw
233
234 %files cgi
235 %defattr(644,root,root,755)
236 %attr(640,root,http) %config(noreplace) %verify(not size mtime md5) /etc/httpd/%{name}.conf
237 %attr(644,root,http) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/cgi.cfg-sample
238 %dir %{_libdir}/%{name}/cgi
239 %attr(755,root,root) %{_libdir}/%{name}/cgi/*.cgi
240 %{_datadir}
241
242 %files devel
243 %defattr(644,root,root,755)
244 %dir %{_includedir}/%{name}
245 %{_includedir}/%{name}/*.h
This page took 0.049014 seconds and 3 git commands to generate.