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

shell fixes; update help page

parent 8241a167
No related branches found
No related tags found
1 merge request!127Update icinga checks and docs
...@@ -8,10 +8,14 @@ ...@@ -8,10 +8,14 @@
# #
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2021-03-23 v0.0 <axel.hahn@iml.unibe.ch> # 2021-03-23 v0.0 <axel.hahn@iml.unibe.ch>
# 2023-07-27 v1.2 <axel.hahn@iml.unibe.ch> shell fixes; update help page
# ====================================================================== # ======================================================================
. `dirname $0`/inc_pluginfunctions . $( dirname $0 )/inc_pluginfunctions
self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] )
self_APPVERSION=1.2
dirs2test="/tmp /var/tmp" dirs2test="/tmp /var/tmp"
out="" out=""
...@@ -21,18 +25,25 @@ out="" ...@@ -21,18 +25,25 @@ out=""
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
function showHelp(){ function showHelp(){
_self=$(basename $0)
cat <<EOF cat <<EOF
______________________________________________________________________ ______________________________________________________________________
CHECK_FS_READONLY check if filesystem is readonly - v0.0 $self_APPNAME
v$self_APPVERSION
(c) Institute for Medical Education - University of Bern (c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3 Licence: GNU GPL 3
______________________________________________________________________ ______________________________________________________________________
Check if a filesystem is readonly in given directories.
In each of the given directories a random file will be touched.
The response is critical of one of the directory is not writable
for the icinga client user.
SYNTAX: SYNTAX:
`basename $0` [directory [more directories]] $_self [directory [more directories]]
OPTIONS: OPTIONS:
...@@ -41,9 +52,12 @@ OPTIONS: ...@@ -41,9 +52,12 @@ OPTIONS:
PARAMETERS: PARAMETERS:
DIRECTORY where to touch a temporary file DIRECTORY where to touch a temporary file
default directories:
$dirs2test
EXAMPLE: EXAMPLE:
`basename $0` /tmp /root /var/www
$_self /tmp /root /var/www
EOF EOF
} }
...@@ -73,11 +87,11 @@ test $# -gt 0 && dirs2test="$*" ...@@ -73,11 +87,11 @@ test $# -gt 0 && dirs2test="$*"
for mydir in $dirs2test for mydir in $dirs2test
do do
touchfile=$mydir/icinga_touch_testfile__${RANDOM}_${RANDOM} touchfile=$mydir/icinga_touch_testfile__${RANDOM}_${RANDOM}
out="$out if ! out="$out
--- touching something into $mydir --- touching something into $mydir
$( touch $touchfile && ls -l $touchfile && rm -f $touchfile 2>&1 )" $( touch $touchfile 2>&1 && ls -l $touchfile && rm -f $touchfile )"
if [ $? -ne 0 ]; then then
ph.setStatus "critical" ph.setStatus "critical"
fi fi
done done
...@@ -86,7 +100,6 @@ done ...@@ -86,7 +100,6 @@ done
# ----- OUTPUT # ----- OUTPUT
ph.status "check if filesystem is writable in $dirs2test $out" ph.status "check if filesystem is writable in $dirs2test $out"
#echo "$out"
# ----- CLEANUP AND BYE! # ----- CLEANUP AND BYE!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment