Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
checkmk-formula
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
salt
checkmk-formula
Commits
ea307e93
Commit
ea307e93
authored
4 years ago
by
Dennis Ahrens
Browse files
Options
Downloads
Patches
Plain Diff
Reworked gluster status based on heal summary
parent
42c24afe
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
checkmk/custom-files/local/gluster
+40
-38
40 additions, 38 deletions
checkmk/custom-files/local/gluster
with
40 additions
and
38 deletions
checkmk/custom-files/local/gluster
+
40
−
38
View file @
ea307e93
#!/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
o
f
this
brick
# parse lines of the last brick, since it is located
o
n
this
gluster cluster node
brick
_status
=
$(
gluster volume status
$volume
$brick
detail
)
brick
=
$(
echo
"
$brickline
"
|
cut
-f2
-d
' '
)
online
=
$(
echo
"
$brick_status
"
|
grep
-E
'^On
line
'
|
cut
-d
':'
-f2
|
tr
-d
'[:space:]'
)
heal_status
=
$(
echo
"
$status
line
"
|
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
)
bric
k_status
=
1
;;
#
Not o
nline
is WARN
Connected
)
chm
k_status
=
0
;;
#
O
nline
means OK
*
)
bric
k_status
=
3
;;
# everything else we don't know...
*
)
chm
k_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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment