Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 2063f17dc70f83835c2ca46431da83a4 > files > 11

nagios-2.0b3-1mdk.src.rpm

%define snap 20041024

%define nsusr nagios
%define nsgrp nagios
%define cmdusr apache
%define cmdgrp apache

Summary:	Host/service/network monitoring program
Name:		nagios
Version:	2.0b3
Release:	%mkrel 1
License:	GPL
Group:		Networking/Other
URL:		http://www.nagios.org/
Source0:	%{name}-%{version}.tar.bz2
Source1:	%{name}.init.bz2
Source2:	nagios-2.0-minimalistic_config.tar.bz2
Source3:	nagios-1.0-apache2_config.tar.bz2
# http://nagios.sourceforge.net/download/contrib/misc/mergecfg/mergecfg
Source4:	mergecfg.bz2
Patch0:		nagios-2.0b2-optflags.diff.bz2
Patch2:		nagios-2.0a1-20041002-more_checkcommands.diff.bz2
Patch3:		nagios-2.0a1-20041002-scandir.diff.bz2
Patch4:		nagios-2.0b2-missing_stuff.diff.bz2
Patch5:		nagios-2.0b3-config_revert.diff.bz2
PreReq:		rpm-helper
Requires:	chkconfig
Requires:	gawk
Requires:	grep
Requires:	nagios-plugins
Requires:	shadow-utils
Requires:	textutils
Requires:	perl
BuildRequires:	freetype2-devel
BuildRequires:	freetype-devel
BuildRequires: 	gd-devel
BuildRequires:	jpeg-devel
BuildRequires:	png-devel
BuildRequires:	xpm-devel
BuildRequires:	XFree86-devel
BuildRequires:	zlib-devel
BuildRequires:	perl-devel
BuildRequires:  autoconf2.5
BuildRequires:  automake1.7
%if %mdkversion >= 1020
BuildRequires:	multiarch-utils >= 1.0.3
%endif
# use this when embedded perl works in nagios
#Requires:	libgdbm2
#BuildRequires: 	libgdbm2-devel
#BuildRequires: 	perl-devel
Obsoletes:	netsaint
Provides:	netsaint
BuildRoot:	%{_tmppath}/%{name}-buildroot

%description
Nagios is a program that will monitor hosts and services on your
network. It has the ability to email or page you when a problem
arises and when a problem is resolved. Nagios is written in C and
is designed to run under Linux (and some other *NIX variants) as a
background process, intermittently running checks on various
services that you specify.

The actual service checks are performed by separate "plugin"
programs which return the status of the checks to Nagios.

This package provide core programs for nagios. The web interface,
documentation, and development files are built as separate
packages

%package	www
Summary:	Provides the HTML and CGI files for the Nagios web interface
Group:		Networking/WWW
PreReq:		%{name} = %{version}-%{release}
Requires:	%{name} = %{version}-%{release}
Requires:	apache2
Requires:	freetype
Requires:	freetype2
Requires:	mailx
Requires:	perl
Requires:	XFree86-libs
Requires:	traceroute

%description	www
Nagios is a program that will monitor hosts and services on your
network. It has the ability to email or page you when a problem
arises and when a problem is resolved. Nagios is written in C and
is designed to run under Linux (and some other *NIX variants) as a
background process, intermittently running checks on various
services that you specify.

Several CGI programs are included with Nagios in order to allow
you to view the current service status, problem history,
notification history, and log file via the web. This package
provides the HTML and CGI files for the Nagios web interface.
In addition, HTML documentation is included in this package

%package	devel
Group:		Development/C
Summary:	Provides include files that Nagios-related applications may compile against

%description	devel
Nagios is a program that will monitor hosts and services on your
network. It has the ability to email or page you when a problem
arises and when a problem is resolved. Nagios is written in C and
is designed to run under Linux (and some other *NIX variants) as a
background process, intermittently running checks on various
services that you specify.

This package provides include files that Nagios-related
applications may compile against.

%prep

%setup -q -n %{name}-%{version} -a3
%patch0 -p1 -b .optflags
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p0

bzcat %{SOURCE1} > nagios.init
bzcat %{SOURCE4} > mergecfg

%build
export WANT_AUTOCONF_2_5=1
rm -f configure; touch missing
libtoolize --copy --force; aclocal-1.7; autoconf
#; automake --add-missing

