%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: 4.0.3 Release: 1 License: GPL Group: Applications Source0: %{realname}-%{version}.tar.gz Source1: %{name}.aix.init Source2: %{realname}.sysconfig Patch0: %{name}-%{version}-aix.patch URL: http://nagiosplugins.org/download BuildRequires: dos2unix BuildRequires: nagios BuildRequires: openssl-devel >= 1.0.2u-1 Requires: nagios-plugins >= 2.2.1-1 Requires: openssl >= 1.0.2u-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} cd src && dos2unix *.c cd ../include && dos2unix *.h cd .. %patch0 %build export CC="cc_r -qcpluscmt" ./configure \ --prefix=%{_prefix} \ --bindir=%{_sbindir} \ --sysconfdir=/etc/nagios \ --libexecdir=%{_libdir}/nagios/plugins \ --with-opsys=aix \ --with-piddir=/var/run/%{name} \ --with-nagios-user=nagios \ --with-nagios-group=nagios \ --with-nrpe-port=%{nrpeport}\ --with-nrpe-user=%{nrpe_user} \ --with-nrpe-group=%{nrpe_group} \ --enable-command-args \ --enable-ssl \ --with-ssl=%{_prefix} \ --with-ssl-lib=%{_libdir} \ --with-kerberos-inc=%{_includedir} make all %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} make install DESTDIR=${RPM_BUILD_ROOT} /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/nrpe chown nrpe.nrpe ${RPM_BUILD_ROOT}/var/run/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" -ge "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,nrpe,nrpe) %{_sbindir}/nrpe %{_libdir}/nagios/plugins/check_nrpe %dir %attr(755,nrpe,nrpe) /var/run/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 * Wed Jun 03 2020 Michael Perzl - 4.0.3-1 - updated to version 4.0.3 * Wed Jun 03 2020 Michael Perzl - 4.0.2-1 - updated to version 4.0.2 * Wed Jun 03 2020 Michael Perzl - 4.0.0-1 - updated to version 4.0.0 * 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