From f9db23c8c5c129803070e1f4232d8cb877cf49f3 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 16 Sep 2015 15:01:28 +0200 Subject: [PATCH] Prevent heal false positive by checking two times --- zabbix_scripts/check_gluster_sudo | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/zabbix_scripts/check_gluster_sudo b/zabbix_scripts/check_gluster_sudo index 3ca41b4..dd006f5 100644 --- a/zabbix_scripts/check_gluster_sudo +++ b/zabbix_scripts/check_gluster_sudo @@ -89,8 +89,18 @@ if ($what eq 'volume'){ } foreach my $line (@volinfo){ if ($line =~ m/^Number\ of\ entries:\s+(\d+)$/ && $1 gt 0){ - print "CRITICAL: self-heal in progress ($1)"; - exit 1; + # Lets check a second time to limit false positives + sleep 1; + @volinfo = gluster("$gluster vol heal $volume info"); + unless (scalar @volinfo){ + die "Error occurred while trying to get volume heal info for $volume"; + } + foreach my $line (@volinfo){ + if ($line =~ m/^Number\ of\ entries:\s+(\d+)$/ && $1 gt 0){ + print "CRITICAL: self-heal in progress ($1)"; + exit 1; + } + } } } @volinfo = gluster("$gluster vol heal $volume info heal-failed");