Sophie

Sophie

distrib > Mageia > 3 > x86_64 > media > core-updates-src > by-pkgid > 609e88610ee164fce733a6699a7311d2 > files > 8

nagios-3.4.4-4.2.mga3.src.rpm

%define nsusr nagios
%define nsgrp nagios
%define cmdusr apache
%define cmdgrp apache
%define _disable_ld_no_undefined 1
%define subrel 2

Summary:    Host/service/network monitoring program
Name:       nagios
Version:    3.4.4
Release:    %mkrel 4
License:    GPLv2
Group:      Monitoring
URL:        http://www.nagios.org/
Source0:    http://prdownloads.sourceforge.net/nagios/%{name}-%{version}.tar.gz
Source1:    %{name}.service
Source2:    %{name}.tmpfiles
Source5:    favicon.ico
Patch1:     nagios-3.4.1-mageia-config.patch
Patch2:     nagios-3.4.4.no-duplicate-command-definition.patch
Patch3:     nagios-4.0.2-CVE-2013-7108-CVE-2013-7205.patch
Patch6:     nagios-DESTDIR.diff
Requires(post): rpm-helper
Requires(preun): rpm-helper
Requires(pre): rpm-helper
Requires(postun): rpm-helper
Requires:   apache
Requires:   nagios-plugins
Suggests:   nagios-check_http
Suggests:   nagios-check_ssh
Suggests:   nagios-check_ping
Suggests:   nagios-check_disk
Suggests:   nagios-check_load
Suggests:   nagios-check_procs
Suggests:   nagios-check_users
Suggests:   nagios-check_swap
BuildRequires:  gd-devel
BuildRequires:  imagemagick
BuildRequires:  jpeg-devel
BuildRequires:  libtool-devel
BuildRequires:  multiarch-utils >= 1.0.3
BuildRequires:  perl-devel
Provides:	nagios-agent
Epoch:      1

%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
Requires:   %{name} = %{epoch}:%{version}-%{release}
Requires:   webserver
Requires:   freetype
Requires:   freetype2
Requires:   nail
Requires:   traceroute
Requires:   apache-mod_php
Requires:   %{name}-imagepaks
Obsoletes:  nagios-theme-nuvola
Obsoletes:  nagios-theme
Epoch:      %{epoch}

%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
Epoch:      %{epoch}

%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 nagios
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch6 -p0

%build
%serverbuild

export CFLAGS="$CFLAGS -fPIC"
export CXXFLAGS="$CXXFLAGS -fPIC"
export FFLAGS="$FFLAGS -fPIC"
%configure2_5x \
    --with-httpd-conf=%{_webappconfdir} \
    --with-checkresult-dir=/var/spool/nagios/checkresults \
    --with-temp-dir=/tmp \
    --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=/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=/nagios/cgi-bin \
    --with-htmurl=/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} \
    --enable-embedded-perl \
    --with-perlcache

# bug
perl -pi -e "s|/var/log/nagios/spool/checkresults|/var/spool/nagios/checkresults|g" include/locations.h

%make all

pushd contrib
    make daemonchk.cgi
    make traceroute.cgi
    make mini_epn
    make convertcfg
popd

%install
rm -rf %{buildroot}

make \
    DESTDIR=%{buildroot} \
    BINDIR=%{_sbindir} \
    CFGDIR=%{_sysconfdir}/nagios \
    CGIDIR=%{_libdir}/nagios/cgi \
    COMMAND_OPTS="" \
    HTMLDIR=%{_datadir}/nagios/www \
    INIT_OPTS="" \
    INSTALL=install \
    INSTALL_OPTS="" \
    LOGDIR=/var/log/nagios \
    STRIP=/bin/true \
    install-config \
    fullinstall

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