export CFLAGS="%{optflags} -fPIC"
export CXXFLAGS="%{optflags} -fPIC"

./configure \
    --prefix=%{_prefix} \
    --with-init-dir=%{_initrddir} \
    --exec-prefix=%{_sbindir} \
    --bindir=%{_sbindir} \
    --sbindir=%{_libdir}/nagios/cgi \
    --libexecdir=%{_libdir}/nagios/plugins \
    --datadir=%{_datadir}/nagios \
    --sysconfdir=%{_sysconfdir}/nagios \
    --localstatedir=%{_var}/log/nagios \
    --with-lockfile=%{_var}/run/nagios/nagios.pid \
    --with-mail=/bin/mail \
    --with-nagios-user=%{nsusr} \
    --with-nagios-group=%{nsgrp} \
    --with-command-user=%{cmdusr} \
    --with-command-grp=%{cmdgrp} \
    --with-cgiurl=/admin/nagios/cgi-bin \
    --with-htmurl=/admin/nagios \
    --with-default-comments \
    --with-default-downtime \
    --with-default-extinfo \
    --with-default-retention \
    --with-default-status \
    --with-default-objects \
    --with-default-perfdata \
    --with-file-perfdata \
    --with-template-extinfo \
    --with-template-objects \
    --with-gd-lib=%{_libdir} \
    --with-gd-inc=%{_includedir}

# use this when embedded perl works in nagios
#    --enable-embedded-perl \
#    --with-perlcache \

%make all

pushd contrib
    make daemonchk.cgi
    make traceroute.cgi
# use this when embedded perl works in nagios
#    make mini_epn
    make convertcfg
popd


%install
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}

# don't fiddle with the initscript!
export DONT_GPRINTIFY=1

install -d -m0755 %{buildroot}%{_var}/spool/nagios
install -d -m0755 %{buildroot}%{_var}/run/nagios
install -d -m0755 %{buildroot}%{_includedir}/nagios
install -d -m0755 %{buildroot}%{_initrddir}
install -d -m0755 %{buildroot}%{_sysconfdir}/httpd/webapps.d
install -d -m0755 %{buildroot}%{_sysconfdir}/nagios/{servers,printers,switches,routers}
install -d -m0755 %{buildroot}%{_libdir}/nagios/plugins/eventhandlers

make \
    DESTDIR=%{buildroot} \
    BINDIR=%{_sbindir} \
    CFGDIR=%{_sysconfdir}/nagios \
    CGIDIR=%{_libdir}/nagios/cgi \
    COMMAND_OPTS="" \
    HTMLDIR=%{_datadir}/nagios \
    INIT_OPTS="" \
    INSTALL=install \
    INSTALL_OPTS="" \
    LOGDIR=%{_var}/log/nagios \
    install \
    install-html \
    install-commandmode \
    install-config \
    fullinstall

install -m0644 sample-config/nagios.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/cgi.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/resource.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/checkcommands.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/misccommands.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/contactgroups.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/contacts.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/dependencies.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/escalations.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/hostgroups.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/hosts.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/services.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-object/timeperiods.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-extinfo/hostextinfo.cfg %{buildroot}%{_sysconfdir}/nagios/
install -m0644 sample-config/template-extinfo/serviceextinfo.cfg %{buildroot}%{_sysconfdir}/nagios/
 
# fix docs
cp sample-config/README README.sample-config
cp sample-config/template-extinfo/README README.template-extinfo
cp sample-config/template-object/README README.template-object

# install headers
install -m0644 include/locations.h %{buildroot}%{_includedir}/nagios/

pushd contrib
    make \
	DESTDIR=%{buildroot} \
	BINDIR=%{_sbindir} \
	CFGDIR=%{_sysconfdir}/nagios \
	CGIDIR=%{_libdir}/nagios/cgi \
	COMMAND_OPTS="" \
	HTMLDIR=%{_datadir}/nagios \
	INIT_OPTS="" \
	INSTALL=install \
	INSTALL_OPTS="" \
	LOGDIR=%{_var}/log/nagios \
	install
popd

# fix strange dir perms
find %{buildroot}%{_datadir}/nagios -type d | xargs chmod 755

