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

add check_fs_errors

parent 09af01af
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
# ======================================================================
#
# Check filesystem errors
#
#
# requirements:
# - sudo permission on /bin/journalctl
#
# ----------------------------------------------------------------------
# 2021-03-23 v0.0 <axel.hahn@iml.unibe.ch>
# ======================================================================
. `dirname $0`/inc_pluginfunctions
# ----------------------------------------------------------------------
# functions
# ----------------------------------------------------------------------
function showHelp(){
cat <<EOF
______________________________________________________________________
CHECK_FS_ERRORS check if kernel logs inconsistency messages
(c) Institute for Medical Education - Univerity of Bern
Licence: GNU GPL 3
______________________________________________________________________
SYNTAX:
`basename $0` [-h]
OPTIONS:
-h or --help show this help.
PARAMETERS:
none
EXAMPLE:
`basename $0`
EOF
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
# --- check required tools
# ph.require bc top
# --- check param -h
case "$1" in
"--help"|"-h")
showHelp
exit 0
;;
*)
esac
# ----- MAKE CHECK
out=$( sudo /bin/journalctl | grep 'kernel: ' | grep -v 'check_fs_errors' | grep -E '(error|fail)' | grep 'inconsistent' )
test ! -z "$out" && ph.setStatus "critical"
# ----- OUTPUT
ph.status "check if kernel logs inconsistency messages"
echo $out
# ----- CLEANUP AND BYE!
ph.exit
# ----------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment