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