Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
515ff505
Commit
515ff505
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
ceph_io: add test
parent
a288b19f
No related branches found
No related tags found
1 merge request
!80
ceph_io: add test
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
check_ceph_io
+48
-14
48 additions, 14 deletions
check_ceph_io
docs/20_Checks/check_ceph_io.md
+15
-3
15 additions, 3 deletions
docs/20_Checks/check_ceph_io.md
with
63 additions
and
17 deletions
check_ceph_io
+
48
−
14
View file @
515ff505
...
@@ -16,14 +16,16 @@
...
@@ -16,14 +16,16 @@
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# 2023-05-09 v1.0 <axel.hahn@unibe.ch>
# 2023-05-09 v1.0 <axel.hahn@unibe.ch>
# 2023-05-10 v1.1 <axel.hahn@unibe.ch> fix for small transfer rates in B/s
# 2023-05-10 v1.1 <axel.hahn@unibe.ch> fix for small transfer rates in B/s
# 2023-05-10 v1.2 <axel.hahn@unibe.ch> add tests
# ======================================================================
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_pluginfunctions
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
1.
1
self_APPVERSION
=
1.
2
function
showHelp
(){
function
showHelp
(){
_self
=
$(
basename
$0
)
cat
<<
EOF
cat
<<
EOF
______________________________________________________________________
______________________________________________________________________
...
@@ -38,10 +40,22 @@ Show cheph IO as read and written bytes per second.
...
@@ -38,10 +40,22 @@ Show cheph IO as read and written bytes per second.
This check sends performance data.
This check sends performance data.
SYNTAX:
SYNTAX:
$
(
basename
$0
)
$
_self
OPTIONS:
OPTIONS:
-h or --help show this help.
-h or --help show this help.
-t [STRING] test a value; for debugging purposes
Without a string internally stored values will be tested
EXAMPLE:
$_self
no parameters; normal usage to get the ceph io data
$_self
-t
Run a few builtin tests
$_self
-t " client: 255 B/s rd, 0 op/s rd, 0 op/s wr"
Test a given string
EOF
EOF
}
}
...
@@ -55,12 +69,29 @@ case "$1" in
...
@@ -55,12 +69,29 @@ case "$1" in
*
)
*
)
esac
esac
# --- check required tools
if
[
"
$1
"
=
"-t"
]
;
then
ph.require ceph
# Snippets for testing:
# TEST: client: 13 KiB/s rd, 1.1 MiB/s wr, 130 op/s rd, 137 op/s wr
CEPHIO
=
$(
sudo
ceph status 2>/dev/null |
grep
"client:.* rd,.* wr,"
|
cut
-f
2
-d
":"
)
# TEST: client: 8.9 KiB/s rd, 887 KiB/s wr, 138 op/s rd, 140 op/s wr
# CEPHIO="8.9 KiB/s rd, 887 KiB/s wr, 138 op/s rd, 140 op/s wr"
# TEST: client: 255 B/s rd, 85 B/s wr, 0 op/s rd, 0 op/s
# CEPHIO="255 B/s rd, 85 B/s wr, 0 op/s rd, 0 op/s"
# TEST: client: 255 B/s rd, 0 op/s rd, 0 op/s wr
if
[
-z
"
$2
"
]
;
then
echo
;
echo
">>>>>>>>>> TESTS"
;
echo
grep
'# TEST: '
$0
|
grep
-v
grep
|
cut
-f
2-
-d
':'
|
while
read
-r
teststring
do
echo
"--- test string [
$teststring
]"
$0
-t
"
$teststring
"
echo
;
echo
;
echo
done
exit
0
else
CEPHIO
=
"
$2
"
fi
else
# --- check required tools
ph.require ceph
CEPHIO
=
$(
sudo
ceph status 2>/dev/null |
grep
"client:"
)
fi
if
[
-z
"
${
CEPHIO
}
"
]
;
then
if
[
-z
"
${
CEPHIO
}
"
]
;
then
...
@@ -70,19 +101,22 @@ if [ -z "${CEPHIO}" ]; then
...
@@ -70,19 +101,22 @@ if [ -z "${CEPHIO}" ]; then
echo
"No ceph here or no sudo permissions on ceph command?"
echo
"No ceph here or no sudo permissions on ceph command?"
else
else
CEPHDATA
=
$(
echo
"
${
CEPHIO
}
"
|
cut
-f
2
-d
':'
)
SEG_R
=
$(
echo
"
${
CEPHDATA
}
"
|
cut
-f
1
-d
","
|
grep
"rd"
|
awk
'{ print $1 " " $2 }'
)
SEG_W
=
$(
echo
"
${
CEPHDATA
}
"
|
cut
-f
2
-d
","
|
grep
"wr"
|
awk
'{ print $1 " " $2 }'
)
# remark:
# remark:
# - the sed transforms "NN KiB/s" --> "NN KB" (cut "i")
# - the sed transforms "NN KiB/s" --> "NN KB" (cut "i")
# - the tr is for small values "NN B/s" and removes "s"
# - the tr is for small values "NN B/s" and removes "s"
IO_READ
=
$(
echo
${
CEPHIO
}
|
cut
-f
1,2
-d
" "
|
sed
-E
"s#([0-9]*) (.).(.).*#
\1\2\3
#g"
|
tr
-d
's'
)
IO_READ
=
$(
echo
"
${
SEG_R
}
"
|
sed
-E
"s#([0-9]*) (.).(.).*#
\1\2\3
#g"
|
tr
-d
's'
)
IO_WRITE
=
$(
echo
${
CEPHIO
}
|
cut
-f
4,5
-d
" "
|
sed
-E
"s#([0-9]*) (.).(.).*#
\1\2\3
#g"
|
tr
-d
's'
)
IO_WRITE
=
$(
echo
"
${
SEG_W
}
"
|
sed
-E
"s#([0-9]*) (.).(.).*#
\1\2\3
#g"
|
tr
-d
's'
)
ph.status
"
$CEPHIO
"
# echo "read: $IO_READ"
test
-z
"
$IO_READ
"
&&
IO_READ
=
"0"
# echo "write: $IO_WRITE"
test
-z
"
$IO_WRITE
"
&&
IO_WRITE
=
"0"
ph.status
"
$(
echo
"
${
CEPHIO
}
"
|
cut
-f
2
-d
":"
)
"
ph.perfadd
"cephio-read"
"
$IO_READ
"
""
""
ph.perfadd
"cephio-read"
"
$IO_READ
"
""
""
ph.perfadd
"cephio-write"
"
$IO_WRITE
"
""
""
ph.perfadd
"cephio-write"
"
$IO_WRITE
"
""
""
fi
fi
ph.exit
ph.exit
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/20_Checks/check_ceph_io.md
+
15
−
3
View file @
515ff505
...
@@ -11,12 +11,11 @@ It returns a single line for the status and performance data.
...
@@ -11,12 +11,11 @@ It returns a single line for the status and performance data.
## Syntax
## Syntax
```
```
txt
$ check_ceph_io --help
______________________________________________________________________
______________________________________________________________________
CHECK_CEPH_IO
CHECK_CEPH_IO
v1.
0
v1.
2
(c) Institute for Medical Education - University of Bern
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
Licence: GNU GPL 3
...
@@ -30,6 +29,19 @@ check_ceph_io
...
@@ -30,6 +29,19 @@ check_ceph_io
OPTIONS:
OPTIONS:
-h or --help show this help.
-h or --help show this help.
-t [STRING] test a value; for debugging purposes
Without a string internally stored values will be tested
EXAMPLE:
check_ceph_io
no parameters; normal usage to get the ceph io data
check_ceph_io -t
Run a few builtin tests
check_ceph_io -t " client: 255 B/s rd, 0 op/s rd, 0 op/s wr"
Test a given string
```
```
### Parameters
### Parameters
...
...
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