Blob Blame History Raw
Name: nagios
Version: 2.7
Release: 2%{?dist}
Summary: Host/service/network monitoring program

Group: Applications/System
License: GPL
URL: http://www.nagios.org/
Source0: http://dl.sourceforge.net/nagios/%{name}-%{version}.tar.gz
Source1: nagios.logrotate
Source2: nagios.htaccess
Patch0: nagios-initrd.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: gd-devel > 1.8, mailx
Requires: httpd
Requires(pre): %{_sbindir}/useradd
Requires(preun): /sbin/service, /sbin/chkconfig
Requires(post): /sbin/chkconfig, /sbin/service, %{_sbindir}/usermod
Requires(postun): /sbin/service

%description
Nagios is a program that will monitor hosts and services on your
network.  It has the ability to send email or page alerts 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. The plugins are
available at http://sourceforge.net/projects/nagiosplug.

This package provides the core program, web interface, and documentation
files for Nagios. Development files are built as a separate package.

%package devel
Group: Applications/System
Summary: Provides include files that Nagios-related applications may compile against
Requires: %{name} = %{version}-%{release}

%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
%patch0 -p0 

%build
./configure \
	--prefix=%{_datadir}/%{name} \
	--exec-prefix=%{_localstatedir}/lib/%{name} \
	--with-init-dir=%{_initrddir} \
	--with-cgiurl=/%{name}/cgi-bin/ \
	--with-htmlurl=/%{name} \
	--with-lockfile=%{_localstatedir}/run/%{name}.pid \
	--with-nagios-user=nagios \
	--with-nagios-grp=nagios \
	--bindir=%{_sbindir} \
	--libexecdir=%{_libdir}/%{name}/plugins \
	--sysconfdir=%{_sysconfdir}/%{name} \
	--localstatedir=%{_localstatedir}/log/%{name} \
	--with-gd-lib=%{_libdir} \
	--with-gd-inc=%{_includedir} \
	--enable-embedded-perl \
	--with-perlcache \
	--with-template-objects \
	--with-template-extinfo	
make %{?_smp_mflags} all

%{__sed} -e "s| package Embed::Persistent;|#\!%{_bindir}/perl\npackage Embed::Persistent;|" < p1.pl > p1.pl.fedora
%{__sed} -e "s/# chkconfig: 345/# chkconfig: - /" \
	 -e "s|NagiosCmd=/var/log/nagios/rw/nagios.cmd|NagiosCmd=%{_localstatedir}/spool/%{name}/cmd/nagios.cmd|" < daemon-init > daemon-init.fedora
%{__sed} -e "s|resource.cfg|private/resource.cfg|" \
	 -e "s|command_file=/var/log/nagios/rw/nagios.cmd|command_file=%{_localstatedir}/spool/%{name}/cmd/nagios.cmd|" < sample-config/nagios.cfg > sample-config/nagios.cfg.fedora
%{__sed} -e "s|/usr/lib/|%{_libdir}/|" %{SOURCE2} > %{name}.htaccess
%{__mv} -f sample-config/nagios.cfg.fedora sample-config/nagios.cfg
echo >> html/stylesheets/common.css

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} INSTALL_OPTS="" COMMAND_OPTS="" install-config
%{__install} -d -m 0775 %{buildroot}/%{_localstatedir}/spool/%{name}/cmd
%{__install} -d -m 0755 %{buildroot}/%{_prefix}/include/%{name}
%{__install} -d -m 0755 %{buildroot}/%{_sysconfdir}/%{name}
%{__install} -d -m 0755 %{buildroot}/%{_sysconfdir}/%{name}/private
%{__install} -D -m 0755 base/nagios %{buildroot}/%{_sbindir}/nagios
%{__install} -D -m 0755 base/nagiostats %{buildroot}/%{_bindir}/nagiostats
%{__install} -d -m 0755 cgi/ %{buildroot}/%{_libdir}/%{name}/cgi-bin/
%{__install} -D -m 0755 cgi/*cgi %{buildroot}/%{_libdir}/%{name}/cgi-bin/
%{__install} -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
%{__install} -d -m 0755 %{buildroot}/%{_libdir}/%{name}/plugins/eventhandlers
%{__install} -D -m 0644 include/locations.h %{buildroot}/%{_includedir}/%{name}/locations.h
%{__install} -D -m 0644 %{name}.htaccess %{buildroot}/%{_sysconfdir}/httpd/conf.d/%{name}.conf
%{__install} -D -m 0755 daemon-init.fedora %{buildroot}/%{_initrddir}/%{name}
%{__install} -d -m 0755 html/ %{buildroot}/%{_datadir}/%{name}/html
%{__install} -d -m 0755 %{buildroot}/%{_localstatedir}/log/%{name}/archives
%{__install} -D -m 0755 p1.pl.fedora %{buildroot}/%{_sbindir}/p1.pl
%{__mkdir} -p %{buildroot}/%{_initrddir}
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/httpd/conf.d/
%{__cp} -a html/* %{buildroot}/%{_datadir}/%{name}/html/
%{__rm} -f %{buildroot}/%{_datadir}/%{name}/html/*in
%{__rm} -f %{buildroot}/%{_datadir}/%{name}/html/Makefile
%{__mv} %{buildroot}/%{_sysconfdir}/%{name}/resource.cfg-sample %{buildroot}/%{_sysconfdir}/%{name}/private/resource.cfg-sample

%clean
rm -rf %{buildroot} > /dev/null 2>&1

%pre
%{_sbindir}/useradd -d %{_localstatedir}/spool/%{name} -r -s /sbin/nologin nagios 2> /dev/null || :

%preun
if [ $1 = 0 ]; then
	/sbin/service nagios stop > /dev/null 2>&1 || :
	/sbin/chkconfig --del %{name} || :
fi

%post
/sbin/chkconfig --add %{name} || :
/sbin/service httpd condrestart > /dev/null 2>&1 || :
%{_sbindir}/usermod -a -G %{name} apache || :

%postun
/sbin/service httpd condrestart > /dev/null 2>&1 || :

%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/%{name}
%dir %{_libdir}/%{name}/plugins/eventhandlers
%dir %{_libdir}/%{name}/cgi-bin
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/html
%doc %{_datadir}/%{name}/html/docs
%doc Changelog INSTALLING LICENSE README UPGRADING 
%{_datadir}/%{name}/html/[^d]*
%{_sbindir}/*
%{_bindir}/*
%{_libdir}/%{name}/cgi-bin/*cgi
%{_initrddir}/nagios
%config(noreplace) %{_sysconfdir}/httpd/conf.d/nagios.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/*cfg-sample

%attr(0750,root,nagios) %dir %{_sysconfdir}/%{name}/private
%attr(0640,root,nagios) %config(noreplace) %{_sysconfdir}/%{name}/private/resource.cfg-sample
%attr(0755,nagios,nagios) %dir %{_localstatedir}/spool/%{name}
%attr(2775,nagios,nagios) %dir %{_localstatedir}/spool/%{name}/cmd
%attr(0755,nagios,nagios) %dir %{_localstatedir}/log/%{name}
%attr(0755,nagios,nagios) %dir %{_localstatedir}/log/%{name}/archives

%files devel
%defattr(-,root,root)
%{_includedir}/%{name}

%changelog
* Tue Feb 06 2007 Mike McGrath <imlinux@gmail.com> 2.7-2
- Upstream released 2.7

* Thu Nov 30 2006 Mike McGrath <imlinux@gmail.com> 2.6-1
- Upstream released 2.6

* Thu Sep 07 2006 Mike McGrath <imlinux@gmail.com> 2.5-3
- Release bump for mass rebuild

* Wed Aug 02 2006 Mike McGrath <imlinux@gmail.com> 2.5-2
- Fixed default permissions for private and the resource file

* Fri Jul 14 2006 Mike McGrath <imlinux@gmail.com> 2.5-1
- Upstream released 2.5

* Mon Jun 26 2006 Mike McGrath <imlinux@gmail.com> 2.4-2
- Added /usr/bin/nagiostats bz# 194461

* Sun Jun 04 2006 Mike McGrath <imlinux@gmail.com> 2.4-1
- Upstream released 2.4
- Cleaned up changelog

* Mon May 15 2006 Mike McGrath <imlinux@gmail.com> 2.3.1-1
- Bug fix for HTTP content_length header integer overflow in CGIs
- Updates no longer remove Nagios from starting up on reboot

* Tue May 09 2006 Mike McGrath <imlinux@gmail.com> 2.3-3
- updates to the init script that prevented nagios from shutting down

* Wed May 03 2006 Mike McGrath <imlinux@gmail.com> 2.3-1
- Upstream released 2.3
- Bug fix for negative HTTP content_length header in CGIs
- Added missing links for notes_url and action_url to service column of status detail page 

* Tue May 02 2006 Mike McGrath <imlinux@gmail.com> 2.2-3
- Upstream released 2.2

* Tue Feb 21 2006 Mike McGrath <imlinux@gmail.com> 2.0-1
- Upstream released 2.0 (changes below)
- Fix for segfault in timed event queue
- Removed length limitations for object vars/vals
- Updated config.sub and config.guess to versions from automake-1.9
- Doc updates

* Sat Feb 04 2006 Mike McGrath <imlinux@gmail.com> 2.0-0.2.rc2
- Fixed default options in Apache config

* Fri Jan 27 2006 Mike McGrath <imlinux@gmail.com> 2.0-0.1.rc2
- Using 2.0rc2 tarball

* Thu Jan 26 2006 Mike McGrath <imlinux@gmail.com> 1.3-15
- Fixed usermod -a issue, Bugzilla #49609

* Sun Jan 15 2005 Mike McGrath <imlinux@gmail.com> 1.3-14
- Fedora friendly spec file

* Sat May 31 2003 Karl DeBisschop <kdebisschop@users.sourceforge.net> (1.1-1)
- Merge with CVS for 1.1 release

* Fri May 30 2003 Karl DeBisschop <kdebisschop@users.sourceforge.net> (1.0-4)
- cmdgrp was not always getting created
- patches for cmd.cgi and history.cgi

* Sat May 24 2003 Karl DeBisschop <kdebisschop@users.sourceforge.net> (1.0-3)
- patches for doco and PostgreSQL timestamp
- make sure all files are packaged (otherwise, will not build on RH9)

* Sat May 17 2003 Karl DeBisschop <kdebisschop@users.sourceforge.net> (1.0-2)
- patch for file descriptor leak

* Fri Oct 04 2002 Karl DeBisschop <kdebisschop@users.sourceforge.net>
- merge many improvements from Ramiro Morales <rm-rpms@gmx.net>
  (macros for PERF_EXTERNAL and EMBPERL, cleanup pre/post scripts,
   nnmmsg logger macro, include eventhandlers, convertcfg, mini_epn)
- use LSB-standard /etc/init.d/nagios startup location

* Tue Aug 13 2002 Karl DeBisschop <kdebisschop@users.sourceforge.net>
- INSTALL was renamed INSTALLING
- p1.pl script included in package
- web server restarted because Red Hat 7.3 init does not do 'reload'

* Fri Jun 14 2002 Ethan Galstad <nagios@nagios.org) (1.0b4)
- Modified requirements to work when installed using KickStart (Jeff Frost)
- Changed method used for checking for user/group existence (Jeff Frost)

* Tue May 15 2002 Ethan Galstad <nagios@nagios.org) (1.0b1)
- Updated to work with new sample template-based config files (Darren Gamble)

* Sun Feb 17 2002 Ole Gjerde <gjerde@ignus.com> (1.0a4)
- Fixed spec file to work with Nagios

* Wed Jan 17 2001 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.7a5-1)
- switch from /usr/libexec to /usr/lib because linux FHS has no libexec
- use global macro to set location of init script
- fold htaccess.sample into contrib directory of tarball

* Fri Nov 03 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6-1)
- Rebuild with final sources

* Wed Sep 06 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b5-1)
- Create separate cgi, html, and devel packages
- Include commands.cfg

* Sun Aug 27 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b5-1)
- beta 5

* Sun Jul 23 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b3-2)
- fixes for daemon-init, multi-OS RPM building

* Wed Jul 12 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b3-1)
- beta 3

* Sun Jun 25 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b2-3)
- true beta2 sources

* Sat Jun 24 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b2-2)
- cleanup spec, still using pre-beta2 sources

* Sat Jun 24 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b2-1)
- mandrake merge using pre-beta2 sources (many thanks to Stefan van der Eijk <s.vandereijk@chello.nl>)

* Wed Jun 14 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b1-1)
- add stylesheet diffs

* Mon Jun 12 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.6b1-1)
- adapt for 0.0.6b1

* Mon Jun 05 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net> (0.0.5-4)
- add traceroute.cgi and htaccess.sample
- move placement of docs (in files) to avoid group warnings
- change www user and group to nobody and add warning

* Mon Jun 05 2000 Karsten Weiss <knweiss@gmx.de> (0.0.5-3)
- official group name
- improved user detection

* Tue Oct 19 1999 Mike McHenry <mmchen@minn.net) (0.0.4-2)
- Fixed init.d scripts to better fit new Redhat init.d script formats

* Fri Sep 03 1999 Mike McHenry <mmchen@minn.net> (0.0.4-1)
- Upgraded package from 0.0.4b4 to 0.0.4

* Mon Aug 16 1999 Mike McHenry <mmchen@minn.net>
- First RPM build (0.0.4b4)