Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
78734112
Commit
78734112
authored
4 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add check_fs_writable
parent
ee916f18
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_fs_writable
+96
-0
96 additions, 0 deletions
check_fs_writable
with
96 additions
and
0 deletions
check_fs_writable
0 → 100644
+
96
−
0
View file @
78734112
#!/usr/bin/env bash
# ======================================================================
#
# Check filesystem ... is it readonly?
#
# requirements:
# - none
#
# ----------------------------------------------------------------------
# 2021-03-23 v0.0 <axel.hahn@iml.unibe.ch>
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
dirs2test
=
"/tmp /var/tmp"
out
=
""
# ----------------------------------------------------------------------
# functions
# ----------------------------------------------------------------------
function
showHelp
(){
cat
<<
EOF
______________________________________________________________________
CHECK_FS_READONLY check if filesystem is readonly - v0.0
(c) Institute for Medical Education - Univerity of Bern
Licence: GNU GPL 3
______________________________________________________________________
SYNTAX:
`basename
$0
` [directory [more directories]]
OPTIONS:
-h or --help show this help.
PARAMETERS:
DIRECTORY where to touch a temporary file
EXAMPLE:
`basename
$0
` /tmp /root /var/www
EOF
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
# --- check required tools
# ph.require bc top
# --- check param -h
case
"
$1
"
in
"--help"
|
"-h"
)
showHelp
exit
0
;;
*
)
esac
# params are directory names ... if a param was given it overrides the internal default
test
$#
-gt
0
&&
dirs2test
=
"
$*
"
# ----- MAKE CHECK
for
mydir
in
$dirs2test
do
touchfile
=
$mydir
/icinga_touch_testfile__
${
RANDOM
}
_
${
RANDOM
}
out
=
"
$out
--- touching something into
$mydir
$(
touch
$touchfile
&&
ls
-l
$touchfile
&&
rm
-f
$touchfile
2>&1
)
"
if
[
$?
-ne
0
]
;
then
ph.setStatus
"critical"
fi
done
# ----- OUTPUT
ph.status
"check if filesystem is writable in
$dirs2test
$out
"
#echo "$out"
# ----- CLEANUP AND BYE!
ph.exit
# ----------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment