]>
Commit | Line | Data |
---|---|---|
03d5d122 ER |
1 | # TODO |
2 | # - /var/log/nagios/archives -> /var/log/archive/nagios | |
c90d41c3 | 3 | # - bundled jquery in themes |
c2fe0fab | 4 | # |
b21411a3 | 5 | # Conditional build: |
e1f9e4d5 | 6 | %bcond_without gd # without statusmap and trends, which require gd library |
acd5f253 | 7 | %bcond_without doc # don't build html docs |
8c8f3904 AM |
8 | # reeenable when http://tracker.nagios.org/view.php?id=51 is fixed |
9 | %bcond_with tests | |
03d5d122 | 10 | |
86568aa8 | 11 | Summary: Open Source host, service and network monitoring program |
a02dfee5 ER |
12 | Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci |
13 | Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços | |
1b3d1540 | 14 | Name: nagios |
fa363e1f | 15 | Version: 4.0.8 |
8a2dc600 | 16 | Release: 2 |
ab40d60f | 17 | License: GPL v2+ |
1b3d1540 | 18 | Group: Networking |
e277f689 | 19 | Source0: http://downloads.sourceforge.net/nagios/nagios-4.x/%{name}-%{version}/%{name}-%{version}.tar.gz |
fa363e1f | 20 | # Source0-md5: 4bba4eef427cfb113fb513b6166a6af6 |
1b3d1540 TO |
21 | Source1: %{name}-apache.conf |
22 | Source2: %{name}.init | |
156a07c5 | 23 | Source3: %{name}.sysconfig |
ee487720 | 24 | # http://git.pld-linux.org/cgi-bin/cgit.cgi/projects/nagios-config.git/ |
9c387eb0 ER |
25 | Source4: %{name}-config-20090914.tar.bz2 |
26 | # Source4-md5: 605f1cd28c00db961dad6f529d849f16 | |
27 | Source5: %{name}-lighttpd.conf | |
455492e8 ER |
28 | Source6: http://www.google.com/mapfiles/shadow50.png |
29 | # Source6-md5: eff99f302f21b95a900d321743fce72b | |
30 | Source7: http://www.google.com/mapfiles/marker.png | |
31 | # Source7-md5: edefef4bdfc29e1c953694651f05b466 | |
32 | Source8: googlemap.js | |
d12528d9 | 33 | Source9: %{name}wall.php |
b24b4667 ER |
34 | Patch0: %{name}-resources.patch |
35 | Patch1: %{name}-iconv-in-libc.patch | |
19670bc2 | 36 | Patch2: %{name}-webapps.patch |
f29ace4f | 37 | Patch3: %{name}-cgi-http_charset.patch |
d39e610a | 38 | Patch4: %{name}-cmd-typo.patch |
4af19791 | 39 | Patch5: config.patch |
3392dafc | 40 | Patch6: %{name}-googlemap.patch |
27a9d69f ER |
41 | Patch7: %{name}-doc-usermacros.patch |
42 | Patch8: archivelog-timeformat.patch | |
e9dab65f | 43 | Patch9: system-magpierss.patch |
bf8055c4 | 44 | Patch10: system-jquery.patch |
252c8c1b | 45 | Patch11: do-not-fetch-rss.patch |
1b3d1540 | 46 | URL: http://www.nagios.org/ |
14ddd08f JB |
47 | BuildRequires: autoconf |
48 | BuildRequires: automake | |
acd5f253 | 49 | %{?with_doc:BuildRequires: doxygen} |
2f5235a6 ER |
50 | BuildRequires: rpmbuild(macros) >= 1.268 |
51 | BuildRequires: sed >= 4.0 | |
86522331 AG |
52 | %if %{with gd} |
53 | BuildRequires: gd-devel | |
54 | BuildRequires: libjpeg-devel | |
55 | BuildRequires: libpng-devel | |
56 | %endif | |
2f5235a6 ER |
57 | %if %{with tests} |
58 | BuildRequires: perl-HTML-Lint | |
59 | BuildRequires: perl-Test-WWW-Mechanize-CGI | |
60 | %endif | |
8a91cf36 | 61 | Requires(post,preun): /sbin/chkconfig |
bc56720c | 62 | Requires: %{name}-common = %{version}-%{release} |
d12528d9 | 63 | Requires: rc-scripts >= 0.4.5.5 |
d4363d96 | 64 | Requires: sh-utils |
f77e54ce | 65 | Suggests: nagios-notify >= 0.13 |
3392dafc ER |
66 | Suggests: nagios-plugin-check_load |
67 | Suggests: nagios-plugin-check_ping | |
68 | Suggests: nagios-plugins | |
f0724323 | 69 | Provides: nagios-core |
1b3d1540 | 70 | Obsoletes: netsaint |
d4363d96 | 71 | Conflicts: iputils-ping < 1:ss020124 |
56d92939 | 72 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
1b3d1540 | 73 | |
e1f9e4d5 | 74 | %define _sysconfdir /etc/%{name} |
708a261e ER |
75 | %define cgidir %{_libdir}/%{name}/cgi |
76 | %define htmldir %{_prefix}/share/%{name} | |
e1f9e4d5 | 77 | %define _localstatedir /var/lib/%{name} |
31f3ed2f ER |
78 | %define _webapps /etc/webapps |
79 | %define _webapp %{name} | |
a9824b3a | 80 | |
1b3d1540 TO |
81 | %description |
82 | Nagios is a program that will monitor hosts and services on your | |
83 | network. It has the ability to email or page you when a problem arises | |
0cf1a114 TO |
84 | and when a problem is resolved. Nagios is written in C and is designed |
85 | to run under Linux (and some other *NIX variants) as a background | |
86 | process, intermittently running checks on various services that you | |
87 | specify. | |
1b3d1540 TO |
88 | |
89 | The actual service checks are performed by separate "plugin" programs | |
90 | which return the status of the checks to Nagios. The plugins are | |
91 | available in nagios-plugins packages. | |
92 | ||
924840b9 TO |
93 | Nagios is successor to NetSaint. |
94 | ||
eb034f05 JR |
95 | %description -l pl.UTF-8 |
96 | Nagios to program, który monitoruje serwery oraz usługi w naszej | |
97 | sieci. Posiada on możliwość wysyłania informacji o wystąpieniu oraz | |
98 | rozwiązaniu problemu. Nagios został napisany w C oraz jest | |
99 | zaprojektowany do pracy pod Linuksem (i niektórymi innymi uniksami) | |
100 | jako proces pracujący w tle i bezustannie wykonujący pewne operacje | |
101 | sprawdzające. | |
1b3d1540 | 102 | |
eb034f05 JR |
103 | Właściwe sprawdzanie jest wykonywane przez osobne programy |
104 | ("wtyczki"), które zwracają informacje o statusie do Nagiosa. Wtyczki | |
105 | są dostępne na stronie w pakietach nagios-plugins. | |
1b3d1540 | 106 | |
eb034f05 | 107 | Nagios jest następcą NetSainta. |
924840b9 | 108 | |
eb034f05 JR |
109 | %description -l pt_BR.UTF-8 |
110 | O Nagios é um programa que monitora máquinas e serviços na sua rede. | |
1b3d1540 | 111 | Ele pode enviar um email ou um aviso de pager para o administrador |
eb034f05 | 112 | quando surgir um problema e quando ele for resolvido. Nagios é escrito |
0cf1a114 | 113 | em C e foi desenvolvido para rodar em plataformas Linux (e algumas |
eb034f05 JR |
114 | variações de *NIX) como um processo em segundo plano, periodicamente |
115 | executando checagens nos diversos serviços que forem especificados. | |
1b3d1540 | 116 | |
901d97df ER |
117 | %package common |
118 | Summary: Common files needed by both nagios and nrpe | |
a02dfee5 | 119 | Summary(pl.UTF-8): Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe |
901d97df | 120 | Group: Networking |
d4363d96 ER |
121 | Requires(postun): /usr/sbin/groupdel |
122 | Requires(postun): /usr/sbin/userdel | |
901d97df | 123 | Requires(pre): /bin/id |
d4363d96 | 124 | Requires(pre): /usr/bin/getgid |
901d97df ER |
125 | Requires(pre): /usr/sbin/groupadd |
126 | Requires(pre): /usr/sbin/groupmod | |
127 | Requires(pre): /usr/sbin/useradd | |
128 | Requires(pre): /usr/sbin/usermod | |
7970ec44 | 129 | Provides: group(nagcmd) |
f77e54ce | 130 | Provides: group(nagios) |
d4363d96 | 131 | Provides: user(nagios) |
901d97df ER |
132 | |
133 | %description common | |
134 | Common files needed by both nagios and nrpe. | |
135 | ||
eb034f05 JR |
136 | %description common -l pl.UTF-8 |
137 | Wspólne pliki wymagane zarówno przez nagiosa jak i nrpe. | |
bee7c8ea | 138 | |
1b3d1540 TO |
139 | %package cgi |
140 | Summary: CGI webinterface for Nagios | |
a02dfee5 | 141 | Summary(pl.UTF-8): Interfejs WWW/CGI dla Nagiosa |
7c33b67a | 142 | Group: Applications/WWW |
bf60adae | 143 | # for dirs... and accessing local logs, nagios config |
4a3af0fb | 144 | Requires: %{name} = %{version}-%{release} |
1bbdd399 | 145 | Requires: %{name}-imagepaks |
20145354 | 146 | Requires: %{name}-theme |
156a07c5 | 147 | Requires: group(http) |
bf8055c4 | 148 | Requires: jquery |
d4363d96 | 149 | Requires: webapps |
e785f9d9 | 150 | Requires: webserver |
111ce231 | 151 | Requires: webserver(access) |
e785f9d9 ER |
152 | Requires: webserver(alias) |
153 | Requires: webserver(auth) | |
154 | Requires: webserver(cgi) | |
155 | Requires: webserver(indexfile) | |
bf60adae | 156 | Suggests: %{name}-doc |
252c8c1b | 157 | Suggests: php-magpierss >= 0.72 |
1b3d1540 TO |
158 | |
159 | %description cgi | |
0964d76f JB |
160 | CGI webinterface for Nagios. |
161 | ||
eb034f05 | 162 | %description cgi -l pl.UTF-8 |
0964d76f | 163 | Interfejs CGI dla Nagiosa. |
1b3d1540 | 164 | |
4f43d0aa ER |
165 | %package mrtggraphs |
166 | Summary: MRTG Graphs: Nagios Statistics | |
167 | Group: Applications/Networking | |
168 | Requires: %{name} = %{version}-%{release} | |
169 | Provides: mrtg-start | |
c90d41c3 ER |
170 | %if "%{_rpmversion}" >= "5" |
171 | BuildArch: noarch | |
172 | %endif | |
4f43d0aa ER |
173 | |
174 | %description mrtggraphs | |
175 | This pacakge graphs several Nagios statistics which can be useful for | |
176 | debugging and trending purposes. The nagiostats binary is used to | |
177 | generate the data. | |
178 | ||
bf60adae ER |
179 | %package doc |
180 | Summary: HTML Documentation for Nagios | |
181 | Group: Documentation | |
acd5f253 ER |
182 | %if "%{_rpmversion}" >= "5" |
183 | BuildArch: noarch | |
184 | %endif | |
bf60adae ER |
185 | # does not require base |
186 | ||
187 | %description doc | |
188 | HTML Documentation for Nagios. | |
189 | ||
a10f2ff5 ER |
190 | %package theme-classicui |
191 | Summary: ClassicUI Nagios theme | |
7c33b67a | 192 | Group: Applications/WWW |
c80fbcb2 | 193 | Requires: %{name}-cgi = %{version}-%{release} |
fdea6415 | 194 | Requires: webserver(php) |
60238ce7 JB |
195 | Provides: nagios-theme |
196 | Obsoletes: nagios-theme | |
c90d41c3 ER |
197 | %if "%{_rpmversion}" >= "5" |
198 | BuildArch: noarch | |
199 | %endif | |
20145354 | 200 | |
a10f2ff5 | 201 | %description theme-classicui |
20145354 ER |
202 | Original theme from Nagios. |
203 | ||
a10f2ff5 | 204 | %description theme-classicui -l pl.UTF-8 |
60238ce7 JB |
205 | Oryginalny motyw z Nagiosa. |
206 | ||
a10f2ff5 ER |
207 | %package theme-default |
208 | Summary: Virtual package to handle Nagios theme migration | |
209 | Group: Applications/WWW | |
210 | Requires: nagios-theme | |
8da737aa ER |
211 | Suggests: nagios-theme-classicui |
212 | Suggests: nagios-theme-exfoliation | |
213 | Suggests: nagios-theme-nuvola | |
a10f2ff5 | 214 | Obsoletes: nagios-theme-default < 3.3.1-1.4 |
c90d41c3 ER |
215 | %if "%{_rpmversion}" >= "5" |
216 | BuildArch: noarch | |
217 | %endif | |
a10f2ff5 ER |
218 | |
219 | %description theme-default | |
220 | Virtual package to handle Nagios theme migration | |
221 | ||
1b3d1540 | 222 | %package devel |
e5fcc454 | 223 | Summary: Include files that Nagios-related applications may compile against |
a02dfee5 ER |
224 | Summary(pl.UTF-8): Pliki nagłówkowe, wykorzystywane przez aplikacje nagiosa |
225 | Summary(pt_BR.UTF-8): Arquivos de cabeçalho necessários para desenvolvimento de aplicativos para o Nagios | |
1b3d1540 | 226 | Group: Development/Libraries |
e1f9e4d5 | 227 | # doesn't require base |
1b3d1540 TO |
228 | |
229 | %description devel | |
442ef855 ER |
230 | This package contains the header files, static libraries and |
231 | development documentation for Nagios. If you are a NEB-module author | |
232 | or wish to write addons for Nagios using Nagios' own API's, you should | |
233 | install this package. | |
1b3d1540 | 234 | |
eb034f05 JR |
235 | %description devel -l pl.UTF-8 |
236 | Ten pakiet dostarcza pliki nagłówkowe, które mogą być wykorzystywane | |
237 | przez aplikacje związane z nagiosem podczas kompilacji. | |
1b3d1540 | 238 | |
eb034f05 JR |
239 | %description devel -l pt_BR.UTF-8 |
240 | Este pacote contém arquivos de cabeçalho usados no desenvolvimento de | |
1b3d1540 TO |
241 | aplicativos para o Nagios. |
242 | ||
243 | %prep | |
7f0097ee | 244 | %setup -qc -a4 |
f09aa22f | 245 | mv %{name}-%{version}/* . |
0d02e51c | 246 | %undos cgi/*.c |
247 | %undos include/*.h | |
248 | %undos base/* | |
b24b4667 ER |
249 | %patch0 -p0 |
250 | %patch1 -p1 | |
4a3af0fb | 251 | %patch2 -p1 |
f29ace4f | 252 | %patch3 -p1 |
5ddc91b8 | 253 | #fixed |
0d02e51c | 254 | #%patch4 -p1 |
744a134f | 255 | %patch5 -p1 |
455492e8 | 256 | %patch6 -p1 |
7116ea37 | 257 | %patch7 -p1 |
27a9d69f | 258 | %patch8 -p1 |
e9dab65f | 259 | %patch9 -p1 |
bf8055c4 | 260 | %patch10 -p1 |
252c8c1b | 261 | %patch11 -p1 |
156a07c5 | 262 | |
6e193622 | 263 | find -name .cvsignore -o -name .gitignore | xargs rm |
fdea6415 ER |
264 | |
265 | mv nagios-config-*/objects/*.cfg sample-config/template-object | |
266 | mv nagios-config-*/*.cfg sample-config | |
267 | ||
af765cf5 ER |
268 | # cleanup backups after patching |
269 | find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f | |
270 | ||
156a07c5 | 271 | sed -i -e ' |
c80fbcb2 | 272 | s,".*/var/rw/%{name}.cmd,"%{_localstatedir}/rw/%{name}.cmd, |
156a07c5 ER |
273 | s,".*/libexec/eventhandlers,"%{_libdir}/%{name}/eventhandlers, |
274 | ' $(find contrib/eventhandlers -type f) | |
1b3d1540 | 275 | |
078e0b6e | 276 | sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE1} > apache.conf |
9c387eb0 | 277 | sed -e 's,%{_prefix}/lib/,%{_libdir}/,' %{SOURCE5} > lighttpd.conf |
078e0b6e | 278 | |
744a134f ER |
279 | # fixup cgi config |
280 | %{__sed} -i -e ' | |
281 | # kill trailing spaces | |
282 | s, \+$,, | |
283 | # use real paths | |
c80fbcb2 | 284 | s,/usr/local/%{name}/share,@datadir@,g |
744a134f ER |
285 | # we want all authorized users have default access |
286 | s,=nagiosadmin,=*,g | |
4af19791 | 287 | ' sample-config/*.cfg.in |
744a134f | 288 | |
2f5235a6 ER |
289 | #rm t/611cgistatus-hosturgencies.t |
290 | ||
1b3d1540 | 291 | %build |
156a07c5 | 292 | cp -f /usr/share/automake/config.sub . |
a9824b3a TO |
293 | %{__aclocal} |
294 | %{__autoconf} | |
2f5235a6 ER |
295 | %if %{with tests} |
296 | cd tap | |
297 | %{__libtoolize} | |
298 | %{__aclocal} | |
299 | %{__autoconf} | |
300 | cd .. | |
301 | %endif | |
a9824b3a | 302 | %configure \ |
b654dd87 | 303 | CFLAGS="%{rpmcflags} %{rpmcppflags}" \ |
708a261e ER |
304 | --bindir=%{_sbindir} \ |
305 | --sbindir=%{cgidir} \ | |
306 | --datadir=%{htmldir} \ | |
1b3d1540 TO |
307 | --with-nagios-user=%{name} \ |
308 | --with-nagios-grp=%{name} \ | |
156a07c5 ER |
309 | --with-command-user=%{name} \ |
310 | --with-command-grp=%{name} \ | |
311 | --with-lockfile=%{_localstatedir}/%{name}.pid \ | |
e56088ed | 312 | --with-checkresult-dir=%{_var}/spool/%{name}/checkresults \ |
0964d76f | 313 | --with-ping_command='/bin/ping -n %%s -c %%d' \ |
8c8f3904 AM |
314 | %{!?with_gd:--disable-statusmap --disable-trends} \ |
315 | %{?with_tests:--enable-libtap} \ | |
316 | --enable-event-broker | |
1b3d1540 TO |
317 | |
318 | %{__make} all | |
319 | ||
acd5f253 ER |
320 | %{?with_doc:%{__make} dox} |
321 | ||
8c8f3904 AM |
322 | %{?with_tests:%{__make} test} |
323 | ||
1b3d1540 TO |
324 | %install |
325 | rm -rf $RPM_BUILD_ROOT | |
4a5ea7ae ER |
326 | install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_webapps}/%{_webapp}} \ |
327 | $RPM_BUILD_ROOT{%{_var}/log/%{name}/archives,%{_localstatedir}/rw} \ | |
fdea6415 | 328 | $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,objects} \ |
fcd029a6 | 329 | $RPM_BUILD_ROOT%{_libdir}/%{name}/{eventhandlers,plugins,brokers} \ |
4a5ea7ae ER |
330 | %if "%{_lib}" != "lib" |
331 | $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/{eventhandlers,plugins} \ | |
332 | %endif | |
1b3d1540 | 333 | |
442ef855 | 334 | %{__make} install-unstripped install-devel \ |
1b3d1540 TO |
335 | DESTDIR=$RPM_BUILD_ROOT \ |
336 | INSTALL_OPTS="" \ | |
337 | INIT_OPTS="" \ | |
338 | COMMAND_OPTS="" | |
339 | ||
6e193622 | 340 | install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
5ddc91b8 | 341 | cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name} |
156a07c5 ER |
342 | |
343 | # install templated configuration files | |
c80fbcb2 | 344 | for a in %{name}.cfg resource.cfg commands.cfg contactgroups.cfg contacts.cfg templates.cfg timeperiods.cfg; do |
5ddc91b8 | 345 | cp -p sample-config/$a $RPM_BUILD_ROOT%{_sysconfdir} |
fdea6415 | 346 | done |
c0350ebc | 347 | |
31f3ed2f | 348 | # webserver files |
5ddc91b8 | 349 | cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf |
218b60a4 | 350 | cp -p apache.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf |
5ddc91b8 ER |
351 | cp -p lighttpd.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf |
352 | cp -p sample-config/cgi.cfg $RPM_BUILD_ROOT%{_webapps}/%{_webapp} | |
353 | cp -p %{SOURCE6} $RPM_BUILD_ROOT%{htmldir}/images | |
354 | cp -p %{SOURCE7} $RPM_BUILD_ROOT%{htmldir}/images | |
355 | cp -p %{SOURCE8} $RPM_BUILD_ROOT%{htmldir}/images | |
4e60ae1d | 356 | cp -p %{SOURCE9} $RPM_BUILD_ROOT%{htmldir} |
31f3ed2f ER |
357 | > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/passwd |
358 | echo 'nagios:' > $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/group | |
156a07c5 | 359 | |
fdea6415 | 360 | # install event handlers, sample config |
4a5ea7ae | 361 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
156a07c5 | 362 | cp -a contrib/eventhandlers $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
fdea6415 ER |
363 | cp -a sample-config $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
364 | find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm | |
156a07c5 | 365 | |
4f43d0aa ER |
366 | # mrtg script |
367 | install -d $RPM_BUILD_ROOT/etc/mrtg/conf.d | |
86568aa8 | 368 | cp -p sample-config/mrtg.cfg $RPM_BUILD_ROOT/etc/mrtg/conf.d/%{name}.cfg |
4f43d0aa | 369 | |
156a07c5 | 370 | # Object data/cache files |
e6b8c4d6 | 371 | for i in {objects.{cache,precache},{retention,status}.dat,%{name}.{tmp,pid}}; do |
156a07c5 | 372 | > $RPM_BUILD_ROOT%{_localstatedir}/$i |
b0a1a45f | 373 | done |
c80fbcb2 | 374 | > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.cmd |
86568aa8 | 375 | > $RPM_BUILD_ROOT%{_localstatedir}/rw/%{name}.qh |
e58661fb | 376 | |
bf60adae | 377 | install -d $RPM_BUILD_ROOT%{_docdir}/%{name} |
acd5f253 | 378 | %{__cp} -a Documentation/html/* $RPM_BUILD_ROOT%{_docdir}/%{name} |
bf60adae | 379 | |
1b3d1540 TO |
380 | %clean |
381 | rm -rf $RPM_BUILD_ROOT | |
382 | ||
1b3d1540 | 383 | %post |
f9b2b5a9 | 384 | for i in %{_localstatedir}/{objects.{cache,precache},{retention,status}.dat}; do |
156a07c5 ER |
385 | [ ! -f $i ] && touch $i |
386 | chown root:nagios $i | |
387 | chmod 664 $i | |
388 | done | |
389 | ||
fe2307cb | 390 | /sbin/chkconfig --add %{name} |
09b7a682 | 391 | %service %{name} restart "Nagios service" |
fe2307cb | 392 | |
1b3d1540 TO |
393 | %preun |
394 | if [ "$1" = "0" ] ; then | |
fe2307cb | 395 | %service %{name} stop |
1b3d1540 TO |
396 | /sbin/chkconfig --del %{name} |
397 | fi | |
398 | ||
901d97df | 399 | %pre common |
7970ec44 | 400 | # rename group netsaint -> nagios |
3392dafc | 401 | if [ "$(getgid netsaint 2>/dev/null)" = "72" ]; then |
901d97df ER |
402 | /usr/sbin/groupmod -n nagios netsaint |
403 | fi | |
7970ec44 | 404 | # rename group nagios-data -> nagcmd |
3392dafc | 405 | if [ "$(getgid nagios-data 2>/dev/null)" = "147" ]; then |
7970ec44 ER |
406 | /usr/sbin/groupmod -n nagcmd nagios-data |
407 | fi | |
901d97df | 408 | %groupadd -g 72 nagios |
7970ec44 | 409 | %groupadd -g 147 -f nagcmd |
3392dafc | 410 | if [ -n "$(id -u netsaint 2>/dev/null)" ] && [ "$(id -u netsaint)" = "72" ]; then |
c80fbcb2 | 411 | /usr/sbin/usermod -d %{_libdir}/%{name} -l nagios -c "Nagios Daemon" -G nagcmd netsaint |
901d97df | 412 | fi |
c80fbcb2 | 413 | %useradd -u 72 -d %{_libdir}/%{name} -s /bin/false -c "Nagios Daemon" -g nagios -G nagcmd nagios |
901d97df ER |
414 | |
415 | %postun common | |
4b3055f2 | 416 | if [ "$1" = "0" ]; then |
56d92939 | 417 | %userremove nagios |
418 | %groupremove nagios | |
7970ec44 | 419 | %groupremove nagcmd |
4b3055f2 | 420 | fi |
421 | ||
7441a39b | 422 | %post cgi |
156a07c5 ER |
423 | if [ "$1" = 1 ]; then |
424 | %banner %{name} -e <<EOF | |
425 | NOTE: | |
31f3ed2f | 426 | You need to add user to %{_webapps}/%{_webapp}/passwd and |
fe2307cb | 427 | %{_webapps}/%{_webapp}/group to access Nagios via web. |
156a07c5 ER |
428 | |
429 | EOF | |
430 | fi | |
431 | ||
91b73a43 | 432 | %triggerin cgi -- apache1 < 1.3.37-3, apache1-base |
7970ec44 | 433 | %addusertogroup http nagcmd |
31f3ed2f | 434 | %webapp_register apache %{_webapp} |
26c807b6 | 435 | |
91b73a43 | 436 | %triggerun cgi -- apache1 < 1.3.37-3, apache1-base |
31f3ed2f | 437 | %webapp_unregister apache %{_webapp} |
26c807b6 | 438 | |
218b60a4 | 439 | %triggerin cgi -- apache < 2.2.0, apache-base |
7970ec44 | 440 | %addusertogroup http nagcmd |
31f3ed2f | 441 | %webapp_register httpd %{_webapp} |
26c807b6 | 442 | |
218b60a4 | 443 | %triggerun cgi -- apache < 2.2.0, apache-base |
31f3ed2f | 444 | %webapp_unregister httpd %{_webapp} |
156a07c5 | 445 | |
e785f9d9 | 446 | %triggerin cgi -- lighttpd |
7970ec44 | 447 | %addusertogroup lighttpd nagcmd |
e785f9d9 ER |
448 | %webapp_register lighttpd %{_webapp} |
449 | ||
450 | %triggerun cgi -- lighttpd | |
451 | %webapp_unregister lighttpd %{_webapp} | |
452 | ||
156a07c5 ER |
453 | %triggerpostun -- nagios-cgi < 2.0-0.b3.21 |
454 | chown root:http %{_sysconfdir}/cgi.cfg | |
455 | ||
e56088ed | 456 | %triggerpostun -- nagios < 3.1.2-4 |
fdea6415 | 457 | # restore lost files |
53326298 | 458 | for a in dependencies.cfg services.cfg serviceextinfo.cfg hosts.cfg hostgroups.cfg hostextinfo.cfg escalations.cfg checkcommands.cfg misccommands.cfg; do |
fdea6415 ER |
459 | if [ -f %{_sysconfdir}/$a.rpmsave -a ! -f %{_sysconfdir}/$a ]; then |
460 | mv -f %{_sysconfdir}/$a{.rpmsave,} | |
31f3ed2f ER |
461 | fi |
462 | done | |
c80fbcb2 | 463 | %{__sed} -i -e 's,^check_result_path=.*,check_result_path=%{_var}/spool/%{name}/checkresults,' %{_sysconfdir}/%{name}.cfg |
31f3ed2f | 464 | |
1b3d1540 TO |
465 | %files |
466 | %defattr(644,root,root,755) | |
156a07c5 | 467 | %doc Changelog README* UPGRADING INSTALLING LICENSE |
9ac20a2e | 468 | %attr(750,root,nagios) %dir %{_sysconfdir}/objects |
3392dafc ER |
469 | |
470 | # leave main nagios config readable for -cgi. | |
c80fbcb2 | 471 | %attr(640,root,nagcmd) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.cfg |
3392dafc ER |
472 | |
473 | %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commands.cfg | |
474 | %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contactgroups.cfg | |
475 | %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/contacts.cfg | |
476 | %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/resource.cfg | |
477 | %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates.cfg | |
478 | %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/timeperiods.cfg | |
156a07c5 | 479 | |
3f16fe73 | 480 | %attr(754,root,root) /etc/rc.d/init.d/%{name} |
156a07c5 ER |
481 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} |
482 | ||
708a261e ER |
483 | %attr(755,root,root) %{_sbindir}/%{name} |
484 | %attr(755,root,root) %{_sbindir}/nagiostats | |
fcd029a6 | 485 | %dir %{_libdir}/%{name}/brokers |
156a07c5 | 486 | |
7970ec44 ER |
487 | %attr(770,root,nagcmd) %dir %{_var}/log/%{name} |
488 | %attr(770,root,nagcmd) %dir %{_var}/log/%{name}/archives | |
156a07c5 | 489 | |
7970ec44 ER |
490 | %attr(770,root,nagcmd) %dir %{_localstatedir} |
491 | %attr(2770,root,nagcmd) %dir %{_localstatedir}/rw | |
c80fbcb2 | 492 | %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.cmd |
86568aa8 | 493 | %attr(660,nagios,nagcmd) %ghost %{_localstatedir}/rw/%{name}.qh |
3e125558 | 494 | %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache |
19cc8e59 | 495 | %attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache |
3e125558 ER |
496 | %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat |
497 | %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp | |
e6b8c4d6 | 498 | %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.pid |
156a07c5 | 499 | |
7e556525 | 500 | %attr(770,root,nagcmd) %dir %{_var}/spool/%{name}/checkresults |
3d336594 | 501 | |
156a07c5 ER |
502 | %{_examplesdir}/%{name}-%{version} |
503 | ||
901d97df ER |
504 | %files common |
505 | %defattr(644,root,root,755) | |
7970ec44 | 506 | %attr(750,root,nagcmd) %dir %{_sysconfdir} |
1e0c0567 | 507 | %attr(750,root,nagios) %dir %{_sysconfdir}/plugins |
901d97df ER |
508 | %dir %{_libdir}/%{name} |
509 | %dir %{_libdir}/%{name}/plugins | |
156a07c5 | 510 | %dir %{_libdir}/%{name}/eventhandlers |
1b3d1540 | 511 | |
4a5ea7ae ER |
512 | %if "%{_lib}" != "lib" |
513 | %dir %{_prefix}/lib/%{name} | |
514 | %dir %{_prefix}/lib/%{name}/plugins | |
515 | %dir %{_prefix}/lib/%{name}/eventhandlers | |
516 | %endif | |
517 | ||
7e556525 | 518 | %attr(770,root,nagcmd) %dir %{_var}/spool/%{name} |
2ea9f2fa | 519 | |
4f43d0aa ER |
520 | %files mrtggraphs |
521 | %defattr(644,root,root,755) | |
522 | %config(noreplace) %verify(not md5 mtime size) /etc/mrtg/conf.d/%{name}.cfg | |
523 | ||
bf60adae ER |
524 | %files doc |
525 | %defattr(644,root,root,755) | |
526 | %{_docdir}/%{name} | |
527 | ||
1b3d1540 TO |
528 | %files cgi |
529 | %defattr(644,root,root,755) | |
31f3ed2f ER |
530 | %dir %attr(750,root,http) %{_webapps}/%{_webapp} |
531 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf | |
532 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf | |
e785f9d9 | 533 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf |
31f3ed2f ER |
534 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/cgi.cfg |
535 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/passwd | |
536 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/group | |
708a261e ER |
537 | %dir %{cgidir} |
538 | %attr(755,root,root) %{cgidir}/*.cgi | |
539 | ||
540 | %dir %{htmldir} | |
541 | %dir %{htmldir}/includes | |
542 | %dir %{htmldir}/images | |
543 | %dir %{htmldir}/stylesheets | |
544 | %{htmldir}/robots.txt | |
545 | %{htmldir}/contexthelp | |
fa363e1f | 546 | %{htmldir}/jsonquery.html |
708a261e ER |
547 | %{htmldir}/media |
548 | %{htmldir}/ssi | |
549 | %{htmldir}/images/favicon.ico | |
550 | %{htmldir}/images/marker.png | |
551 | %{htmldir}/images/shadow50.png | |
4e60ae1d | 552 | %{htmldir}/nagioswall.php |
fa363e1f AM |
553 | %{htmldir}/rss-corefeed.html |
554 | %{htmldir}/rss-newsfeed.html | |
20145354 | 555 | |
a10f2ff5 | 556 | %files theme-classicui |
20145354 | 557 | %defattr(644,root,root,755) |
66a71233 | 558 | %exclude %{htmldir}/nagioswall.php |
708a261e ER |
559 | %{htmldir}/*.php |
560 | %{htmldir}/includes/* | |
561 | %{htmldir}/images/* | |
562 | %exclude %{htmldir}/images/favicon.ico | |
563 | %exclude %{htmldir}/images/marker.png | |
564 | %exclude %{htmldir}/images/shadow50.png | |
565 | %{htmldir}/stylesheets/* | |
1b3d1540 | 566 | |
a10f2ff5 ER |
567 | %files theme-default |
568 | %defattr(644,root,root,755) | |
569 | ||
1b3d1540 TO |
570 | %files devel |
571 | %defattr(644,root,root,755) | |
572 | %dir %{_includedir}/%{name} | |
573 | %{_includedir}/%{name}/*.h | |
442ef855 ER |
574 | %{_includedir}/%{name}/lib |
575 | %{_libdir}/libnagios.a |