%define nrpe_user nrpe %define nrpe_group nrpe %define nrpeport 5666 %define icinga_uid 64300 %define icinga_gid 64300 %define nrpe_gid 64350 %define nrpe_uid 64350 %define realname nrpe Summary: Icinga monitoring (nrpe client) Name: icinga-%{realname} Version: 3.0.1 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: icinga BuildRequires: openssl-devel >= 1.0.2j-2 Requires: icinga-plugins >= 1.4.14-1 Requires: openssl >= 1.0.2j-2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description Nrpe is a system daemon that will execute various Icinga 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/icinga \ --libexecdir=%{_libdir}/icinga/plugins \ --with-nagios-user=icinga \ --with-nagios-group=icinga \ --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}/icinga/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/icinga cp sample-config/nrpe.cfg ${RPM_BUILD_ROOT}/etc/icinga/ chmod 0644 ${RPM_BUILD_ROOT}/etc/icinga/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 # icinga 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 "icinga" group only if it does not yet exist result=`/usr/sbin/lsgroup icinga | /usr/bin/awk '{ print $1 }' 2>/dev/null` if [[ "${result}" != "icinga" ]] ; then /usr/bin/mkgroup -A id=%{icinga_gid} icinga 2> /dev/null || : fi # add the "icinga" user only if it does not yet exist result=`/usr/sbin/lsuser icinga | /usr/bin/awk '{ print $1 }' 2>/dev/null` if [[ "${result}" != "icinga" ]] ; then /usr/bin/mkuser id=%{icinga_uid} pgrp='icinga' gecos='Icinga User' \ login='false' rlogin='false' icinga 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(-,icinga,icinga,-) %doc Changelog LEGAL README README.SSL SECURITY docs/NRPE.pdf %config(noreplace) /etc/icinga/nrpe.cfg %config(noreplace) /etc/sysconfig/nrpe %attr(755,nrpe,nrpe) %{_sbindir}/nrpe %{_libdir}/icinga/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 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 versions * 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