405 lines
13 KiB
RPMSpec
405 lines
13 KiB
RPMSpec
%define nsusr nagios
|
|
%define nsgrp nagios
|
|
%define cmdgrp nagioscmd
|
|
|
|
Name: nagios
|
|
Version: 4.4.14
|
|
Release: 2mamba
|
|
Summary: An Open Source host, service and network monitoring program
|
|
Group: Network/Monitoring
|
|
Vendor: openmamba
|
|
Distribution: openmamba
|
|
Packager: Davide Madrisan <davide.madrisan@gmail.com>
|
|
URL: https://www.nagios.org/
|
|
Source0: http://downloads.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz
|
|
Source1: nagios.htaccess
|
|
Source2: nagios.service
|
|
Source3: nagios-nginx.conf
|
|
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: libopenssl-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}
|
|
|
|
%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
|
|
%patch 2 -p1
|
|
%patch 3 -p1
|
|
#%patch4 -p1
|
|
%patch 5 -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-initdir=%{_unitdir} \
|
|
--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
|
|
|
|
mv %{buildroot}%{_sysconfdir}/httpd/httpd.d/nagios.conf{,.example}
|
|
|
|
# install nginx sample site configuration
|
|
install -D -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/nginx/sites-available/nagios.conf.example
|
|
|
|
%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 {} \;
|
|
:
|
|
|
|
%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
|
|
:
|
|
|
|
%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)
|
|
%{_sysconfdir}/httpd/httpd.d/nagios.conf.example
|
|
%{_sysconfdir}/nginx/sites-available/nagios.conf.example
|
|
%attr(0640,root,%{nsgrp}) %config(noreplace) %{_sysconfdir}/%{name}/private/htpasswd.users
|
|
%dir %{_datadir}/%{name}/html
|
|
%{_datadir}/%{name}/html/*
|
|
%dir %{_libdir}/nagios/cgi-bin
|
|
%{_libdir}/nagios/cgi-bin/*
|
|
|
|
%files devel
|
|
%defattr(-,root,root)
|
|
%dir %{_includedir}/nagios
|
|
%{_includedir}/nagios/*.h
|
|
%dir %{_includedir}/nagios/lib
|
|
%{_includedir}/nagios/lib/*.h
|
|
%{_libdir}/nagios/libnagios.a
|
|
|
|
%changelog
|
|
* Sat Aug 12 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 4.4.14-2mamba
|
|
- remove requirements for apache, added configuration for nginx
|
|
|
|
* Wed Aug 02 2023 Automatic Build System <autodist@mambasoft.it> 4.4.14-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Fri Jun 02 2023 Automatic Build System <autodist@mambasoft.it> 4.4.13-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Wed May 31 2023 Automatic Build System <autodist@mambasoft.it> 4.4.12-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Sat Apr 15 2023 Automatic Build System <autodist@mambasoft.it> 4.4.11-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Wed Jan 18 2023 Automatic Build System <autodist@mambasoft.it> 4.4.10-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Sat Nov 19 2022 Automatic Build System <autodist@mambasoft.it> 4.4.9-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Wed Oct 05 2022 Automatic Build System <autodist@mambasoft.it> 4.4.8-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Mon Apr 18 2022 Automatic Build System <autodist@mambasoft.it> 4.4.7-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Sun Mar 07 2021 Automatic Build System <autodist@mambasoft.it> 4.4.6-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Sat Nov 18 2017 Automatic Build System <autodist@mambasoft.it> 4.2.4-1mamba
|
|
- automatic update by autodist
|
|
|
|
* Fri Nov 11 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 4.2.2-1mamba
|
|
- update to 4.2.2
|
|
|
|
* Sun Jul 27 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 3.5.1-5mamba
|
|
- other rw permission fix attempt
|
|
|
|
* Sun Jul 27 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 3.5.1-4mamba
|
|
- fix rw dir owner,group to work (apache,nagios)
|
|
|
|
* Tue Jul 22 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 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 <silvan.calarco@mambasoft.it> 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 <autodist@mambasoft.it> 3.5.1-1mamba
|
|
- automatic update by autodist
|
|
|
|
* Fri Mar 15 2013 Automatic Build System <autodist@mambasoft.it> 3.5.0-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Sun Jan 20 2013 Automatic Build System <autodist@mambasoft.it> 3.4.4-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Sat Dec 15 2012 Davide Madrisan <davide.madrisan@gmail.com> 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 <autodist@mambasoft.it> 3.2.3-1mamba
|
|
- automatic update by autodist
|
|
|
|
* Wed May 12 2010 Automatic Build System <autodist@mambasoft.it> 3.2.1-1mamba
|
|
- automatic update by autodist
|
|
|
|
* Wed Aug 19 2009 Automatic Build System <autodist@mambasoft.it> 3.2.0-1mamba
|
|
- automatic update by autodist
|
|
|
|
* Mon Jul 13 2009 Automatic Build System <autodist@mambasoft.it> 3.1.2-1mamba
|
|
- automatic update by autodist
|
|
|
|
* Mon Mar 02 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 3.1.0-1mamba
|
|
- automatic update by autodist
|
|
|
|
* Wed Dec 24 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 3.0.6-1mamba
|
|
- automatic update by autodist
|
|
|
|
* Fri Oct 24 2008 gil <puntogil@libero.it> 3.0.4-1mamba
|
|
- update to 3.0.4
|
|
|
|
* Tue Oct 11 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.2-7qilnx
|
|
- remove exec permissions from /etc/httpd/nagios.conf
|
|
|
|
* Wed Dec 15 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.2-6qilnx
|
|
- do create the directory /var/log/nagios/archives needed to backup logs
|
|
|
|
* Tue Jul 13 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.2-5qilnx
|
|
- added support for the nrpe extra plugin
|
|
|
|
* Wed Jul 07 2004 Davide Madrisan <davide.madrisan@qilinux.it> 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 <davide.madrisan@qilinux.it> 1.2-3qilnx
|
|
- fixed paths in the eventhandlers scripts
|
|
|
|
* Fri Jul 02 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.2-2qilnx
|
|
- specfile fixes
|
|
- added nagios-1.2-daemon_init patch
|
|
|
|
* Tue Jun 29 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.2-1qilnx
|
|
- first build
|