summaryrefslogtreecommitdiffstats
path: root/gluster-nagios-addons.spec.in
diff options
context:
space:
mode:
authorRamesh Nachimuthu <rnachimu@redhat.com>2014-05-19 14:18:47 +0530
committerBala FA <barumuga@redhat.com>2014-05-20 02:45:54 -0700
commit5de7981e12ffa5b0dc5efbb951cbd0311a0cd7ad (patch)
tree6e321d090b8fdaf135ca2d26d8e00c62ca5c1bea /gluster-nagios-addons.spec.in
parent1ced2460f3b3ee3e9af2101b8358be50f282a025 (diff)
nagios-addons: fix issue during upgrade of nagios-addons
Updating gluster-nagios-addons removes few NRPE commands in the nrpe.cfg. Its because of the way how upgrade works. Normally upgrade works by installing the latest rpms first and then un-installing the older version. So during upgarde we should not delete any configuration. Only during un-installation all the NRPE commands should be deleted. Bug-Url: https://bugzilla.redhat.com/1098393 Change-Id: I4f9f256ad0f7aec5ef85dc42976a7da5fe9799cd Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/7795 Reviewed-by: Bala FA <barumuga@redhat.com>
Diffstat (limited to 'gluster-nagios-addons.spec.in')
-rw-r--r--gluster-nagios-addons.spec.in25
1 files changed, 13 insertions, 12 deletions
diff --git a/gluster-nagios-addons.spec.in b/gluster-nagios-addons.spec.in
index c3b0df2..4c8a996 100644
--- a/gluster-nagios-addons.spec.in
+++ b/gluster-nagios-addons.spec.in
@@ -31,6 +31,9 @@
%define _init_stop() /sbin/service %1 stop &>/dev/null ;
%define _init_install() install -D -p -m 0755 %1 %{buildroot}%{_sysconfdir}/init.d/%2 ;
%endif
+%define _start_conf_section() ### START - configuration section for gluster nrpe plugins ###
+%define _end_conf_section() ### END - configuration section for gluster nrpe plugins ###
+%define _remove_gluster_nagios_configs() /bin/sed -i -e "/%{_start_conf_section}/,/%{_end_conf_section}/d" %{_sysconfdir}/nagios/nrpe.cfg ;
Summary: Gluster node management add-ons for Nagios
Name: @PACKAGE_NAME@
@@ -134,8 +137,10 @@ if grep -q "dont_blame_nrpe=0" %{_sysconfdir}/nagios/nrpe.cfg ; then
sed -i -e 's/dont_blame_nrpe=0/dont_blame_nrpe=1/g' %{_sysconfdir}/nagios/nrpe.cfg
fi
+%_remove_gluster_nagios_configs
+
cat >> %{_sysconfdir}/nagios/nrpe.cfg <<EOF
-### gluster nrpe plugins ###
+%{_start_conf_section}
command[check_disk_and_inode]=%{_libdir}/nagios/plugins/gluster/check_disk_and_inode.py -w 80 -c 90 -l -i /boot -i /var -i /root -n --inode
command[check_memory]=%{_libdir}/nagios/plugins/gluster/memory.py -w 80 -c 90
command[check_swap_usage]=%{_libdir}/nagios/plugins/gluster/swap.py -w 80 -c 90
@@ -146,12 +151,12 @@ command[check_vol_utilization]=sudo %{_libdir}/nagios/plugins/gluster/check_vol_
command[check_vol_status]=sudo %{_libdir}/nagios/plugins/gluster/check_volume_status.py -v \$ARG1\$ -t \$ARG2\$
command[check_proc_status]=sudo %{_libdir}/nagios/plugins/gluster/check_gluster_proc_status.py -t \$ARG1\$
command[check_brick_status]=sudo %{_libdir}/nagios/plugins/gluster/check_gluster_proc_status.py -t BRICK -v \$ARG1\$ -b \$ARG2\$
-###Auto Discovery related
command[discoverpeers]=sudo %{_libdir}/nagios/plugins/gluster/discoverpeers.py
command[discover_volume_list]=sudo %{_libdir}/nagios/plugins/gluster/discover_volumes.py -l
command[discover_volume_info]=sudo %{_libdir}/nagios/plugins/gluster/discover_volumes.py -v \$ARG1\$
command[discoverhostparams]=sudo %{_libdir}/nagios/plugins/gluster/discoverhostparams.py
command[configure_gluster_node]=sudo %{_libdir}/nagios/plugins/gluster/configure_gluster_node.py -c \$ARG1\$ -n \$ARG2\$ -H \$ARG3\$
+%{_end_conf_section}
EOF
%_init_enable nrpe
%_init_enable glusterpmd
@@ -160,16 +165,12 @@ EOF
%_init_restart glusterpmd
%preun
-%_init_disable glusterpmd
-%_init_stop glusterpmd
-sed -i '/gluster nrpe plugins/d' %{_sysconfdir}/nagios/nrpe.cfg
-sed -i '/check_disk_and_inode/d' %{_sysconfdir}/nagios/nrpe.cfg
-sed -i '/check_memory/d' %{_sysconfdir}/nagios/nrpe.cfg
-sed -i '/check_swap_usage/d' %{_sysconfdir}/nagios/nrpe.cfg
-sed -i '/sadf.py/d' %{_sysconfdir}/nagios/nrpe.cfg
-sed -i '/check_cpu_multicore.py/d' %{_sysconfdir}/nagios/nrpe.cfg
-sed -i '/check_vol_status/d' %{_sysconfdir}/nagios/nrpe.cfg
-sed -i '/check_vol_quota_status/d' %{_sysconfdir}/nagios/nrpe.cfg
+if [ "$1" -eq 0 ]; then
+ %_init_disable glusterpmd
+ %_init_stop glusterpmd
+ %_remove_gluster_nagios_configs
+
+fi
%files
%defattr(-,root,root,-)