%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_on() /sbin/chkconfig %1 on ; %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: nagios-server-addons Version: 0.2.3 Release: 1%{?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 BuildArch: noarch #BuildRequires: pyflakes #BuildRequires: python-pep8 BuildRequires: python-mock BuildRequires: python-inotify BuildRequires: python-netaddr BuildRequires: libselinux-python BuildRequires: python-nose BuildRequires: python-devel BuildRequires: python-argparse BuildRequires: python-ethtool BuildRequires: gluster-nagios-common BuildRequires: pynag %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 >= 0.2.0 Requires: httpd Requires: mod_ssl Requires: nagios Requires: nagios-plugins-dummy Requires: nagios-plugins-nrpe Requires: nagios-plugins-ping Requires: nsca 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 Requires: pynag Requires: net-snmp-utils Requires(post): selinux-policy-targeted >= 3.7.19-279 Requires(post): policycoreutils Requires(post): libselinux-utils %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} install -d "%{buildroot}%{_bindir}" ln -sf "%{_libdir}/nagios/plugins/gluster/discovery.py" "%{buildroot}%{_bindir}/configure-gluster-nagios" %clean rm -rf %{buildroot} %pre if [ $1 -gt 1 ] ; then if ! grep -q "RRD_STORAGE_TYPE = MULTIPLE" %{_sysconfdir}/pnp4nagios/check_commands/check_brick_usage.cfg ; then echo "y" | su -c '%{_libexecdir}/pnp4nagios/rrd_convert.pl --cfg_dir=%{_sysconfdir}/pnp4nagios --check_command=check_brick_usage' -s '/bin/bash' nagios 1> /dev/null fi fi %post NagiosCFGFile="/etc/nagios/nagios.cfg" sed -i '/etc\/nagios\/objects\/localhost.cfg/d' $NagiosCFGFile if getsebool nagios_run_sudo &>/dev/null; then setsebool -P nagios_run_sudo 1 &> /dev/null || : fi LocalhostCfgFile="%{_sysconfdir}/nagios/gluster/default/temp_node1.cfg" LocalhostCfgFileEdited="%{_sysconfdir}/nagios/gluster/default/temp_node1.cfg.sample" if [ -f $LocalhostCfgFileEdited ]; then sed -i '/host_name * temp_node1/a \ register 0' $LocalhostCfgFile rm $LocalhostCfgFileEdited fi 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 NagiosConfFile=/etc/httpd/conf.d/nagios.conf if grep -q "#.*SSLRequireSSL" $NagiosConfFile; then sed -i -e 's/#.*SSLRequireSSL/ SSLRequireSSL/g' $NagiosConfFile fi cat > /etc/httpd/conf.d/glusternagios.conf << EOF RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^/nagios|^/pnp4nagios https://%{HTTP_HOST}%{REQUEST_URI} EOF if ! grep -q "#rhs performance monitoring" $NagiosCFGFile; then cat >> $NagiosCFGFile <> $CommandFile <> $CommandFile </dev/null; then setsebool -P nagios_run_sudo 0 &> /dev/null || : fi fi %files %defattr(-,root,root,-) %{_datadir}/nagios/html/pnp4nagios/templates.dist/check_cpu_multicore.php %{_datadir}/nagios/html/pnp4nagios/templates.dist/check_disk_and_inode.php %{_datadir}/nagios/html/pnp4nagios/templates.dist/check_interfaces.php %{_datadir}/nagios/html/pnp4nagios/templates.dist/check_memory.php %{_datadir}/nagios/html/pnp4nagios/templates.dist/check_swap_usage.php %{_datadir}/nagios/html/pnp4nagios/templates.dist/check_vol_utilization.php %{_datadir}/nagios/html/pnp4nagios/templates.dist/check_brick_usage.php %{_datadir}/nagios/html/pnp4nagios/templates.dist/check_cluster_vol_usage.php %attr(0755, -, -) %{_libdir}/nagios/plugins/gluster/* %attr(0775, root, nagios) %dir %{_sysconfdir}/nagios/gluster %config(noreplace) %attr(-, root, nagios) %{_sysconfdir}/nagios/gluster/snmpmanagers.conf %config(noreplace) %{_sysconfdir}/nagios/gluster/* %{_sysconfdir}/sudoers.d/nagios %{_sysconfdir}/pnp4nagios/check_commands/check_brick_usage.cfg %{_sysconfdir}/pnp4nagios/check_commands/check_disk_and_inode.cfg %{_sysconfdir}/pnp4nagios/check_commands/check_interfaces.cfg /usr/share/snmp/mibs/* %{_bindir}/configure-gluster-nagios %files tests %defattr(-,root,root,-) %{_datadir}/%{name}/tests/* %changelog * Mon Dec 07 2015 Sahina Bose - 0.2.3-1 - Resolves: rhbz#1284874 - correct quorum status flapping * Mon Aug 17 2015 Ramesh Nachimuthu - 0.2.2-1 - Resolves: rhbz#1235651 - correct volume status for disperse volumes * Mon Jul 6 2015 Ramesh Nachimuthu - 0.2.1-4 - Resolves: rhbz#1240242 - set dependency on selinux packages * Sat Jun 27 2015 Ramesh Nachimuthu - 0.2.1-3 - Resolves: rhbz#1223710 - reset sebool variables only during uninstall * Sat Jun 13 2015 Ramesh Nachimuthu - v0.2.1-2 - Resolves: rhbz#1223710 * Mon Jun 1 2015 Ramesh Nachimuthu - v0.2.1-1 - Resolves: rhbz#1106421 1221872 1219339 * Tue May 19 2015 Ramesh Nachimuthu - v0.2.0-1 - Resolves: rhbz#1127657 - validate the nagios server address in auto-config * Thu Feb 26 2015 Ramesh Nachimuthu - v0.1.14-1 - fix bug bz#1167771 * Thu Feb 19 2015 Ramesh Nachimuthu - v0.1.13-1 - fix bug bz#1167771 * Fri Feb 13 2015 Ramesh Nachimuthu - v0.1.12-1 - fix bug bz#1164682 * Wed Dec 3 2014 Ramesh Nachimuthu - v0.1.11-1 - fix bug bz#1109752 * Thu Nov 27 2014 Ramesh Nachimuthu - v0.1.10-1 - fix bugs bz#1143995 1109752 * Tue Nov 18 2014 Ramesh Nachimuthu - v0.1.9-1 - fix bugs bz#1136205 1109843 1119233 1143995 1162446 1162443 1115387 1128007 * Fri Oct 31 2014 Ramesh Nachimuthu - v0.1.8-1 - fix bugs bz#1115387 1112201 1139228 * Thu Oct 16 2014 Ramesh Nachimuthu - v0.1.7-1 - fix bugs bz#1109843 bz#1136205 bz#1138943 bz#1108569 bz#1115392 - bz#1109723 * Mon Aug 18 2014 Kanagaraj Mayilsamy - 0.1.6-1 - Fixed bz#1128154 * Tue Jul 1 2014 Sahina Bose - 0.1.5-1 - Fixed BZ#1112161 * Sun Jun 22 2014 Kanagaraj Mayilsamy - 0.1.4-2 - Added BuildArch: noarch * Mon Jun 16 2014 Kanagaraj Mayilsamy - 0.1.4-1 - fix bugs bz#1087837 bz#1109025 * Fri Jun 13 2014 Sahina Bose - 0.1.3-3 - Bumped up dependency on nagios-commons to 0.1.3 * Thu Jun 12 2014 Kanagaraj Mayilsamy - v0.1.3-2 - fix bugs bz#1080449 * Thu Jun 12 2014 Kanagaraj Mayilsamy - v0.1.3-1 - fix bugs bz#1107998 * Sun Jun 08 2014 Kanagaraj Mayilsamy - v0.1.2-1 - fix bugs bz#1102506 bz#1091236 bz#1096169 bz#1085291 * Fri May 30 2014 Kanagaraj Mayilsamy - v0.1.1-2 - added dependency for mod_ssl * Fri May 30 2014 Kanagaraj Mayilsamy - v0.1.1-1 - fix bugs bz#1101214 bz#1096730 bz#1099093 bz#1099328 bz#1101211 * Wed May 21 2014 Kanagaraj Mayilsamy - v0.1.0-82.git77df8ca - fix an issue in auto-config * Tue May 20 2014 Kanagaraj Mayilsamy - v0.1.0-81.git38421f7 - fix bugs bz#1097193 bz#1098468 * Thu May 15 2014 Kanagaraj Mayilsamy - v0.1.0-75.git2efd1bf - fixes bugs bz#1095427 bz#1089670 bz#1089641 * Thu May 08 2014 Kanagaraj Mayilsamy - v0.1.0-72.git9605a7b - new build based on commit 9605a7b * Thu May 08 2014 Kanagaraj Mayilsamy - v0.1.0-71.git66d287 - new build based on commit 66d287 * Thu May 08 2014 Kanagaraj Mayilsamy - v0.1.0-70.gitf36d2b6 - new build based on commit f36d2b6 * Wed May 07 2014 Kanagaraj Mayilsamy - v0.1.0-69.gitc37d941 - new build based on commit c37d941 * Tue May 06 2014 Kanagaraj Mayilsamy - v0.1.0-68.git704ee1b - new build based on commit 704ee1b * Sat Mar 08 2014 Bala FA - Initial build.