/[packages]/updates/1/nagios/current/SPECS/nagios.spec
ViewVC logotype

Contents of /updates/1/nagios/current/SPECS/nagios.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 394725 - (show annotations) (download)
Tue Feb 5 19:54:43 2013 UTC (7 years, 6 months ago) by luigiwalser
File size: 17472 byte(s)
add patch from debian to fix CVE-2012-6096
1 %define nsusr nagios
2 %define nsgrp nagios
3 %define cmdusr apache
4 %define cmdgrp apache
5
6 Summary: Host/service/network monitoring program
7 Name: nagios
8 Version: 3.2.3
9 Release: %mkrel 2.2
10 License: GPLv2
11 Group: Networking/Other
12 URL: http://www.nagios.org/
13 Source0: http://prdownloads.sourceforge.net/nagios/%{name}-%{version}.tar.gz
14 Source1: %{name}.init
15 Source4: http://nagios.sourceforge.net/download/contrib/misc/mergecfg/mergecfg
16 Source5: favicon.ico
17 Patch1: nagios-scandir.diff
18 Patch5: nagios-mdv_conf.diff
19 Patch6: nagios-DESTDIR.diff
20 Patch8: nagios-3.1.0-no_update_check_per_default_please.diff
21 Patch10: nagios-3.2.3-CERTA-2011-AVI-414.patch
22 Patch11: nagios-3.2.3-CVE-2012-6096.patch
23 Requires(post): rpm-helper nagios-conf
24 Requires(preun): rpm-helper nagios-conf
25 Requires(pre): rpm-helper apache-conf
26 Requires(postun): rpm-helper apache-conf
27 Requires: apache-conf
28 Requires: nagios-conf
29 Requires: nagios-plugins
30 BuildRequires: gd-devel
31 BuildRequires: imagemagick
32 BuildRequires: jpeg-devel
33 BuildRequires: libtool-devel
34 BuildRequires: multiarch-utils >= 1.0.3
35 BuildRequires: perl-devel
36 Obsoletes: netsaint
37 Provides: netsaint
38 Epoch: 1
39
40 %description
41 Nagios is a program that will monitor hosts and services on your
42 network. It has the ability to email or page you when a problem
43 arises and when a problem is resolved. Nagios is written in C and
44 is designed to run under Linux (and some other *NIX variants) as a
45 background process, intermittently running checks on various
46 services that you specify.
47
48 The actual service checks are performed by separate "plugin"
49 programs which return the status of the checks to Nagios.
50
51 This package provide core programs for nagios. The web interface,
52 documentation, and development files are built as separate
53 packages
54
55 %package www
56 Summary: Provides the HTML and CGI files for the Nagios web interface
57 Group: Networking/WWW
58 Requires: %{name} = %{epoch}:%{version}-%{release}
59 Requires: webserver
60 Requires: freetype
61 Requires: freetype2
62 Requires: nail
63 Requires: traceroute
64 Requires: %{name}-imagepaks
65 Requires: %{name}-theme
66 Epoch: %{epoch}
67
68 %description www
69 Nagios is a program that will monitor hosts and services on your network. It
70 has the ability to email or page you when a problem arises and when a problem
71 is resolved. Nagios is written in C and is designed to run under Linux (and
72 some other *NIX variants) as a background process, intermittently running
73 checks on various services that you specify.
74
75 Several CGI programs are included with Nagios in order to allow you to view the
76 current service status, problem history, notification history, and log file via
77 the web. This package provides the HTML and CGI files for the Nagios web
78 interface. In addition, HTML documentation is included in this package
79
80 %package theme-default
81 Summary: Default Nagios theme
82 Group: Networking/WWW
83 Requires(pre): rpm-helper apache-mod_php
84 Requires(postun): rpm-helper apache-mod_php
85 Requires: apache-mod_php
86 Requires: nagios-www = %{epoch}:%{version}-%{release}
87 Provides: nagios-theme
88 Conflicts: nagios-theme-nuvola
89
90 %description theme-default
91 Original theme from Nagios.
92
93 %package devel
94 Group: Development/C
95 Summary: Provides include files that Nagios-related applications may compile against
96 Epoch: %{epoch}
97
98 %description devel
99 Nagios is a program that will monitor hosts and services on your network. It
100 has the ability to email or page you when a problem arises and when a problem
101 is resolved. Nagios is written in C and is designed to run under Linux (and
102 some other *NIX variants) as a background process, intermittently running
103 checks on various services that you specify.
104
105 This package provides include files that Nagios-related applications may
106 compile against.
107
108 %prep
109 %setup -q
110 %patch1 -p0
111 %patch5 -p0
112 %patch6 -p0
113 %patch8 -p1
114 %patch10 -p1
115 %patch11 -p1
116
117 cp %{SOURCE1} nagios.init
118 cp %{SOURCE4} mergecfg
119 cp %{SOURCE5} favicon.ico
120
121 %build
122 %serverbuild
123
124 export CFLAGS="$CFLAGS -fPIC"
125 export CXXFLAGS="$CXXFLAGS -fPIC"
126 export FFLAGS="$FFLAGS -fPIC"
127 %define _disable_ld_no_undefined 1
128 %configure2_5x \
129 --with-httpd-conf=%{_sysconfdir}/httpd/conf/webapps.d \
130 --with-checkresult-dir=/var/spool/nagios/checkresults \
131 --with-temp-dir=/tmp \
132 --with-init-dir=%{_initrddir} \
133 --exec-prefix=%{_sbindir} \
134 --bindir=%{_sbindir} \
135 --sbindir=%{_libdir}/nagios/cgi \
136 --libexecdir=%{_libdir}/nagios/plugins \
137 --datadir=%{_datadir}/nagios \
138 --sysconfdir=%{_sysconfdir}/nagios \
139 --localstatedir=/var/log/nagios \
140 --with-lockfile=/var/run/nagios/nagios.pid \
141 --with-mail=/bin/mail \
142 --with-nagios-user=%{nsusr} \
143 --with-nagios-group=%{nsgrp} \
144 --with-command-user=%{cmdusr} \
145 --with-command-grp=%{cmdgrp} \
146 --with-cgiurl=/nagios/cgi-bin \
147 --with-htmurl=/nagios \
148 --with-default-comments \
149 --with-default-downtime \
150 --with-default-extinfo \
151 --with-default-retention \
152 --with-default-status \
153 --with-default-objects \
154 --with-default-perfdata \
155 --with-file-perfdata \
156 --with-template-extinfo \
157 --with-template-objects \
158 --with-gd-lib=%{_libdir} \
159 --with-gd-inc=%{_includedir} \
160 --enable-embedded-perl \
161 --with-perlcache
162
163 # bug
164 perl -pi -e "s|/var/log/nagios/spool/checkresults|/var/spool/nagios/checkresults|g" include/locations.h
165
166 %make all
167
168 pushd contrib
169 make daemonchk.cgi
170 make traceroute.cgi
171 make mini_epn
172 make convertcfg
173 popd
174
175 %install
176 rm -rf %{buildroot}
177
178 install -d -m0755 %{buildroot}%{_sysconfdir}/httpd/conf/webapps.d
179 install -d -m0755 %{buildroot}/var/spool/nagios/checkresults
180 install -d -m0755 %{buildroot}/var/run/nagios
181 install -d -m0755 %{buildroot}%{_includedir}/nagios
182 install -d -m0755 %{buildroot}%{_initrddir}
183
184 install -d -m0755 %{buildroot}%{_sysconfdir}/nagios/{servers,printers,switches,routers,conf.d,plugins.d}
185 install -d -m0755 %{buildroot}%{_libdir}/nagios/plugins/eventhandlers
186
187 make \
188 DESTDIR=%{buildroot} \
189 BINDIR=%{_sbindir} \
190 CFGDIR=%{_sysconfdir}/nagios \
191 CGIDIR=%{_libdir}/nagios/cgi \
192 COMMAND_OPTS="" \
193 HTMLDIR=%{_datadir}/nagios/www \
194 INIT_OPTS="" \
195 INSTALL=install \
196 INSTALL_OPTS="" \
197 LOGDIR=/var/log/nagios \
198 STRIP=/bin/true \
199 install \
200 install-html \
201 install-commandmode \
202 install-config \
203 fullinstall
204
205 # fix docs
206 cp sample-config/README README.sample-config
207 cp sample-config/template-object/README README.template-object
208
209 # install headers
210 install -m0644 include/locations.h %{buildroot}%{_includedir}/nagios/
211
212 pushd contrib
213 make \
214 DESTDIR=%{buildroot} \
215 BINDIR=%{_sbindir} \
216 CFGDIR=%{_sysconfdir}/nagios \
217 CGIDIR=%{_libdir}/nagios/cgi \
218 COMMAND_OPTS="" \
219 HTMLDIR=%{_datadir}/nagios/www \
220 INIT_OPTS="" \
221 INSTALL=install \
222 INSTALL_OPTS="" \
223 LOGDIR=/var/log/nagios \
224 install
225 popd
226
227 # fix strange perms
228 find %{buildroot}%{_datadir}/nagios -type d | xargs chmod 755
229 find %{buildroot}%{_datadir}/nagios/www -type f | xargs chmod 644
230 chmod 755 \
231 %{buildroot}%{_libdir}/nagios/cgi/* \
232 %{buildroot}%{_sbindir}/*
233
234 # fix default config
235 perl -pi \
236 -e "s|=/var/log/nagios/rw/|=/var/spool/nagios/|g" \
237 %{buildroot}%{_sysconfdir}/nagios/*.cfg
238 perl -pi \
239 -e "s|^physical_html_path=.*|physical_html_path=%{_datadir}/nagios/www|g" \
240 %{buildroot}%{_sysconfdir}/nagios/cgi.cfg
241
242
243 # install simplified init script
244 install -m0755 nagios.init %{buildroot}%{_initrddir}/nagios
245
246 # install the mergecfg script
247 install -m0755 mergecfg %{buildroot}%{_sbindir}/nagios-mergecfg
248
249 # apache configuration
250 install -d -m 755 %{buildroot}%{_webappconfdir}
251 cat > %{buildroot}%{_webappconfdir}/%{name}.conf <<EOF
252 # Nagios Apache configuration
253
254 ScriptAlias /%{name}/cgi-bin %{_libdir}/%{name}/cgi
255
256 <Directory %{_libdir}/%{name}/cgi>
257 Order allow,deny
258 Allow from all
259 Options ExecCGI
260 </Directory>
261
262 Alias /%{name} %{_datadir}/%{name}/www
263
264 <Directory %{_datadir}/%{name}/www>
265 Order allow,deny
266 Allow from all
267 </Directory>
268 EOF
269
270 # install and fix event handlers
271 install -m0755 contrib/eventhandlers/disable_active_service_checks %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
272 install -m0755 contrib/eventhandlers/disable_notifications %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
273 install -m0755 contrib/eventhandlers/enable_active_service_checks %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
274 install -m0755 contrib/eventhandlers/enable_notifications %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
275 install -m0755 contrib/eventhandlers/submit_check_result %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
276 install -m0755 contrib/eventhandlers/distributed-monitoring/obsessive_svc_handler %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
277 install -m0755 contrib/eventhandlers/distributed-monitoring/submit_check_result_via_nsca %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
278 install -m0755 contrib/eventhandlers/redundancy-scenario1/handle-master-host-event %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
279 install -m0755 contrib/eventhandlers/redundancy-scenario1/handle-master-proc-event %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
280
281 find %{buildroot}%{_libdir}/nagios/plugins/eventhandlers -type f | \
282 xargs perl -pi \
283 -e 's|/usr/local/nagios/var/rw/|/var/spool/nagios/|;' \
284 -e 's|/usr/local/nagios/libexec/eventhandlers|%{_libdir}/nagios/plugins/eventhandlers|g;' \
285 -e 's|/usr/local/nagios/libexec/send_nsca|%{_libdir}/nagios/plugins/send_nsca|g;' \
286 -e 's|/usr/local/nagios/test/var|/var/log/nagios|g;' \
287 -e 's|/usr/local/nagios/etc/send_nsca.cfg|%{_sysconfdir}/nagios/send_nsca.cfg|g;' \
288 -e 's|printfcmd="/bin/printf"|printfcmd="/usr/bin/printf"|;'
289
290 # Mandriva Icons
291 install -d %{buildroot}%{_iconsdir}
292 install -d %{buildroot}%{_miconsdir}
293 install -d %{buildroot}%{_liconsdir}
294
295 convert html/images/logofullsize.png -resize 16x16 %{buildroot}%{_miconsdir}/%{name}.png
296 convert html/images/logofullsize.png -resize 32x32 %{buildroot}%{_iconsdir}/%{name}.png
297 convert html/images/logofullsize.png -resize 48x48 %{buildroot}%{_liconsdir}/%{name}.png
298
299 # XDG menu
300 install -d %{buildroot}%{_datadir}/applications
301 cat > %{buildroot}%{_datadir}/applications/mageia-%{name}.desktop << EOF
302 [Desktop Entry]
303 Name=Nagios
304 Comment=%{summary}
305 Exec=%{_bindir}/www-browser http://localhost/%{name}/
306 Icon=%{name}
307 Terminal=false
308 Type=Application
309 Categories=X-MandrivaLinux-System-Monitoring;System;Monitor;
310 EOF
311
312 %multiarch_includes %{buildroot}%{_includedir}/nagios/locations.h
313
314 # install the favicon.ico
315 install -m0644 favicon.ico %{buildroot}%{_datadir}/nagios/www
316
317 cat > README.mdv << EOF
318 Mandriva Nagios package
319
320 The default configuration that used to come with this package now lives in the
321 nagios-conf package. You can easily adapt the nagios-conf package to suit your
322 specific taste. You may want to adjust the cgi.cfg, nagios.cfg and resource.cfg
323 configuration files found in the /etc/nagios directory.
324
325 The old nagios-plugins package used to come with all plugins in one single
326 package has been broken out into multiple sub packages. As of today Jan 14 2008
327 there are over 100 nagios plugins to your disposal. Here is a list of plugins
328 you can install that stems from the nagios-plugins source:
329
330 o nagios-check_adptraid
331 o nagios-check_apache
332 o nagios-check_apc_ups
333 o nagios-check_appletalk
334 o nagios-check_apt
335 o nagios-check_arping
336 o nagios-check_asterisk
337 o nagios-check_axis
338 o nagios-check_backup
339 o nagios-check_bgp
340 o nagios-check_bgpstate
341 o nagios-check_breeze
342 o nagios-check_by_ssh
343 o nagios-check_ciscotemp
344 o nagios-check_cluster
345 o nagios-check_cluster2
346 o nagios-check_compaq_insight
347 o nagios-check_dhcp
348 o nagios-check_dig
349 o nagios-check_digitemp
350 o nagios-check_disk
351 o nagios-check_disk_smb
352 o nagios-check_dlswcircuit
353 o nagios-check_dns
354 o nagios-check_dns_random
355 o nagios-check_dummy
356 o nagios-check_email_loop
357 o nagios-check_file_age
358 o nagios-check_flexlm
359 o nagios-check_fping
360 o nagios-check_frontpage
361 o nagios-check_game
362 o nagios-check_hpjd
363 o nagios-check_hprsc
364 o nagios-check_http
365 o nagios-check_hw
366 o nagios-check_ica_master_browser
367 o nagios-check_ica_metaframe_pub_apps
368 o nagios-check_ica_program_neigbourhood
369 o nagios-check_icmp
370 o nagios-check_ide_smart
371 o nagios-check_ifoperstatus
372 o nagios-check_ifstatus
373 o nagios-check_inodes
374 o nagios-check_ipxping
375 o nagios-check_ircd
376 o nagios-check_javaproc
377 o nagios-check_ldap
378 o nagios-check_linux_raid
379 o nagios-check_load
380 o nagios-check_log
381 o nagios-check_log2
382 o nagios-check_lotus
383 o nagios-check_mailq
384 o nagios-check_maxchannels
385 o nagios-check_maxwanstate
386 o nagios-check_mem
387 o nagios-check_mrtg
388 o nagios-check_mrtgext
389 o nagios-check_mrtgtraf
390 o nagios-check_ms_spooler
391 o nagios-check_mssql
392 o nagios-check_mysql
393 o nagios-check_mysql_perf <- added from third part
394 o nagios-check_mysql_query
395 o nagios-check_nagios
396 o nagios-check_netapp
397 o nagios-check_nmap
398 o nagios-check_nt
399 o nagios-check_ntp
400 o nagios-check_ntp_peer
401 o nagios-check_ntp_time
402 o nagios-check_nwstat
403 o nagios-check_oracle
404 o nagios-check_overcr
405 o nagios-check_pcpmetric
406 o nagios-check_pfstate
407 o nagios-check_pgsql
408 o nagios-check_ping
409 o nagios-check_procs
410 o nagios-check_qmailq
411 o nagios-check_radius
412 o nagios-check_rbl
413 o nagios-check_real
414 o nagios-check_remote_nagios_status
415 o nagios-check_rpc
416 o nagios-check_sendim
417 o nagios-check_sensors
418 o nagios-check_smart
419 o nagios-check_smb
420 o nagios-check_smtp
421 o nagios-check_snmp
422 o nagios-check_snmp_disk_monitor
423 o nagios-check_snmp_printer
424 o nagios-check_snmp_process_monitor
425 o nagios-check_snmp_procs
426 o nagios-check_sockets
427 o nagios-check_ssh
428 o nagios-check_swap
429 o nagios-check_tcp
430 o nagios-check_time
431 o nagios-check_timeout
432 o nagios-check_traceroute
433 o nagios-check_ups
434 o nagios-check_uptime
435 o nagios-check_users
436 o nagios-check_wave
437 o nagios-check_wins
438
439 This break-out has been done to reduce the overall dependencies requirements,
440 so if you don't need any of the check_mysql_* plugins you won't have to install
441 the mysql libraries, and so on.
442
443 Each of these packages comes with its own configuration file that contains the
444 needed command definition(s), let's give an example:
445
446 $ cat /etc/nagios/plugins.d/check_arping.cfg
447 # this plugin require suid bit. chmod 4550 /usr/lib64/nagios/plugins/contrib/check_arping.pl
448
449 # 'check_arping' command definition
450 define command{
451 command_name check_arping
452 command_line /usr/lib64/nagios/plugins/contrib/check_arping.pl -I $ARG1$ -H $HOSTADDRESS$
453 }
454
455
456 So when you start the nagios daemon it will automatically load configuration
457 files found in the /etc/nagios/plugins.d and /etc/nagios/conf.d directories.
458
459 EOF
460
461 # automatic reloading for new plugins
462 install -d %buildroot%{_var}/lib/rpm/filetriggers
463 cat > %buildroot%{_var}/lib/rpm/filetriggers/nagios.filter << EOF
464 ^.%{_sysconfdir}/nagios/plugins.d/.*\.cfg$
465 EOF
466 cat > %buildroot%{_var}/lib/rpm/filetriggers/nagios.script << EOF
467 #!/bin/sh
468 /etc/init.d/nagios condrestart
469 EOF
470 chmod 755 %buildroot%{_var}/lib/rpm/filetriggers/nagios.script
471
472 %pre
473 %{_sbindir}/useradd -r -M -s /bin/sh -d /var/log/nagios -c "system user for %{nsusr}" %{nsusr} >/dev/null 2>&1 || :
474 %{_bindir}/gpasswd -a %{cmdusr} %{nsgrp} >/dev/null 2>&1 || :
475
476 %post
477 if [ $1 = 1 ] ; then
478 chown -R %{nsusr}:%{nsgrp} /var/log/nagios /var/spool/nagios /var/run/nagios >/dev/null 2>&1 || :
479 fi
480 %_post_service %{name}
481
482 %preun
483 %_preun_service %{name}
484
485 %postun
486 if [ "$1" -ge "1" ]; then
487 %{_initrddir}/%{name} condrestart >/dev/null 2>&1 || :
488 fi
489 %_postun_userdel %{nsusr}
490
491 %pretrans www
492 # fix for old apache configuration
493 if [ -f %{_sysconfdir}/httpd/conf/webapps.d/12_nagios.conf ]; then
494 mv %{_sysconfdir}/httpd/conf/webapps.d/12_nagios.conf \
495 %{_sysconfdir}/httpd/conf/webapps.d/nagios.conf
496 perl -pi -e 's|%{_datadir}/%{name}|%{_datadir}/%{name}/www|' \
497 %{_sysconfdir}/httpd/conf/webapps.d/nagios.conf
498 fi
499
500 %clean
501 rm -rf %{buildroot}
502
503 %files
504 %doc Changelog INSTALLING LEGAL README UPGRADING README.mdv
505 %doc sample-config/mrtg.cfg
506 %{_initrddir}/nagios
507 %{_sbindir}/*
508 %dir %{_sysconfdir}/nagios
509 %config(noreplace) %{_sysconfdir}/nagios/*.cfg
510 %dir %{_sysconfdir}/nagios/servers
511 %dir %{_sysconfdir}/nagios/printers
512 %dir %{_sysconfdir}/nagios/switches
513 %dir %{_sysconfdir}/nagios/routers
514 %dir %{_sysconfdir}/nagios/conf.d
515 %dir %{_sysconfdir}/nagios/plugins.d
516 %dir %{_sysconfdir}/nagios/objects
517 %config(noreplace) %{_sysconfdir}/nagios/objects/*.cfg
518 %attr(-,%{nsusr},%{nsgrp}) %dir /var/log/nagios
519 %attr(-,%{nsusr},%{nsgrp}) %dir /var/log/nagios/archives
520 %attr(2775,%{nsusr},%{cmdgrp}) %dir /var/spool/nagios
521 %attr(-,%{nsusr},%{nsgrp}) %dir /var/spool/nagios/checkresults
522 %attr(-,%{nsusr},%{nsgrp}) %dir /var/run/nagios
523 %dir %{_libdir}/nagios/plugins/eventhandlers
524 %{_libdir}/nagios/plugins/eventhandlers/*
525 %{_var}/lib/rpm/filetriggers/nagios.*
526
527 %files www
528 %config(noreplace) %{_sysconfdir}/httpd/conf/webapps.d/nagios.conf
529 %{_libdir}/nagios/cgi
530 %dir %{_datadir}/nagios/www
531 %dir %{_datadir}/nagios/www/images
532 %dir %{_datadir}/nagios/www/stylesheets
533 %{_datadir}/nagios/www/favicon.ico
534 %{_datadir}/nagios/www/robots.txt
535 %{_datadir}/nagios/www/contexthelp
536 %{_datadir}/nagios/www/docs
537 %{_datadir}/nagios/www/media
538 %{_datadir}/nagios/www/ssi
539 %{_iconsdir}/%{name}.png
540 %{_miconsdir}/%{name}.png
541 %{_liconsdir}/%{name}.png
542 %{_datadir}/applications/*.desktop
543
544 %files theme-default
545 %{_datadir}/nagios/www/*.php
546 %{_datadir}/nagios/www/images/*
547 %{_datadir}/nagios/www/includes/*
548 %{_datadir}/nagios/www/stylesheets/*
549
550 %files devel
551 %multiarch %{multiarch_includedir}/nagios/locations.h
552 %{_includedir}/nagios

  ViewVC Help
Powered by ViewVC 1.1.28