%define nsusr nagios %define nsgrp nagios %define cmdgrp nagioscmd Name: nagios Version: 3.5.1 Release: 2mamba Summary: An Open Source host, service and network monitoring program Group: Network/Monitoring Vendor: openmamba Distribution: openmamba Packager: Davide Madrisan URL: http://www.nagios.org/ Source0: http://downloads.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz Source1: nagios.htaccess Patch0: %{name}-3.4.2-nagios_initscripts.patch Patch1: %{name}-3.4.2-makefile_install,patch Patch2: %{name}-3.4.2-fix_path_to_cgi_executables.patch Patch3: %{name}-3.4.2-fix_path_to_passwd_file_in_apache_s_config_file.patch Patch4: %{name}-3.4.2-p1_missing_interpreter.patch Patch5: nagios-3.5.1-confd.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel BuildRequires: libgd-devel BuildRequires: libjpeg-devel BuildRequires: libltdl-devel BuildRequires: libpng-devel BuildRequires: libz-devel BuildRequires: perl-devel ## AUTOBUILDREQ-END BuildRequires: mailx BuildRequires: perl(CPAN) BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: perl(ExtUtils::Embed) BuildRequires: perl(Test::Harness) BuildRequires: perl(Test::HTML::Lint) BuildRequires: perl(Test::More) BuildRequires: perl(Test::Simple) Requires: mailx Requires: nagios-plugins BuildRoot: %{_tmppath}/%{name}-%{version}-root %description NAGIOS is an application, system and network monitoring application. It can escalate problems by email, pager or any other medium. It is also useful for incident or SLA reporting. Nagios is written in C and is designed 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. %package www Group: Network/Monitoring Summary: Provides the HTML and CGI files for the Nagios web interface Requires(pre): %{name} = %{?epoch:%epoch:}%{version}-%{release} Requires(pre): apache Requires(pre): apache-mod_php %description www Nagios is an application, system and network monitoring application. 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/Libraries Summary: Development files for %{name} Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} %description devel This package provides include files that Nagios-related applications may compile against. %prep %setup -q -n %{name} %patch0 -p1 %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1 %build %configure \ --prefix=%{_datadir}/%{name} \ --exec-prefix=%{_localstatedir}/lib/%{name} \ --bindir=%{_sbindir} \ --datadir=%{_datadir}/%{name}/html \ --libdir=%{_libdir}/%{name} \ --libexecdir=%{_libdir}/%{name}/plugins \ --localstatedir=%{_localstatedir}/log/%{name} \ --sysconfdir=%{_sysconfdir}/%{name} \ --enable-embedded-perl \ --enable-event-broker \ --enable-nanosleep \ --with-init-dir=%{_initrddir} \ --with-cgiurl=/%{name}/cgi-bin \ --with-htmlurl=/%{name} \ --with-httpd_conf=%{_sysconfdir}/httpd/httpd.d \ --with-lockfile=/run/%{name}.pid \ --with-checkresult-dir=%{_localstatedir}/spool/%{name} \ --with-nagios-user=%{nsusr} --with-nagios-grp=%{nsgrp} \ --with-command-group=%{cmdgrp} \ --with-gd-lib=%{_libdir} \ --with-gd-inc=%{_includedir} \ --with-perlcache \ --with-template-objects \ --with-template-extinfo \ --with-mail=/bin/mailx \ STRIP=/bin/true %make %{?_smp_mflags} all sed -e "s|@libdir@/|%{_libdir}/|" %{S:1} > %{name}.htaccess sed -i -e "\ s|\(NagiosCommandFile=\).*|\1%{_localstatedir}/spool/%{name}/rw/nagios.cmd|" \ daemon-init cd sample-config sed -i \ -e "s|resource.cfg|private/resource.cfg|" \ -e "s|\(command_file=\).*|\1%{_localstatedir}/spool/%{name}/rw/nagios.cmd|" \ nagios.cfg sed -i "\ s,\(#\$USER2\$=\).*,\1%{_libdir}/nagios/eventhandlers," \ resource.cfg cd .. # make daemonchk.cgi and event handlers cd contrib %make daemonchk.cgi \ traceroute.cgi \ mini_epn \ convertcfg cd eventhandlers for f in `find . -type f`; do sed -i "\ s,/usr/local/nagios/etc,%{_sysconfdir}/nagios, s,/usr/local/nagios/libexec,%{_libdir}/nagios, s,/usr/local/nagios/var/rw/nagios.cmd,%{_localstatedir}/spool/%{name}/rw/nagios.cmd," $f done %install [ "%{buildroot}" != / ] && rm -rf %{buildroot} make \ DESTDIR=%{buildroot} \ INSTALL_OPTS="" COMMAND_OPTS="" INIT_OPTS="" \ CGIDIR="%{_libdir}/%{name}/cgi-bin" \ CFGDIR="%{_sysconfdir}/%{name}" fullinstall # Private files install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/private mv %{buildroot}%{_sysconfdir}/%{name}/resource.cfg \ %{buildroot}%{_sysconfdir}/%{name}/private/resource.cfg install -d %{buildroot}%{_sysconfdir}/%{name}/private touch %{buildroot}%{_sysconfdir}/%{name}/private/htpasswd.users # Install header-file install -D -m 0644 include/locations.h \ %{buildroot}%{_includedir}/%{name}/locations.h install -d %{buildroot}%{_sysconfdir}/sysconfig touch %{buildroot}%{_sysconfdir}/sysconfig/%{name} install -d %{buildroot}%{_localstatedir}/spool/%{name}/rw install -d -m 0755 %{buildroot}%{_libdir}/%{name}/plugins/eventhandlers # Install eventhandlers pwd install -d %{buildroot}%{_libdir}/nagios/eventhandlers find ./contrib/eventhandlers/ -type f -exec \ install -m 0755 {} %{buildroot}%{_libdir}/%{name}/eventhandlers/ ';' # Fix strange permission chmod 755 %{buildroot}%{_sbindir}/nagiostats chmod 755 %{buildroot}%{_libdir}/nagios/cgi-bin chmod 755 %{buildroot}%{_libdir}/nagios/cgi-bin/* # Create conf.d directory install -d %{buildroot}%{_sysconfdir}/nagios/conf.d %clean [ "%{buildroot}" != / ] && rm -rf %{buildroot} %pre %{_bindir}/getent group %{cmdgrp} >/dev/null || %{_sbindir}/groupadd -r %{cmdgrp} %{_bindir}/getent group %{nsgrp} >/dev/null || %{_sbindir}/groupadd -r %{nsgrp} %{_bindir}/getent passwd %{nsusr} >/dev/null || \ %{_sbindir}/useradd -r -c "Nagios Network Monitoring"\ -d %{_localstatedir}/spool/%{name}\ -s /bin/bash -g %{nsgrp} %{nsusr} >/dev/null 2>&1 exit 0 %preun if [ $1 = 0 ]; then /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} %{_sbindir}/userdel %{nsusr} >/dev/null 2>&1 %{_sbindir}/groupdel %{nsgrp} >/dev/null 2>&1 %{_sbindir}/groupdel %{cmdgrp} >/dev/null 2>&1 fi exit 0 %post if [ $1 -eq 1 ]; then /sbin/chkconfig --add %{name} # add apache user to %{nsgrp} so sending commands to nagios # from the command CGI is possible %{_sbindir}/usermod -G %{nsgrp} apache >/dev/null 2>&1 fi exit 0 %preun www if [ $1 = 0 ]; then [ -e %{_localstatedir}/lock/subsys/httpd ] && /sbin/service httpd reload 2>&1 fi exit 0 %post www if [ $1 -eq 1 ]; then RANDOM_PASSWD=`/usr/bin/mkpasswd -l 10 -s 0 2>/dev/null` %{_bindir}/htpasswd \ -bc %{_sysconfdir}/%{name}/private/htpasswd.users nagiosadmin \ $RANDOM_PASSWD >/dev/null 2>&1 [ -e %{_localstatedir}/lock/subsys/httpd ] && /sbin/service httpd reload fi exit 0 %postun www if [ $1 -ge 1 ]; then /sbin/service httpd condrestart >/dev/null 2>&1 || : fi exit 0 %files %defattr(-,root,root) %{_sbindir}/nagios %{_sbindir}/nagiostats %{_sbindir}/p1.pl %dir %{_sysconfdir}/nagios %dir %{_sysconfdir}/nagios/conf.d %attr(644,root,root) %config(noreplace) %{_sysconfdir}/nagios/*.cfg %dir %{_sysconfdir}/%{name}/objects %attr(644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/objects/*.cfg %dir %{_sysconfdir}/nagios/private %attr(640,root,%{nsgrp}) %config(noreplace) %{_sysconfdir}/nagios/private/resource.cfg %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/%{name} %{_initrddir}/nagios %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/spool/%{name} %attr(2775,%{nsusr},%{nsgrp}) %{_localstatedir}/spool/%{name}/rw %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name} %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name}/archives %{_libdir}/%{name}/eventhandlers %dir %{_datadir}/%{name} %files www %defattr(-,root,root) %dir %{_datadir}/%{name}/html %{_datadir}/%{name}/html/index.php %{_datadir}/%{name}/html/main.php %{_datadir}/%{name}/html/rss-corefeed.php %{_datadir}/%{name}/html/rss-newsfeed.php %{_datadir}/%{name}/html/side.php %config(noreplace) %{_datadir}/%{name}/html/config.inc.php %{_datadir}/%{name}/html/*.txt %{_datadir}/%{name}/html/contexthelp %dir %{_datadir}/%{name}/html/images %{_datadir}/%{name}/html/images/*.gif %{_datadir}/%{name}/html/images/*.ico %{_datadir}/%{name}/html/images/*.jpg %{_datadir}/%{name}/html/images/[^s]*.png %{_datadir}/%{name}/html/images/sflogo.png %config(noreplace) %{_datadir}/%{name}/html/images/sblogo.png %{_datadir}/%{name}/html/images/logos %{_datadir}/%{name}/html/includes %{_datadir}/%{name}/html/js %{_datadir}/%{name}/html/stylesheets %dir %{_libdir}/nagios/cgi-bin %{_libdir}/nagios/cgi-bin/* %config(noreplace) %{_sysconfdir}/httpd/httpd.d/nagios.conf %attr(0640,root,%{nsgrp}) %config(noreplace) %{_sysconfdir}/%{name}/private/htpasswd.users %files devel %defattr(-,root,root) %dir %{_includedir}/nagios %{_includedir}/nagios/*.h %changelog * Wed May 07 2014 Silvan Calarco 3.5.1-2mamba - require nagios-plugins - change lock file location from /var/run to /run - configure by default to use /etc/nagios/conf.d directory * Fri Aug 30 2013 Automatic Build System 3.5.1-1mamba - automatic update by autodist * Fri Mar 15 2013 Automatic Build System 3.5.0-1mamba - automatic version update by autodist * Sun Jan 20 2013 Automatic Build System 3.4.4-1mamba - automatic version update by autodist * Sat Dec 15 2012 Davide Madrisan 3.4.3-1mamba - update to 3.4.3 - enable embedded perl by default - update apache configuration - do not replace %{_datadir}/%{name}/html/images/sblogo.png while updating nagios * Wed Nov 03 2010 Automatic Build System 3.2.3-1mamba - automatic update by autodist * Wed May 12 2010 Automatic Build System 3.2.1-1mamba - automatic update by autodist * Wed Aug 19 2009 Automatic Build System 3.2.0-1mamba - automatic update by autodist * Mon Jul 13 2009 Automatic Build System 3.1.2-1mamba - automatic update by autodist * Mon Mar 02 2009 Silvan Calarco 3.1.0-1mamba - automatic update by autodist * Wed Dec 24 2008 Silvan Calarco 3.0.6-1mamba - automatic update by autodist * Fri Oct 24 2008 gil 3.0.4-1mamba - update to 3.0.4 * Tue Oct 11 2005 Davide Madrisan 1.2-7qilnx - remove exec permissions from /etc/httpd/nagios.conf * Wed Dec 15 2004 Davide Madrisan 1.2-6qilnx - do create the directory /var/log/nagios/archives needed to backup logs * Tue Jul 13 2004 Davide Madrisan 1.2-5qilnx - added support for the nrpe extra plugin * Wed Jul 07 2004 Davide Madrisan 1.2-4qilnx - added some default entries in the services.cfg file - added support for hosts and services icons * Tue Jul 06 2004 Davide Madrisan 1.2-3qilnx - fixed paths in the eventhandlers scripts * Fri Jul 02 2004 Davide Madrisan 1.2-2qilnx - specfile fixes - added nagios-1.2-daemon_init patch * Tue Jun 29 2004 Davide Madrisan 1.2-1qilnx - first build