# Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 1} %define nrpe_user nrpe %define nrpe_group nrpe %define nrpeport 5666 %define nagios_gid 64320 %define nagios_uid 64320 %define nrpe_gid 64350 %define nrpe_uid 64350 %define realname nrpe Summary: Nagios monitoring (nrpe client) Name: nagios-%{realname} Version: 3.2.1 Release: 1 License: GPL Group: Applications Source0: %{realname}-%{version}.tar.gz Source1: %{name}.aix.init Source2: %{realname}.sysconfig Patch0: %{name}-%{version}-aix.patch Patch1: nrpe.patch URL: http://nagiosplugins.org/download BuildRequires: nagios Requires: nagios-plugins >= 2.2.1-1 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description Nrpe is a system daemon that will execute various Nagios plugins locally on behalf of a remote (monitoring) host that uses the check_nrpe plugin. Various plugins that can be executed by the daemon are available at: http://sourceforge.net/projects/nagiosplug %prep %setup -q -n %{realname}-%{version} %patch0 %patch1 %build export CC="gcc -maix64 -O2" ./configure \ --prefix=%{_prefix} \ --bindir=%{_sbindir} \ --sbindir=%{_sbindir} \ --sysconfdir=/etc/nagios \ --libexecdir=%{_libdir}/nagios/plugins \ --with-opsys=aix \ --with-piddir=/var/run/%{name} \ --enable-command-args \ --enable-ssl \ --with-kerberos-inc=%{_includedir} gmake all if [ "%{dotests}" == 1 ] then (gmake -k check || true) fi %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} gmake install DESTDIR=${RPM_BUILD_ROOT} export OBJECT_MODE=64 /usr/bin/strip ${RPM_BUILD_ROOT}%{_sbindir}/* || : /usr/bin/strip ${RPM_BUILD_ROOT}%{_libdir}/nagios/plugins/* || : # create the /etc/rc.d/init.d/ script and symlinks mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/init.d/ cp %{SOURCE1} ${RPM_BUILD_ROOT}/etc/rc.d/init.d/nrpe chmod 0755 ${RPM_BUILD_ROOT}/etc/rc.d/init.d/nrpe mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/ mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/ ln -sf '../init.d/nrpe' ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/Snrpe ln -sf '../init.d/nrpe' ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/Knrpe ln -sf '../init.d/nrpe' ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/Snrpe ln -sf '../init.d/nrpe' ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/Knrpe mkdir -p ${RPM_BUILD_ROOT}/var/run/nagios-nrpe mkdir -p ${RPM_BUILD_ROOT}/etc/nagios cp sample-config/nrpe.cfg ${RPM_BUILD_ROOT}/etc/nagios/ chmod 0644 ${RPM_BUILD_ROOT}/etc/nagios/nrpe.cfg mkdir -p ${RPM_BUILD_ROOT}/etc/sysconfig cp %{SOURCE2} ${RPM_BUILD_ROOT}/etc/sysconfig/nrpe chmod 0644 ${RPM_BUILD_ROOT}/etc/sysconfig/nrpe %pre # check if the port for nrpe is already defined in /etc/services if /usr/bin/grep -q %{nrpeport} /etc/services ; then : OK - port already defined else echo "nrpe %{nrpeport}/tcp # nagios nrpe" >> /etc/services fi # add the "nrpe" group only if it does not yet exist result=`/usr/sbin/lsgroup nrpe | /usr/bin/awk '{ print $1 }' 2>/dev/null` if [[ "${result}" != "nrpe" ]] ; then /usr/bin/mkgroup -A id=%{nrpe_gid} nrpe 2> /dev/null || : fi # add the "nrpe" user only if it does not yet exist result=`/usr/sbin/lsuser nrpe | /usr/bin/awk '{ print $1 }' 2>/dev/null` if [[ "${result}" != "nrpe" ]] ; then /usr/bin/mkuser id=%{nrpe_uid} pgrp='nrpe' gecos='NRPE User' \ login='false' rlogin='false' nrpe 2> /dev/null || : fi # 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 "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' gecos='Nagios User' \ login='false' rlogin='false' nagios 2> /dev/null || : fi %preun if [ $1 = 0 ]; then /etc/rc.d/init.d/nrpe stop > /dev/null 2>&1 || : # remove "nrpe" user and group /usr/sbin/rmuser -p nrpe || : /usr/sbin/rmgroup nrpe || : fi %postun if [ "$1" = "1" ]; then /etc/rc.d/init.d/nrpe condrestart > /dev/null 2>&1 || : fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,nagios,nagios,-) %doc CHANGELOG.md LEGAL README.md README.SSL.md SECURITY.md docs/NRPE.pdf %config(noreplace) /etc/nagios/nrpe.cfg %config(noreplace) /etc/sysconfig/nrpe %attr(755,root,system) %{_sbindir}/nrpe %{_libdir}/nagios/plugins/check_nrpe %dir %attr(755,root,system) /var/run/nagios-nrpe /etc/rc.d/init.d/nrpe /etc/rc.d/rc2.d/Snrpe /etc/rc.d/rc2.d/Knrpe /etc/rc.d/rc3.d/Snrpe /etc/rc.d/rc3.d/Knrpe %changelog * Fri May 17 2019 Harshita Jain - 3.2.1-1 - Initial port to AIX toolbox. * Tue Oct 17 2017 Michael Perzl - 3.2.1-1 - updated to version 3.2.1 * Thu Jul 27 2017 Michael Perzl - 3.2.0-1 - updated to version 3.2.0 * Thu Jul 27 2017 Michael Perzl - 3.1.1-1 - updated to version 3.1.1 * Thu Jul 27 2017 Michael Perzl - 3.1.0-1 - updated to version 3.1.0 * Wed Dec 07 2016 Michael Perzl - 3.0.1-1 - updated to version 3.0.1 * Wed Nov 16 2016 Michael Perzl - 2.15-3 - recompiled against latest versions * Fri Mar 04 2016 Michael Perzl - 2.15-2 - recompiled against latest version of openssl * Tue Nov 19 2013 Michael Perzl - 2.15-1 - updated to version 2.15 * Tue Jul 23 2013 Michael Perzl - 2.14-1 - updated to version 2.14 * Thu Jun 20 2013 Michael Perzl - 2.13-1 - updated to version 2.13 * Thu Jun 20 2013 Michael Perzl - 2.12-1 - first version for AIX5L V5.1 and higher