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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.30