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

Merge branch '6723-sudo' into 'master'

update sudo handling

See merge request !193
parents 0f59f79c e14e4b61
No related branches found
No related tags found
1 merge request!193update sudo handling
......@@ -64,15 +64,16 @@ case "$1" in
*)
esac
# --- check required tools
ph.require ceph
# set default / override from command line params
typeset -i iWarnLimit=$( ph.getValueWithParam 70 w "$@")
typeset -i iCriticalLimit=$( ph.getValueWithParam 90 c "$@")
if ! data=$( sudo -n /bin/ceph df 2>&1 )
then
echo "$data"
ph.abort "UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands."
ph.abort "UNKNOWN: No sudo permissions to execute ceph commands."
fi
isHeader=0
......
......@@ -89,11 +89,7 @@ else
# --- get output of ceph
if ! CEPHOUT=$( sudo -n ceph status 2>&1 ); then
ph.setStatus "unknown"
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"
ph.abort "UNKNOWN: No sudo permissions to execute ceph commands."
fi
CEPHIO=$( echo "$CEPHOUT" | grep "client:")
fi
......
......@@ -11,10 +11,15 @@
#
# ----------------------------------------------------------------------
# 2020-03-02 v1.0 initial version
# 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
# 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-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
tmpfile=/tmp/processlist1_$$
tmpfile2=/tmp/processlist2_$$
......@@ -31,7 +36,10 @@ typeset -i iCountCritical=0
rm -f $tmpfile $tmpfile2 $outCritical $outWarning 2>/dev/null
. $(dirname $0)/inc_pluginfunctions
# ----------------------------------------------------------------------
# functions
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# MAIN
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment