Blob Blame History Raw
Name:           pnp4nagios
Version:        0.4.10
Release:        3%{?dist}
Summary:        Nagios performance data analysis tool

Group:          Applications/System
License:        GPLv2
URL:            http://www.pnp4nagios.org/
Source0:        http://downloads.sourceforge.net/%{name}/pnp-%{version}.tar.gz
Source1:        pnp4nagios.logrotate.conf
Source2:        pnp4nagios-npcd.sysvinit
Source3:        pnp4nagios-README.fedora
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  rrdtool
Requires:       nagios
Requires:       rrdtool
Requires:       php-gd
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts


%description
PNP is an addon to nagios which analyzes performance data provided by plugins
and stores them automatically into RRD-databases.


%prep
%setup -q -n pnp-%{version}
cp -p %{SOURCE3} README.fedora
sed -i -e 's/^INSTALL_OPTS="-o $nagios_user -g $nagios_grp"/INSTALL_OPTS=""/' \
    configure
sed -i -e '/^\t$(MAKE) strip-post-install$/d' src/Makefile.in


%build
%configure --bindir=%{_sbindir}/ \
           --libexecdir=%{_libexecdir}/%{name}/ \
           --sysconfdir=%{_sysconfdir}/%{name}/ \
           --localstatedir=%{_localstatedir}/log/%{name}/ \
           --datadir=%{_datadir}/nagios/html/%{name}/ \
           --datarootdir=%{_datadir}/nagios/html/%{name}/ \
           --with-perfdata-dir=%{_localstatedir}/lib/%{name}/ \
           --with-perfdata-spool-dir=%{_localstatedir}/spool/%{name}/
make %{?_smp_mflags} all


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT 
make install-config DESTDIR=$RPM_BUILD_ROOT 
find $RPM_BUILD_ROOT/%{_sysconfdir}/pnp4nagios -name *-sample -exec rename "-sample" "" {} ';'
sed -i -e 's|/usr/libexec/process_perfdata.pl|/usr/libexec/pnp4nagios/process_perfdata.pl|' \
       -e 's|^log_type = syslog|log_type = file|' \
       $RPM_BUILD_ROOT/%{_sysconfdir}/pnp4nagios/npcd.cfg

mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/%{name}
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
install -Dp -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pnp4nagios
install -Dp -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/npcd


%clean
rm -rf $RPM_BUILD_ROOT


%post
/sbin/chkconfig --add npcd


%preun
if [ $1 = 0 ]; then
        /sbin/service npcd stop >/dev/null 2>&1
        /sbin/chkconfig --del npcd
fi


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


%files
%defattr(644,root,root,755)
%doc AUTHORS BUGS ChangeLog COPYING INSTALL NEWS README README.fedora
%doc README.npcd THANKS TODO
%dir %{_sysconfdir}/pnp4nagios
%config(noreplace) %{_sysconfdir}/pnp4nagios/*
%config(noreplace) %{_sysconfdir}/logrotate.d/pnp4nagios
%attr(755,root,root) %{_initrddir}/npcd
%attr(755,root,root) %{_sbindir}/npcd
%attr(755,root,root) %{_libexecdir}/pnp4nagios/process_perfdata.pl
%attr(755,nagios,nagios) %{_localstatedir}/lib/%{name}
%attr(755,nagios,nagios) %{_localstatedir}/log/%{name}
%attr(755,nagios,nagios) %{_localstatedir}/spool/%{name}
%{_datadir}/nagios/html/pnp4nagios


%changelog
* Tue Sep 02 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.10-3
- Fix logrotate conf (RHBZ#460861).

* Fri Jul 18 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.10-2
- Fix typo in logrotate conf.

* Wed Jul 09 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.10-1
- Update to 0.4.10.

* Tue May 27 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.9-3
- Fix npcd init script to use /etc/pnp4nagios.

* Tue May 27 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.9-2
- Install npcd unstripped to let rpm do it.

* Sat May 24 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.9-1
- Update to 0.4.9.
- Rename to pnp4nagios to match other distros packages.

* Mon Apr 14 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.7-5
- Log to file by default.
- Kill pnpsender man page.

* Mon Apr 07 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.7-4
- Install inside of nagios html dir.

* Mon Apr 07 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.7-3
- Provide properly named config files.
- Add missing Requires:.
- Add a logrotate conf file.

* Fri Apr 04 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.7-2
- Add an initscript for npcd.

* Wed Mar 19 2008 Xavier Bachelot <xavier@bachelot.org> 0.4.7-1
- Initial build.