# fix default config
perl -p -i -e "s|=%{_var}/log/nagios/rw/|=%{_var}/spool/nagios/|g" %{buildroot}%{_sysconfdir}/nagios/*

# install simplified init script
install -m0755 nagios.init %{buildroot}%{_initrddir}/nagios

# install the mergecfg script
install -m0755 mergecfg %{buildroot}%{_sbindir}/nagios-mergecfg

# install my minimalistic config (should generate less error feedback;))
pushd %{buildroot}%{_sysconfdir}/nagios
    tar -jxf %{SOURCE2}
popd

# fix web access
install -m0644 apache2_config %{buildroot}%{_sysconfdir}/httpd/webapps.d/12_nagios.conf
install -m0644 passwd %{buildroot}%{_sysconfdir}/nagios/passwd
install -m0644 group %{buildroot}%{_sysconfdir}/nagios/group

# lib64 fix
perl -pi -e "s|/usr/lib|%{_libdir}|g" %{buildroot}%{_sysconfdir}/httpd/webapps.d/12_nagios.conf

# install and fix event handlers
install -m0755 contrib/eventhandlers/disable_active_service_checks %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
install -m0755 contrib/eventhandlers/disable_notifications %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
install -m0755 contrib/eventhandlers/enable_active_service_checks %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
install -m0755 contrib/eventhandlers/enable_notifications %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
install -m0755 contrib/eventhandlers/submit_check_result %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
install -m0755 contrib/eventhandlers/distributed-monitoring/obsessive_svc_handler %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
install -m0755 contrib/eventhandlers/distributed-monitoring/submit_check_result_via_nsca %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
install -m0755 contrib/eventhandlers/redundancy-scenario1/handle-master-host-event %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/
install -m0755 contrib/eventhandlers/redundancy-scenario1/handle-master-proc-event %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/

find %{buildroot}%{_libdir}/nagios/plugins/eventhandlers -type f | xargs perl -pi -e "s|/usr/local/nagios%{_var}/rw/|%{_var}/spool/nagios/|g"
find %{buildroot}%{_libdir}/nagios/plugins/eventhandlers -type f | xargs perl -pi -e "s|/usr/local/nagios/libexec/eventhandlers|%{_libdir}/nagios/plugins/eventhandlers|g"
find %{buildroot}%{_libdir}/nagios/plugins/eventhandlers -type f | xargs perl -pi -e "s|/usr/local/nagios/libexec/send_nsca|%{_libdir}/nagios/plugins/send_nsca|g"
find %{buildroot}%{_libdir}/nagios/plugins/eventhandlers -type f | xargs perl -pi -e "s|/usr/local/nagios/test%{_var}|%{_var}/log/nagios|g"
find %{buildroot}%{_libdir}/nagios/plugins/eventhandlers -type f | xargs perl -pi -e "s|/usr/local/nagios/etc/send_nsca.cfg|%{_sysconfdir}/nagios/send_nsca.cfg|g"

%if %mdkversion >= 1020
%multiarch_includes %{buildroot}%{_includedir}/nagios/locations.h
%endif

%pre
%_pre_useradd %{nsusr} %{_var}/log/nagios /bin/sh

%post
%_post_service %{name}

%preun
%_preun_service %{name}

%postun
%_postun_userdel %{nsusr}

if [ "$1" -ge "1" ]; then
    /sbin/service nagios condrestart >/dev/null 2>&1
fi

%post www
if [ -e %{_sbindir}/ADVXctl ]; then %{_sbindir}/ADVXctl update;fi
echo "NOTE: Don't forget to set the nagios password, issue the command:"
echo "htpasswd %{_sysconfdir}/nagios/passwd nagios"

%postun www
if [ "$1" -ge "1" ]; then
    /sbin/service httpd condrestart >/dev/null 2>&1
fi

%clean
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc Changelog INSTALLING LEGAL README* UPGRADING
%attr(0755,root,root) %{_initrddir}/nagios
%attr(0755,root,root) %{_sbindir}/*
%attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/*-sample
%attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/*.cfg
%attr(0755,root,root) %dir %{_sysconfdir}/nagios/servers
%attr(0755,root,root) %dir %{_sysconfdir}/nagios/printers
%attr(0755,root,root) %dir %{_sysconfdir}/nagios/switches
%attr(0755,root,root) %dir %{_sysconfdir}/nagios/routers
%attr(0755,%{nsusr},%{nsgrp}) %dir %{_var}/log/nagios
%attr(0755,%{nsusr},%{nsgrp}) %dir %{_var}/log/nagios/archives
%attr(2775,%{nsusr},%{cmdgrp}) %dir %{_var}/spool/nagios
%attr(0755,%{nsusr},%{nsgrp}) %dir %{_var}/run/nagios
%attr(0755,root,root) %{_libdir}/nagios/plugins/eventhandlers/*

%files www
%defattr(-,root,root)
%attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/webapps.d/*_nagios.conf
%attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/passwd
%attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/group
%attr(0755,root,root) %{_libdir}/nagios/cgi/*
%attr(-,root,root) %{_datadir}/nagios

%files devel
%defattr(-,root,root)
%if %mdkversion >= 1020
%multiarch %{multiarch_includedir}/nagios/locations.h
%endif
%{_includedir}/nagios

%changelog
* Mon Apr 04 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0b3-1mdk
- 2.0b3
- added P5 to make the shipped minimalistic config work again

* Sun Apr 03 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0b2-4mdk
- use the %%mkrel macro

* Sat Feb 19 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0b2-3mdk
- added P4 to bring back some missing stuff
- handle the %postun better

* Fri Feb 18 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0b2-2mdk
- spec file cleanups, remove the ADVX-build stuff

* Thu Feb 10 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0b2-1mdk
- 2.0b2
- rediffed P0
- make it compile on x86_64

* Thu Feb 10 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0a1-0.20041024.3mdk
- set LC_ALL=C in the initscript in an attempt to fix #12740 like future issues
- fix deps and conditional %%multiarch

* Mon Nov 29 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0a1-0.20041024.2mdk
- added S2
- enhanced the init scipt a bit (S1)

* Sun Oct 24 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0a1-0.20041024.1mdk
- 20041024

* Sun Oct 03 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0a1-0.20041002.2mdk
- fix one typo

* Sun Oct 03 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0a1-0.20041002.1mdk
- cvs snap 20041002 of 2.0a1
- added the long forgotten eventhandlers
- new S2
- added P2 & P3
- misc spec file fixes

* Mon Jul 05 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 1.2-4mdk
- added P1 to make it recognize the correct gd stuff

* Fri Jun 11 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 1.2-3mdk
- rebuilt against new gd

* Sat May 15 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 1.2-2mdk
- fix #9762 (revert changes in 1.2-1mdk)
- fix deps

* Wed Mar 3 2004 Tibor Pittich <Tibor.Pittich@mandrake.org> 1.2-1mdk
- 1.2
- fixed 12_nagios.conf

* Sun Aug 31 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.1-3mdk
- close #4479 

* Thu Jul 10 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.1-2mdk
- rebuild
- added P0 to make it honor %%{optflags}

* Thu Jun 05 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.1-1mdk
- 1.1

* Sun Mar 09 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-7mdk
- argh!!! forgot to update requires and buildrequires for the 
  conditional builds!!!

* Sun Mar 09 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-6mdk
- argh!!! forgot to provide the pid dir!!!
- might as well restart apache... (using the advx macros)

* Sun Mar 09 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-5mdk
- fixed S2 & S3 (this should work right out of the box...)

* Sat Mar 08 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-4mdk
- remove rude stuff in %%post, let apache2 handle it...
- added S3
- relocate the /nagios url to /admin/nagios
- fix pid dir in S1 and in the spec file

* Thu Jan 16 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-3mdk
- build release

* Sat Dec 07 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-2mdk
- PreReq: nagios on the nagios-www subpackage (should generate the 
  nagios user and prevent errors)
- ship my minimalistic config files (S2) in %%{_sysconfdir}/nagios/,
  people expects nagios to work right out of the box..., well there 
  you have it..., now it should...
- simplified the sysv script (S1)
- major spec file fixes

* Mon Nov 25 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-1mdk
- new version

* Sat Nov 23 2002 Olivier Thauvin <thauvin@aerov.jussieu.fr> 1.0b6-2mdk
- fix missing/unpackaged files

* Tue Sep 17 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0b6-1mdk
- new version

* Sun Sep 15 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0b5-2mdk
- fixed a bug where restart did not work as pointed out 
  by Guillaume Bourque
- misc spec file fixes

* Thu Aug 15 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0b5-1mdk
- initial cooker contrib
- misc spec file fixes, used the provided spec file but used spec
  file voodoo magic from Vincent Danens qmail package to be able
  to rebuild with either MySQL or PostgreSQL support.