%global _hardened_build 1 %global _for_fedora_koji_builds 0 %if ( 0%{?fedora} && 0%{?fedora} > 16 ) || ( 0%{?rhel} && 0%{?rhel} > 6 ) %global _with_systemd true %endif %if ( 0%{?fedora} && 0%{?fedora} > 17 ) || ( 0%{?rhel} && 0%{?rhel} > 6 ) %global _with_firewalld true %endif # From https://fedoraproject.org/wiki/Packaging:Python#Macros %if ( 0%{?rhel} && 0%{?rhel} <= 5 ) %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif %if ( 0%{?_with_systemd:1} ) %define _init_enable() /bin/systemctl enable %1.service ; %define _init_disable() /bin/systemctl disable %1.service ; %define _init_restart() /bin/systemctl restart %1.service ; %define _init_try_restart() /bin/systemctl try-restart %1.service ; %define _init_stop() /bin/systemctl stop %1.service ; %define _init_install() install -D -p -m 0644 %1 %{buildroot}%{_unitdir}/%2.service ; %else %define _init_enable() /sbin/chkconfig --add %1 ; %define _init_disable() /sbin/chkconfig --del %1 ; %define _init_restart() /sbin/service %1 restart &>/dev/null ; %define _init_try_restart() /sbin/service %1 condrestart &>/dev/null ; %define _init_stop() /sbin/service %1 stop &>/dev/null ; %define _init_install() install -D -p -m 0755 %1 %{buildroot}%{_sysconfdir}/init.d/%2 ; %endif Summary: Gluster node management add-ons for Nagios Name: @PACKAGE_NAME@ Version: @PACKAGE_VERSION@ Release: @PACKAGE_RELEASE@%{?dist} License: GPLv2+ Group: Applications/System URL: http://www.redhat.com Vendor: Red Hat, Inc. Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: pyflakes BuildRequires: python-pep8 BuildRequires: python-mock BuildRequires: python-nose BuildRequires: python-devel %if ( 0%{?_with_systemd:1} ) BuildRequires: systemd-units Requires(post): systemd-units %else Requires(post): /sbin/service Requires(post): /sbin/chkconfig %endif %if ( 0%{?_with_firewalld:1} ) Requires(post): firewalld %else Requires(post): iptables %endif Requires: check-mk-livestatus Requires: gluster-nagios-common Requires: httpd Requires: nagios Requires: nagios-plugins-nrpe Requires: php Requires: pnp4nagios Requires: python-argparse Requires: python-ethtool Requires: python-netaddr Requires: python-pthreading Requires: python-inotify Requires: libselinux-python Requires: rrdtool-perl %description Nagios plugin, scripts, configuration files etc for gluster nodes. %package tests Summary: Unit/functional tests of Gluster node management add-ons for Nagios Group: Development/Tools Requires: %{name} = %{version}-%{release} Requires: pyflakes Requires: python-pep8 Requires: python-mock Requires: python-nose Requires: python-devel %description tests Unit/functional tests for Nagios plugin, scripts, configuration files etc for gluster nodes. %prep %setup -q %build %{configure} make %check make check %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} %clean rm -rf %{buildroot} %post NagiosCFGFile="/etc/nagios/nagios.cfg" sed -i '/etc\/nagios\/objects\/localhost.cfg/d' $NagiosCFGFile if grep -q "#process_performance_data=0" $NagiosCFGFile; then sed -i -e 's/#process_performance_data=0/process_performance_data=1/g' $NagiosCFGFile elif grep -q "process_performance_data=0" $NagiosCFGFile ; then sed -i -e 's/process_performance_data=0/process_performance_data=1/g' $NagiosCFGFile fi if grep -q "#enable_environment_macros=0" $NagiosCFGFile; then sed -i -e 's/#enable_environment_macros=0/enable_environment_macros=1/g' $NagiosCFGFile elif grep -q "process_performance_data=0" $NagiosCFGFile ; then sed -i -e 's/enable_environment_macros=0/enable_environment_macros=1/g' $NagiosCFGFile fi if ! grep -q "#rhs performance monitoring" $NagiosCFGFile; then cat >> $NagiosCFGFile <> $CommandFile <> $CommandFile < - Initial build.