From 42c24afedc1078297857776d082f5d706bb8dbb3 Mon Sep 17 00:00:00 2001
From: Dennis Ahrens <dennis.ahrens@hs-hannover.de>
Date: Wed, 8 Jul 2020 16:50:27 +0200
Subject: [PATCH] gluster: only check your own brick

---
 checkmk/custom-files/local/gluster | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/checkmk/custom-files/local/gluster b/checkmk/custom-files/local/gluster
index bbb4b85..a70ffc6 100644
--- a/checkmk/custom-files/local/gluster
+++ b/checkmk/custom-files/local/gluster
@@ -24,13 +24,19 @@
 #
 # We currently only utilize the Online: Y information.
 
+hostname=$(hostname)
+
 # iterate over all available volumns
 for volume in $(gluster volume list)
 do
   # find all bricks for this volume
 	for brick in $(gluster volume info $volume | grep -E '^Brick[0-9]: ' | sed -e 's/Brick[0-9]: //g')
 	do
-    # grab the full status of this brick
+		# skip if this is not your own brick!
+		if [[ "$brick" != *"$hostname"* ]]; then
+			continue
+		fi
+		# grab the full status of this brick
 		brick_status=$(gluster volume status $volume $brick detail)
 		online=$(echo "$brick_status" | grep -E '^Online' | cut -d ':' -f2 | tr -d '[:space:]')
 		case "$online" in
-- 
GitLab