%define nsusr nagios %define nsgrp nagios %define cmdgrp nagioscmd Name: nagios Version: 4.4.6 Release: 1mamba Summary: An Open Source host, service and network monitoring program Group: Network/Monitoring Vendor: openmamba Distribution: openmamba Packager: Davide Madrisan URL: https://www.nagios.org/ Source0: http://downloads.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz Source1: nagios.htaccess Source2: nagios.service 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}-4.2.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 ## 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 %systemd_requires %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. #% debug_package %prep %setup -q #%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-type=systemd \ --with-inetd-type=systemd \ --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-gd-lib=%{_libdir} \ --with-gd-inc=%{_includedir} \ --with-perlcache \ --with-template-objects \ --with-template-extinfo \ --with-mail=/bin/mailx \ STRIP=/bin/false # --with-command-group=%{cmdgrp} \ %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 %ifarch %{ix86} export ARCH=i686 %else export ARCH=%{_target_cpu} %endif %make all 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} install -d -m0755 %{buildroot}%{_sysconfdir}/httpd/httpd.d make \ DESTDIR=%{buildroot} \ STRIP=/bin/true \ INSTALL_OPTS="" COMMAND_OPTS="" INIT_OPTS="" \ CGIDIR="%{_libdir}/%{name}/cgi-bin" \ CFGDIR="%{_sysconfdir}/%{name}" fullinstall # Install sample config files for f in nagios.cfg cgi.cfg mrtg.cfg; do install -D -m 0644 sample-config/$f %{buildroot}%{_sysconfdir}/%{name}/$f done for f in commands.cfg contacts.cfg localhost.cfg printer.cfg switch.cfg templates.cfg timeperiods.cfg windows.cfg; do install -D -m 0644 sample-config/template-object/$f %{buildroot}%{_sysconfdir}/%{name}/objects/$f done # Private files install -D -m 0644 sample-config/resource.cfg %{buildroot}%{_sysconfdir}/%{name}/private/resource.cfg 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 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 # install service file install -D -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/nagios.service rm -f %{buildroot}%{_initrddir}/nagios %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 : %preun %systemd_preun nagios if [ $1 = 0 ]; then %{_sbindir}/userdel %{nsusr} >/dev/null 2>&1 %{_sbindir}/groupdel %{nsgrp} >/dev/null 2>&1 %{_sbindir}/groupdel %{cmdgrp} >/dev/null 2>&1 fi : %post %systemd_post nagios if [ $1 -eq 1 ]; then %{_sbindir}/usermod -A %{cmdgrp} apache >/dev/null 2>&1 fi : %postun %systemd_postun_with_restart nagios : %posttrans # clean old sysv broken links find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \; : %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 groupmod nagios -A apache systemctl -q reload httpd || : fi exit 0 %postun www if [ $1 -ge 1 ]; then systemctl -q reload httpd || : fi exit 0 %files %defattr(-,root,root) %attr(0755,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 %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} %{_unitdir}/nagios.service %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/spool/%{name} %attr(2771,apache,%{nsgrp}) %{_localstatedir}/spool/%{name}/rw %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name} %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name}/archives %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name}/rw %{_libdir}/%{name}/eventhandlers %dir %{_datadir}/%{name} %files www %defattr(-,root,root) %dir %{_datadir}/%{name}/html %{_datadir}/%{name}/html/* #%config(noreplace) %{_datadir}/%{name}/html/config.inc.php #%config(noreplace) %{_datadir}/%{name}/html/images/sblogo.png %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 %dir %{_includedir}/nagios/lib %{_includedir}/nagios/lib/*.h %{_libdir}/nagios/libnagios.a %changelog * Sun Mar 07 2021 Automatic Build System 4.4.6-1mamba - automatic version update by autodist * Sat Nov 18 2017 Automatic Build System 4.2.4-1mamba - automatic update by autodist * Fri Nov 11 2016 Silvan Calarco 4.2.2-1mamba - update to 4.2.2 * Sun Jul 27 2014 Silvan Calarco 3.5.1-5mamba - other rw permission fix attempt * Sun Jul 27 2014 Silvan Calarco 3.5.1-4mamba - fix rw dir owner,group to work (apache,nagios) * Tue Jul 22 2014 Silvan Calarco 3.5.1-3mamba - provide empty %{_localstatedir}/spool/%{name}/rw/nagios.cmd and set webserver permissions (to dir also) * 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