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

ceph osd: shorten ceph exec; show output on error

parent 8f50cd08
No related branches found
No related tags found
1 merge request!127Update icinga checks and docs
......@@ -26,12 +26,13 @@
# 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space
# 2023-04-24 v1.4 <axel.hahn@unibe.ch> update for newer ceph versions
# 2023-06-19 v1.5 <axel.hahn@unibe.ch> add help and param support; no more tmpfile
# 2023-07-27 v1.6 <axel.hahn@unibe.ch> shorten ceph exec; show output on error; shell fixes
# ======================================================================
. $(dirname $0)/inc_pluginfunctions
self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] )
self_APPVERSION=1.5
self_APPVERSION=1.6
# column number in output where to find the up/ down info
iColUpDown=5
......@@ -94,19 +95,18 @@ case "$1" in
*)
esac
data=$( sudo /bin/ceph osd tree 2>&1 )
if [ $? -ne 0 ]; then
if ! data=$( sudo /bin/ceph osd tree 2>&1 ); then
echo "$data"
ph.abort "UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands."
fi
# set default / override from command line params
typeset -i iWarnLimit=$( ph.getValueWithParam 1 w "$@")
typeset -i iCriticalLimit=$( ph.getValueWithParam 2 c "$@")
typeset -i iOsdTotal=$( getOsd | wc -l)
typeset -i iOsdDown=$( getOsd | awk '{ print $iColUpDown }' | grep "down" | wc -l)
typeset -i iOsdUp=$( getOsd | awk '{ print $iColUpDown }' | grep "up" | wc -l)
typeset -i iWarnLimit; iWarnLimit=$( ph.getValueWithParam 1 w "$@")
typeset -i iCriticalLimit; iCriticalLimit=$( ph.getValueWithParam 2 c "$@")
typeset -i iOsdTotal; iOsdTotal=$( getOsd | wc -l)
typeset -i iOsdDown; iOsdDown=$( getOsd | awk '{ print $iColUpDown }' | grep "down" | wc -l)
typeset -i iOsdUp; iOsdUp=$( getOsd | awk '{ print $iColUpDown }' | grep "up" | wc -l)
if [ $iOsdDown -lt $iWarnLimit ]; then
ph.setStatus "ok"
......
......@@ -18,7 +18,7 @@ critical level.
______________________________________________________________________
CHECK_CEPH_OSD
v1.5
v1.6
(c) Institute for Medical Education - University of Bern
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