Skip to content
Snippets Groups Projects
Commit d3af72f0 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch '6361-fix-ceph-io' into 'master'

ceph_io: handle ceph status without io data

See merge request !81
parents 107c95c3 e12bd0bc
No related branches found
No related tags found
1 merge request!81ceph_io: handle ceph status without io data
...@@ -17,12 +17,13 @@ ...@@ -17,12 +17,13 @@
# 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 # 2023-05-10 v1.2 <axel.hahn@unibe.ch> add tests
# 2023-05-11 v1.3 <axel.hahn@unibe.ch> handle ceph status without io data in output
# ====================================================================== # ======================================================================
. $(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.2 self_APPVERSION=1.3
function showHelp(){ function showHelp(){
_self=$(basename $0) _self=$(basename $0)
...@@ -75,6 +76,7 @@ if [ "$1" = "-t" ]; then ...@@ -75,6 +76,7 @@ if [ "$1" = "-t" ]; then
# TEST: client: 8.9 KiB/s rd, 887 KiB/s wr, 138 op/s rd, 140 op/s wr # TEST: client: 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 # TEST: client: 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 # TEST: client: 255 B/s rd, 0 op/s rd, 0 op/s wr
# TEST: no line with client
if [ -z "$2" ]; then if [ -z "$2" ]; then
echo; echo ">>>>>>>>>> TESTS"; echo echo; echo ">>>>>>>>>> TESTS"; echo
grep '# TEST: ' $0 | grep -v grep | cut -f 2- -d ':' | while read -r teststring grep '# TEST: ' $0 | grep -v grep | cut -f 2- -d ':' | while read -r teststring
...@@ -90,16 +92,20 @@ if [ "$1" = "-t" ]; then ...@@ -90,16 +92,20 @@ if [ "$1" = "-t" ]; then
else else
# --- check required tools # --- check required tools
ph.require ceph ph.require ceph
CEPHIO=$( sudo ceph status 2>/dev/null | grep "client:")
fi
if [ -z "${CEPHIO}" ]; then # --- get output of ceph
if ! CEPHOUT=$( sudo ceph status 2>&1 ); then
ph.setStatus "unknown" ph.setStatus "unknown"
ph.status "no data" ph.status "no data"
echo "There is no output from 'sudo ceph status'." echo "There is no output from 'sudo ceph status'."
echo "No ceph here or no sudo permissions on ceph command?" echo "No ceph here or no sudo permissions on ceph command?"
else echo "$CEPHOUT"
fi
CEPHIO=$( echo "$CEPHOUT" | grep "client:")
fi
if [ -n "${CEPHOUT}${CEPHIO}" ]; then
CEPHDATA=$( echo "${CEPHIO}" | cut -f 2 -d ':' ) CEPHDATA=$( echo "${CEPHIO}" | cut -f 2 -d ':' )
SEG_R=$( echo "${CEPHDATA}" | cut -f 1 -d "," | grep "rd" | awk '{ print $1 " " $2 }') SEG_R=$( echo "${CEPHDATA}" | cut -f 1 -d "," | grep "rd" | awk '{ print $1 " " $2 }')
...@@ -111,6 +117,7 @@ else ...@@ -111,6 +117,7 @@ else
IO_READ=$( echo "${SEG_R}" | 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 "${SEG_W}" | 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')
test -z "$CEPHIO" && CEPHIO="'ceph status' successful - but there are no io data in output."
test -z "$IO_READ" && IO_READ="0" test -z "$IO_READ" && IO_READ="0"
test -z "$IO_WRITE" && IO_WRITE="0" test -z "$IO_WRITE" && IO_WRITE="0"
ph.status "$( echo "${CEPHIO}" | cut -f 2 -d ":" )" ph.status "$( echo "${CEPHIO}" | cut -f 2 -d ":" )"
......
...@@ -15,7 +15,7 @@ It returns a single line for the status and performance data. ...@@ -15,7 +15,7 @@ It returns a single line for the status and performance data.
______________________________________________________________________ ______________________________________________________________________
CHECK_CEPH_IO CHECK_CEPH_IO
v1.2 v1.3
(c) Institute for Medical Education - University of Bern (c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3 Licence: GNU GPL 3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment