# Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 1} %define nagios_uid 64320 %define nagios_gid 64320 %define nagioscmd_gid 64321 Summary: Host/service/network monitoring program Name: nagios Version: 4.4.6 Release: 2 License: GPLv2 Group: Applications/System URL: http://www.nagios.org/ Source0: https://github.com/NagiosEnterprises/nagioscore/releases//nagios-%{version}.tar.gz Source2: %{name}.aix.init Patch0: %{name}-%{version}-aix.patch Patch1: %{name}-%{version}-no-long-arguments.patch Patch2: nagios-4.4.6-testcase.patch Patch3: nagios-4.4.6-getopt.patch BuildRequires: patch >= 2.7.6-1 BuildRequires: libgd-devel >= 2.2.5-1 BuildRequires: httpd-devel >= 2.4.38-1 BuildRequires: libtool-ltdl-devel >= 2.4.6-2 BuildRequires: perl >= 5.28.1-1 Requires: httpd >= 2.4.38-1 Requires: libtool-ltdl >= 2.4.6-2 %define logdir /var/log/%{name} %define apacheconfdir %{_sysconfdir}/httpd/conf/extra %define apacheuser apache %define apachegroup apache %description Nagios is a program that will monitor hosts and services on your network. It has the ability to send email or page alerts 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. The plugins are available at http://sourceforge.net/projects/nagiosplug. This package provides the core program, web interface, and documentation files for Nagios. Development files are built as a separate package. %package gui Summary: Web content for %{name} Group: Applications/System Requires: %{name} = %{version}-%{release} Requires: httpd >= 2.4.38-1 Requires: libgd >= 2.2.5-1 Requires: libjpeg >= 9c Requires: libpng >= 1.6.27 %description gui This package contains the webgui (html,css,cgi etc.) for %{name}. %package devel Summary: Provides include files that Nagios-related applications may compile against Group: Applications/System Requires: %{name} = %{version}-%{release} %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 export PATH=/opt/freeware/bin:$PATH %patch0 %patch1 %patch2 %patch3 %build export OBJECT_MODE=64 export PATH=/opt/freeware/bin:$PATH export PERL="/opt/freeware/bin/perl" export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib" export CC="gcc -maix64 -O2" ./configure \ --prefix=%{_prefix} \ --sysconfdir="/etc/%{name}" \ --localstatedir="/var/%{name}" \ --datadir="%{_datadir}/%{name}/html" \ --libdir="%{_libdir}/%{name}" \ --libexecdir="%{_libdir}/%{name}/plugins" \ --sbindir=%{_libdir}/%{name}/cgi \ --enable-nanosleep \ --enable-event-broker \ --enable-embedded-perl \ --enable-ssl \ --with-web-user="%{apacheuser}" \ --with-web-group="%{apachegroup}" \ --with-mail="/usr/bin/mail" \ --with-httpd-conf=%{apacheconfdir} \ --with-checkresult-dir="/var/%{name}/checkresults" \ --with-temp-dir="/tmp" \ --with-log-dir="%{logdir}" \ --with-init-dir="/etc/rc.d/init.d" \ --with-lockfile="/var/run/%{name}/%{name}.pid" \ --with-gd-lib="%{_libdir}" \ --with-gd-inc="%{_includedir}" \ --with-cgiurl="/%{name}/cgi-bin" \ --with-htmurl="/%{name}" \ --with-cgibindir=/opt/freeware/lib/nagios/cgi # need to patch and re-run config.status as our perl (compiled with GCC) # pulls in some GCC compile options that IBM XLC/C++ doesn't like cat config.status | \ sed 's|-pipe||g' | \ sed 's|-fno-strict-aliasing||g' | \ sed 's|-Xlinker||g' > config.tmp mv config.tmp config.status chmod 0755 config.status ./config.status gmake %{?_smp_mflags} all if [ "%{dotests}" == 1 ] then ( gmake -k test || true ) fi %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} export OBJECT_MODE=64 mkdir -p ${RPM_BUILD_ROOT}%{apacheconfdir} mkdir -p ${RPM_BUILD_ROOT}/var/run/nagios gmake install \ install-init \ install-commandmode \ install-config \ install-webconf \ install-devel \ DESTDIR=${RPM_BUILD_ROOT} \ INSTALL_OPTS="" \ INSTALL_OPTS_WEB="" \ COMMAND_OPTS="" \ INIT_OPTS="" /usr/bin/strip -X64 ${RPM_BUILD_ROOT}%{_sbindir}/* || : mkdir -p ${RPM_BUILD_ROOT}/etc/%{name}/conf.d # fix log-paths /opt/freeware/bin/perl -pi -e ' s|log_file.*|log_file=%{logdir}/%{name}.log|; s|log_archive_path=.*|log_archive_path=%{logdir}/archives|; s|debug_file=.*|debug_file=%{logdir}/%{name}.debug|; ' ${RPM_BUILD_ROOT}/etc/%{name}/%{name}.cfg # make logdirs mkdir -p ${RPM_BUILD_ROOT}%{logdir}/archives mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/init.d mv ${RPM_BUILD_ROOT}/etc/init.d/%{name} ${RPM_BUILD_ROOT}/etc/rc.d/init.d/%{name} chmod 0755 ${RPM_BUILD_ROOT}/etc/rc.d/init.d/%{name} mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/ mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/ ln -sf '../init.d/nagios' ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/S%{name} ln -sf '../init.d/nagios' ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/K%{name} ln -sf '../init.d/nagios' ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/S%{name} ln -sf '../init.d/nagios' ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/K%{name} %pre # add the "nagios" group only if it does not yet exist result=`/usr/sbin/lsgroup nagios | /usr/bin/awk '{ print $1 }' 2>/dev/null` if [[ "${result}" != "nagios" ]] ; then /usr/bin/mkgroup -A id=%{nagios_gid} nagios 2> /dev/null || : fi # add the "nagiscmd" group only if it does not yet exist result=`/usr/sbin/lsgroup nagiscmd | /usr/bin/awk '{ print $1 }' 2>/dev/null` if [[ "${result}" != "nagiscmd" ]] ; then /usr/bin/mkgroup -A id=%{nagioscmd_gid} nagiscmd 2> /dev/null || : fi # add the "nagios" user only if it does not yet exist result=`/usr/sbin/lsuser nagios | /usr/bin/awk '{ print $1 }' 2>/dev/null` if [[ "${result}" != "nagios" ]] ; then /usr/bin/mkuser id=%{nagios_uid} pgrp='nagios' groups='nagiscmd' \ home='/var/nagios' gecos='Nagios User' \ login='false' rlogin='false' nagios 2> /dev/null || : fi %preun if [ $1 -eq 0 ]; then /etc/rc.d/init.d/%{name} stop &>/dev/null || : fi %postun if [ "$1" = "0" ]; then # remove "nagios" user and "nagios" and "nagiscmd" groups /usr/sbin/rmuser -p nagios || : /usr/sbin/rmgroup nagios || : /usr/sbin/rmgroup nagiscmd || : fi %pre gui # add apacheuser to the nagiscmd group /usr/bin/chuser groups='nagiscmd' %{apacheuser} %preun gui if [ "$1" = 0 ]; then cat %{_sysconfdir}/httpd/conf/httpd.conf | \ grep -v "# Icinga settings" | \ grep -v "Include conf/extra/%{name}.conf" \ > %{_sysconfdir}/httpd/conf/tmp_httpd.conf mv -f %{_sysconfdir}/httpd/conf/tmp_httpd.conf %{_sysconfdir}/httpd/conf/httpd.conf echo "Please restart your web server using: '/opt/freeware/sbin/apachectl restart'" fi %post gui cat %{_sysconfdir}/httpd/conf/httpd.conf | \ grep -v "# Icinga settings" | \ grep -v "Include conf/extra/%{name}.conf" \ > %{_sysconfdir}/httpd/conf/tmp_httpd.conf mv -f %{_sysconfdir}/httpd/conf/tmp_httpd.conf %{_sysconfdir}/httpd/conf/httpd.conf echo "# Icinga settings" >> %{_sysconfdir}/httpd/conf/httpd.conf echo "Include conf/extra/nagios.conf" >> %{_sysconfdir}/httpd/conf/httpd.conf echo "Please restart your web server using: '/opt/freeware/sbin/apachectl restart'" %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,nagios,nagios,-) %attr(755,root,system) /etc/rc.d/init.d/%{name} /etc/rc.d/rc2.d/S%{name} /etc/rc.d/rc2.d/K%{name} /etc/rc.d/rc3.d/S%{name} /etc/rc.d/rc3.d/K%{name} %dir /etc/%{name} %dir /etc/%{name}/conf.d %config(noreplace) /etc/%{name}/nagios.cfg %dir /etc/%{name}/objects %config(noreplace) /etc/%{name}/objects/commands.cfg %config(noreplace) /etc/%{name}/objects/contacts.cfg %config(noreplace) /etc/%{name}/objects/localhost.cfg %config(noreplace) /etc/%{name}/objects/printer.cfg %config(noreplace) /etc/%{name}/objects/switch.cfg %config(noreplace) /etc/%{name}/objects/templates.cfg %config(noreplace) /etc/%{name}/objects/timeperiods.cfg %config(noreplace) /etc/%{name}/objects/windows.cfg %config(noreplace) /etc/%{name}/resource.cfg %{_bindir}/nagios %{_bindir}/nagiostats %dir %{_libdir}/%{name} %dir %{_libdir}/%{name}/plugins %dir /var/%{name} %attr(2755,nagios,nagiscmd) %dir /var/%{name}/checkresults %attr(2755,nagios,nagiscmd) /var/%{name}/rw %dir %{logdir} %dir %{logdir}/archives %dir %attr(755,root,system) /var/run/nagios %files gui %defattr(-,nagios,nagios,-) %config(noreplace) %attr(-,root,system) %{apacheconfdir}/%{name}.conf %config(noreplace) /etc/%{name}/cgi.cfg %dir %{_libdir}/%{name}/cgi %{_libdir}/%{name}/cgi/* %{_datadir}/%{name} %files devel %defattr(-,nagios,nagios,-) %{_includedir}/%{name} %attr(0644,root,system) %{_libdir}/%{name}/libnagios.a %changelog * Thu Dec 02 2021 Reshma V Kumar - 4.4.6-2 - Rebuild to fix issues with nagios server * Thu Dec 10 2020 Reshma V Kumar - 4.4.6-1 - Update to 4.4.6 * Mon May 13 2019 Harshita Jain - 4.4.3-1 - Initial port to Aix tolbox * Wed Sep 12 2018 Michael Perzl - 4.4.2-1 - updated to version 4.4.2 * Wed Sep 12 2018 Michael Perzl - 4.4.1-1 - updated to version 4.4.1 * Wed Sep 12 2018 Michael Perzl - 4.4.0-1 - updated to version 4.4.0 - removed the doc package, add it to the main package - include the doxygen generated documentation to the main package - added the devel package, removed the doc package * Wed Sep 12 2018 Michael Perzl - 4.3.4-1 - updated to version 4.3.4 * Thu Jul 27 2017 Michael Perzl - 4.3.2-1 - updated to version 4.3.2 * Mon Mar 27 2017 Michael Perzl - 4.3.1-1 - updated to version 4.3.1 * Mon Jan 02 2017 Michael Perzl - 4.2.4-1 - updated to version 4.2.4 * Wed Dec 07 2016 Michael Perzl - 4.2.3-1 - updated to version 4.2.3 * Thu Oct 06 2016 Michael Perzl - 4.2.1-1 - updated to version 4.2.1 * Wed Aug 25 2015 Michael Perzl - 4.1.1-1 - updated to version 4.1.1 * Wed Aug 25 2015 Michael Perzl - 4.0.8-2 - added fix for no long arguments in worker.c as they are not available on AIX * Mon Aug 25 2014 Michael Perzl - 4.0.8-1 - updated to version 4.0.8 * Mon Aug 25 2014 Michael Perzl - 4.0.7-1 - updated to version 4.0.7 * Mon Aug 25 2014 Michael Perzl - 4.0.6-1 - updated to version 4.0.6 * Mon Aug 25 2014 Michael Perzl - 4.0.5-1 - updated to version 4.0.5 * Mon Aug 25 2014 Michael Perzl - 4.0.4-1 - updated to version 4.0.4 * Mon Aug 25 2014 Michael Perzl - 4.0.3-1 - updated to version 4.0.3 * Thu Feb 13 2014 Michael Perzl - 4.0.2-1 - updated to version 4.0.2 * Thu Feb 13 2014 Michael Perzl - 3.5.1-1 - updated to version 3.5.1 * Thu Feb 13 2014 Michael Perzl - 3.4.4-1 - updated to version 3.4.4 * Thu Feb 13 2014 Michael Perzl - 3.3.1-1 - updated to version 3.3.1 * Thu Feb 13 2014 Michael Perzl - 3.2.3-1 - first version for AIX V5.1 and higher