# fix strange perms
find %{buildroot}%{_datadir}/nagios -type d | xargs chmod 755
find %{buildroot}%{_datadir}/nagios -type f | xargs chmod 644
find %{buildroot}%{_sysconfdir}/nagios -type d | xargs chmod 755
find %{buildroot}%{_sysconfdir}/nagios -type f | xargs chmod 644
chmod 755 \
    %{buildroot}%{_libdir}/nagios/cgi/* \
    %{buildroot}%{_sbindir}/*

# fix docs
cp sample-config/README README.sample-config
cp sample-config/template-object/README README.template-object

# install headers
install -d -m 755 %{buildroot}%{_includedir}/nagios
install -m 644 include/locations.h %{buildroot}%{_includedir}/nagios/
%multiarch_includes %{buildroot}%{_includedir}/nagios/locations.h

install -d -m 755 %{buildroot}/var/spool/nagios/checkresults
install -d -m 755 %{buildroot}%{_sysconfdir}/nagios/plugins.d
install -d -m 755 %{buildroot}%{_sysconfdir}/nagios/conf.d

# fix default config
perl -pi \
    -e "s|=/var/log/nagios/rw/|=/var/spool/nagios/|g" \
    %{buildroot}%{_sysconfdir}/nagios/*.cfg
perl -pi \
    -e "s|^physical_html_path=.*|physical_html_path=%{_datadir}/nagios/www|g" \
    %{buildroot}%{_sysconfdir}/nagios/cgi.cfg


# systemd
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/nagios.service
install -D -m 644 %{SOURCE2} %{buildroot}%{_prefix}/lib/tmpfiles.d/nagios.conf
rm -f %{buildroot}%{_initrddir}/nagios

# apache configuration
install -d -m 755 %{buildroot}%{_webappconfdir}
cat > %{buildroot}%{_webappconfdir}/%{name}.conf <<EOF
# Nagios Apache configuration

ScriptAlias /%{name}/cgi-bin %{_libdir}/%{name}/cgi

<Directory %{_libdir}/%{name}/cgi>
    Options ExecCGI
    Require all granted
</Directory>

Alias /%{name} %{_datadir}/%{name}/www

<Directory %{_datadir}/%{name}/www>
    Require all granted
</Directory>
EOF

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

find %{buildroot}%{_libdir}/nagios/plugins/eventhandlers -type f | \
    xargs perl -pi \
    -e 's|/usr/local/nagios/var/rw/|/var/spool/nagios/|;' \
    -e 's|/usr/local/nagios/libexec/eventhandlers|%{_libdir}/nagios/plugins/eventhandlers|g;' \
    -e 's|/usr/local/nagios/libexec/send_nsca|%{_libdir}/nagios/plugins/send_nsca|g;' \
    -e 's|/usr/local/nagios/test/var|/var/log/nagios|g;' \
    -e 's|/usr/local/nagios/etc/send_nsca.cfg|%{_sysconfdir}/nagios/send_nsca.cfg|g;' \
    -e 's|printfcmd="/bin/printf"|printfcmd="/usr/bin/printf"|;'


# install the favicon.ico
install -m 644 %{SOURCE5} %{buildroot}%{_datadir}/nagios/www

# automatic reloading for new plugins
install -d %buildroot%{_var}/lib/rpm/filetriggers
cat > %buildroot%{_var}/lib/rpm/filetriggers/nagios.filter << EOF
^.%{_sysconfdir}/nagios/plugins.d/.*\.cfg$
EOF
cat > %buildroot%{_var}/lib/rpm/filetriggers/nagios.script << EOF
#!/bin/sh
systemctl try-restart nagios.service
EOF
chmod 755 %buildroot%{_var}/lib/rpm/filetriggers/nagios.script

%pre
%_pre_useradd %{nsusr} /var/log/nagios /bin/sh
%{_bindir}/gpasswd -a %{cmdusr} %{nsgrp} >/dev/null 2>&1 || :

%post
%_tmpfilescreate %{name}
%_post_service %{name}

%preun
%_preun_service %{name}

%postun
%_postun_userdel %{nsusr}

%files
%doc Changelog INSTALLING LEGAL README UPGRADING
%doc sample-config/mrtg.cfg
%{_unitdir}/nagios.service
%{_prefix}/lib/tmpfiles.d/nagios.conf
%{_sbindir}/*
%dir %{_sysconfdir}/nagios
%dir %{_sysconfdir}/nagios/conf.d
%dir %{_sysconfdir}/nagios/plugins.d
%dir %{_sysconfdir}/nagios/objects
%config(noreplace) %{_sysconfdir}/nagios/*.cfg
%config(noreplace) %{_sysconfdir}/nagios/objects/*.cfg
%attr(-,%{nsusr},%{nsgrp}) %dir /var/log/nagios
%attr(-,%{nsusr},%{nsgrp}) %dir /var/log/nagios/archives
%attr(2775,%{nsusr},%{cmdgrp}) %dir /var/spool/nagios
%attr(-,%{nsusr},%{nsgrp}) %dir /var/spool/nagios/checkresults
%{_libdir}/nagios/plugins/eventhandlers
%{_var}/lib/rpm/filetriggers/nagios.*

%files www
%config(noreplace) %{_webappconfdir}/nagios.conf
%{_libdir}/nagios/cgi
%{_datadir}/nagios/www

%files devel
%multiarch %{multiarch_includedir}/nagios/locations.h
%{_includedir}/nagios




%changelog
* Tue Jan 07 2014 guillomovitch <guillomovitch> 1:3.4.4-4.2.mga3
+ Revision: 565486
- ensure /run/nagios is created at post-installation time (#12100)
- add upstream patch to fix CVE-2013-7108 and CVE-2013-7205 (#12100)

* Fri Feb 15 2013 dlucio <dlucio> 1:3.4.4-4.mga3
+ Revision: 398589
- New provides to let NRPE or Nagios be choosen for plugins

* Thu Feb 07 2013 guillomovitch <guillomovitch> 1:3.4.4-3.mga3
+ Revision: 395124
- drop command definition from default configuration to avoid conflict with definitions found in plugin packages
- soft dependency on plugins used in default configuration (#8986)

* Wed Feb 06 2013 guillomovitch <guillomovitch> 1:3.4.4-2.mga3
+ Revision: 394811
- switch group to monitoring

* Sun Jan 27 2013 guillomovitch <guillomovitch> 1:3.4.4-1.mga3
+ Revision: 392788
- new version

* Sat Jan 12 2013 umeabot <umeabot> 1:3.4.3-2.mga3
+ Revision: 360674
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Mon Dec 10 2012 guillomovitch <guillomovitch> 1:3.4.3-1.mga3
+ Revision: 329333
- new version

* Wed Sep 05 2012 guillomovitch <guillomovitch> 1:3.4.1-8.mga3
+ Revision: 288650
- cleanup installation process, and ensure standard perms

* Fri Aug 24 2012 guillomovitch <guillomovitch> 1:3.4.1-7.mga3
+ Revision: 283391
- make webapp configuration file compliant with apache 2.4

* Thu Aug 23 2012 guillomovitch <guillomovitch> 1:3.4.1-6.mga3
+ Revision: 283355
- don't ship /var/run/nagios

* Fri Jul 06 2012 guillomovitch <guillomovitch> 1:3.4.1-5.mga3
+ Revision: 268427
- fix rpm filetrigger to use systemctl instead of systemd init script

* Thu Jun 07 2012 guillomovitch <guillomovitch> 1:3.4.1-4.mga3
+ Revision: 256947
- fix www package dependencies

* Tue Jun 05 2012 guillomovitch <guillomovitch> 1:3.4.1-3.mga3
+ Revision: 255980
- don't turn off default syslog log duplication
- use /usr/lib/tmpfiles.d for temp files definitions

* Tue Jun 05 2012 guillomovitch <guillomovitch> 1:3.4.1-2.mga3
+ Revision: 255896
- add systemd support
- drom sysinit support
- drop old mergecfg script

* Mon Jun 04 2012 guillomovitch <guillomovitch> 1:3.4.1-1.mga3
+ Revision: 254077
- new version
- merge default-theme package into www package
- add mod_php dependency for www package

* Sun Sep 18 2011 misc <misc> 1:3.3.1-2.mga2
+ Revision: 145053
- fix init script lsb keyword

  + dmorgan <dmorgan>
    - Change apache-conf require

  + guillomovitch <guillomovitch>
    - the theme package is noarch
    - patch3: fix issue with rss files installation
    - use standard %%_pre_useradd macro
    - more spec cleanup
    - drop useless XDG menu
    - new version
    - spec cleanup
    - drop README.mdv, information provided there is just about packaging changes
    - drop obsolete migration %%post scripts
    - drop useless external configuration package
    - no need for arbitrary default configuration structure, let the user do it

* Thu Mar 03 2011 ennael <ennael> 1:3.2.3-2.mga1
+ Revision: 63044
- clean spec file
- imported package nagios