Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
>
pnp4nagios
> Changes
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
Changes of Revision 12
[-]
[+]
Added
pnp4nagios.spec
@@ -0,0 +1,178 @@ +# +# spec file for package pnp4nagios +# +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# + + +Name: pnp4nagios +%define realname pnp4nagios +Summary: Tool for producing graphs from Nagios perfdata +Version: 0.6.1 +Release: 1 +Url: http://www.ederdrom.de/pnp/start +License: GPL v2 or later +Group: System/Monitoring +BuildRequires: apache2-devel +BuildRequires: nagios-www +BuildRequires: kohana +Requires: kohana +Requires: nagios-www +Requires: rrdtool +Requires: syslog +Requires: perl +Recommends: dejavu +# +%if 0%{?mandriva_version} +# break the "have choice for" cycle +BuildRequires: apache-mpm-prefork +BuildRequires: mailx +%endif +# +%if 0%{?suse_version} +Requires: php-zlib +Requires: php-gd +%endif +%if 0%{suse_version} > 1020 +BuildRequires: fdupes +BuildRequires: rrdtool-devel +%else +BuildRequires: rrdtool +%endif +Source0: %realname-%version.tar.bz2 +Source1: %name-httpd.conf +Source2: %name.quick-start.txt +Source3: %name-init +Source4: pnp4nagios-rpmlintrc +Source5: pnp4nagios-nagios-pnp.cfg +Source6: pnp4nagios-check_nrpe.cfg +Patch1: pnp4nagios-0.6.1-check_pnp_rrds.patch +Patch2: pnp4nagios-0.6.1-verify_pnp_config.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%define nsusr nagios +%define nsgrp nagios +%define apxs2 /usr/sbin/apxs2-prefork +%define apache2_sysconfdir %(%{apxs2} -q SYSCONFDIR) +%define libexecdir %_prefix/lib/nagios/plugins +%define perfdata_spooldir /var/spool/nagios-pnp + +%description +PNP is a tool that produces graphs from performance data from +Nagios plugins. + +Authors: +-------- + Jörg Linge + Hendrik Bäcker + + +%prep +%setup -q -n %realname-%version +%patch1 -p0 +%patch2 -p0 + +%build +%configure \ + --datadir=%_datadir/pnp \ + --datarootdir=%_datadir/pnp/html \ + --localstatedir=/var/log/nagios/pnp \ + --sysconfdir=%_sysconfdir/nagios/pnp \ + --libexecdir=%libexecdir \ + --datarootdir=%_datadir/pnp \ + --with-perfdata-logfile=/var/log/nagios/pnp/perfdata.log \ + --with-perfdata-dir=/var/lib/nagios/pnp \ + --with-perfdata-spool-dir=%{perfdata_spooldir} \ + --with-init-dir=%_sysconfdir/init.d \ + --with-nagios-user=%nsusr \ + --with-nagios-group=%nsgrp \ + --without-kohana \ + --with-kohana_system=/usr/share/kohana/system +make %{?jobs:-j%jobs} all + +%install +mkdir -p %buildroot/var/lib/nagios/pnp %buildroot/var/log/nagios/pnp +make install install-config \ + DESTDIR="%buildroot" \ + LIBEXEC_DIR="%libexecdir" \ + INSTALL_OPTS="" +# move samples to the docudir +mkdir -p %buildroot/%_defaultdocdir/%name/sample-config +find sample-config/ -name "*-sample*" -exec cp -v {} %buildroot/%_defaultdocdir/%name/sample-config/ \; +# install config files not installed via Makefile +sed -e 's@/usr/local/nagios/var/npcd.log@/var/log/nagios/pnp/npcd.log@' \ + -e 's@/usr/var/perfspool/@%{perfdata_spooldir}@' \ + -e 's@/usr/local/nagios/libexec/process_perfdata.pl@%libexecdir/process_perfdata.pl@' \ + -e 's@/usr/libexec@%libexecdir@' \ + %buildroot/%_sysconfdir/nagios/pnp/npcd.cfg-sample > %buildroot/%_sysconfdir/nagios/pnp/npcd.cfg +mv %buildroot/%_sysconfdir/nagios/pnp/process_perfdata.cfg-sample %buildroot/%_sysconfdir/nagios/pnp/process_perfdata.cfg +mv %buildroot/%_sysconfdir/nagios/pnp/rra.cfg-sample %buildroot/%_sysconfdir/nagios/pnp/rra.cfg +sed -e 's@\^hna0@localhost@' \ + -e 's@\^traffic@traffic@' \ + %buildroot/%_sysconfdir/nagios/pnp/pages/web_traffic.cfg-sample > %buildroot/%_sysconfdir/nagios/pnp/pages/web_traffic.cfg +mv %buildroot/%_sysconfdir/nagios/pnp/check_commands/check_nwstat.cfg-sample %buildroot/%_sysconfdir/nagios/pnp/check_commands/check_nwstat.cfg +install -m644 %{SOURCE6} %buildroot/%_sysconfdir/nagios/pnp/check_commands/check_nrpe.cfg +find %buildroot/%_sysconfdir/nagios/pnp -name "*-sample" -exec rm {} \; +# fix pathname to the kohana files +sed -i "s|^\$kohana_modules.*|\$kohana_modules = '/usr/share/kohana/modules';|" %buildroot/%_datadir/pnp/index.php +rm %buildroot/%_datadir/pnp/install.php +# install own nagios command file +install -m644 %{SOURCE5} %buildroot/%_sysconfdir/nagios/nagios-pnp.cfg +# install the documentation +mkdir -p %buildroot/%_defaultdocdir/%name +install -m0644 AUTHORS ChangeLog COPYING README* THANKS %buildroot/%_defaultdocdir/%name/ +install -m0644 %{S:2} %buildroot/%_defaultdocdir/%name/README.SuSE +# install contrib scripts into docdir +mkdir -p %buildroot/%_defaultdocdir/%name/example +# install template placeholder +mkdir -p %buildroot/%_datadir/pnp/templates/ +touch %buildroot/%_datadir/pnp/templates/PUT-YOUR-TEMPLATES-HERE +# install directories +install -d -m0775 %buildroot/%{perfdata_spooldir} +install -d -m0775 %buildroot/var/log/nagios/pnp/stats +# install apache configuration +install -d -m 0755 %buildroot/%{apache2_sysconfdir}/conf.d/ +install -m0644 %{SOURCE1} %buildroot/%{apache2_sysconfdir}/conf.d/nagios-pnp.conf +# install init-script +mkdir -p %buildroot/%_sysconfdir/init.d +install -m0755 %{SOURCE3} %buildroot/%_sysconfdir/init.d/npcd +mkdir -p %buildroot/%_sbindir +ln -s %_sysconfdir/init.d/npcd %buildroot/%_sbindir/rcnpcd +# save discspace, create links +%if 0%{suse_version} > 1020 +%fdupes -s %buildroot/%_datadir/pnp +%endif + +%clean +rm -rf %buildroot + +%preun +%stop_on_removal npcd + +%postun +%insserv_cleanup npcd + +%files +%defattr(-,root,root) +%doc %_defaultdocdir/%name/ +%dir %_datadir/pnp +%dir %_sysconfdir/nagios/pnp +%attr(-,%nsusr,%nsgrp) %dir %{perfdata_spooldir} +%attr(-,%nsusr,%nsgrp) %dir /var/log/nagios/pnp +%attr(-,%nsusr,%nsgrp) %dir /var/log/nagios/pnp/stats +%{_bindir}/* +%_datadir/pnp/* +%attr(0755,root,root) %libexecdir/* +# %{_mandir}/man1/* +%_sbindir/rcnpcd +%_sysconfdir/init.d/npcd +%config(noreplace) %_sysconfdir/nagios/pnp/* +%config(noreplace) %apache2_sysconfdir/conf.d/nagios-pnp.conf +#%config(noreplace) %_sysconfdir/xinetd.d/nagios-pnp +%config(noreplace) %_datadir/pnp/templates/* +%config(noreplace) %_sysconfdir/nagios/nagios-pnp.cfg +%defattr(775,wwwrun,www) +%_datadir/pnp/application/cache +%_datadir/pnp/application/logs + +%changelog