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

update sudo handling

parent 98070025
Branches
No related tags found
1 merge request!193update sudo handling
...@@ -64,15 +64,16 @@ case "$1" in ...@@ -64,15 +64,16 @@ case "$1" in
*) *)
esac esac
# --- check required tools
ph.require ceph
# set default / override from command line params # set default / override from command line params
typeset -i iWarnLimit=$( ph.getValueWithParam 70 w "$@") typeset -i iWarnLimit=$( ph.getValueWithParam 70 w "$@")
typeset -i iCriticalLimit=$( ph.getValueWithParam 90 c "$@") typeset -i iCriticalLimit=$( ph.getValueWithParam 90 c "$@")
if ! data=$( sudo -n /bin/ceph df 2>&1 ) if ! data=$( sudo -n /bin/ceph df 2>&1 )
then then
echo "$data" ph.abort "UNKNOWN: No sudo permissions to execute ceph commands."
ph.abort "UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands."
fi fi
isHeader=0 isHeader=0
......
...@@ -89,11 +89,7 @@ else ...@@ -89,11 +89,7 @@ else
# --- get output of ceph # --- get output of ceph
if ! CEPHOUT=$( sudo -n ceph status 2>&1 ); then if ! CEPHOUT=$( sudo -n ceph status 2>&1 ); then
ph.setStatus "unknown" ph.abort "UNKNOWN: No sudo permissions to execute ceph commands."
ph.status "no data"
echo "There is no output from 'sudo ceph status'."
echo "No ceph here or no sudo permissions on ceph command?"
echo "$CEPHOUT"
fi fi
CEPHIO=$( echo "$CEPHOUT" | grep "client:") CEPHIO=$( echo "$CEPHOUT" | grep "client:")
fi fi
......
...@@ -11,10 +11,15 @@ ...@@ -11,10 +11,15 @@
# #
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2020-03-02 v1.0 initial version # 2020-03-02 v1.0 initial version
# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions # 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2023-02-13 v1.2 <axel.hahn@unibe.ch> some shell fixes # 2023-02-13 v1.2 <axel.hahn@unibe.ch> some shell fixes
# 2023-08-24 v1.3 <axel.hahn@unibe.ch> add help; do not use tmp file anymore
# ====================================================================== # ======================================================================
. $( dirname $0 )/inc_pluginfunctions
export self_APPVERSION=1.1
# --- tmp files for internal usage # --- tmp files for internal usage
tmpfile=/tmp/processlist1_$$ tmpfile=/tmp/processlist1_$$
tmpfile2=/tmp/processlist2_$$ tmpfile2=/tmp/processlist2_$$
...@@ -31,7 +36,10 @@ typeset -i iCountCritical=0 ...@@ -31,7 +36,10 @@ typeset -i iCountCritical=0
rm -f $tmpfile $tmpfile2 $outCritical $outWarning 2>/dev/null rm -f $tmpfile $tmpfile2 $outCritical $outWarning 2>/dev/null
. $(dirname $0)/inc_pluginfunctions # ----------------------------------------------------------------------
# functions
# ----------------------------------------------------------------------
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# MAIN # MAIN
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment