Skip to content
Snippets Groups Projects
Commit ea307e93 authored by Dennis Ahrens's avatar Dennis Ahrens
Browse files

Reworked gluster status based on heal summary

parent 42c24afe
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
# gluster agent plugin # we parse the output of gluster volume heal [vol] info split-brain
# which looks like that:
# #
# * determine all volumes # Brick t3web-00.it.hs-hannover.de:/srv/gluster/fileadmin
# * determie all bricks for this volume # Status: Connected
# * discover brick information - yields output like that: # Number of entries in split-brain: 0
# #
# Status of volume: fileadmin # Brick t3web-01.it.hs-hannover.de:/srv/gluster/fileadmin
# ------------------------------------------------------------------------------ # Status: Connected
# Brick : Brick t3web-00.it.hs-hannover.de:/srv/gluster/fileadmin # Number of entries in split-brain: 0
# TCP Port : 49152
# RDMA Port : 0
# Online : Y
# Pid : 609
# File System : xfs
# Device : /dev/sdd1
# Mount Options : rw,relatime,attr2,inode64,noquota
# Inode Size : N/A
# Disk Space Free : 108.5GB
# Total Disk Space : 120.0GB
# Inode Count : 62914048
# Free Inodes : 62693863
#
# We currently only utilize the Online: Y information.
hostname=$(hostname) hostname=$(hostname)
entries_warn=500
entries_crit=1000
entries_min=0
entries_max=2000
# iterate over all available volumns # iterate over all available volumns
for volume in $(gluster volume list) for volume in $(gluster volume list)
do do
# find all bricks for this volume gluster volume heal $volume info summary > /tmp/gluster_heal_summary
for brick in $(gluster volume info $volume | grep -E '^Brick[0-9]: ' | sed -e 's/Brick[0-9]: //g') # check heal info summary
do while read -r brickline; do
# skip if this is not your own brick! read -r statusline
if [[ "$brick" != *"$hostname"* ]]; then read -r entriesline
# we do not use the 3 lines below - may use them for more detailed metrics
read -r entriespendingline
read -r entriessplitbrainline
read -r entrieshealingline
# bricks are separated by empty line
read -r emptyline
# skip chunks that are not ours
if [[ "$brickline" != *"$hostname"* ]]
then
continue continue
fi fi
# grab the full status of this brick # parse lines of the last brick, since it is located on this gluster cluster node
brick_status=$(gluster volume status $volume $brick detail) brick=$(echo "$brickline" | cut -f2 -d' ')
online=$(echo "$brick_status" | grep -E '^Online' | cut -d ':' -f2 | tr -d '[:space:]') heal_status=$(echo "$statusline" | cut -d ':' -f2 | tr -d '[:space:]')
case "$online" in entries=$(echo "$entriesline" | cut -d ':' -f2 | tr -d '[:space:]')
Y) brick_status=0 ;; # Online means OK case "$heal_status" in
N) brick_status=1 ;; # Not online is WARN Connected) chmk_status=0 ;; # Online means OK
*) brick_status=3 ;; # everything else we don't know... *) chmk_status=3 ;; # everything else we don't know...
esac esac
echo "$brick_status $brick - Online status of volume '$volume' is: '$online'" metrics="healing_entries=$entries;$entries_warn;$entries_crit;$entries_min;$entries_max"
done msg="Online status of volume '$volume' brick '$brick' is: '$heal_status'"
echo "$chmk_status gluster_volume:$volume $metrics $msg"
done < /tmp/gluster_heal_summary
done done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment