new check mountpoint
This commit is contained in:
@@ -14,3 +14,10 @@ Icinga plugin to check load average per CPU. Shows 1min, 5min 15min
|
||||
average per CPU. Different to check_load, the load is divided by the
|
||||
number of CPU units and therefore normalized. So the same warning and
|
||||
critical levels fit for any server.
|
||||
|
||||
mountpoint.sh
|
||||
-------------
|
||||
|
||||
Icinga plugin to check whether a given path is available. Detects
|
||||
problems, e.g. with glusterfs: In case of a problem, there is an error
|
||||
message such as "socket not connected". Called with path to check.
|
@@ -9,9 +9,12 @@ $0 [OPTIONS]
|
||||
|
||||
OPTIONS
|
||||
|
||||
-h, --help show this help
|
||||
|
||||
-w, --warning "a b c" set warning threshold for:
|
||||
a: 1min, b: 5min, c: 15min average
|
||||
(default: ${WARNING[@]})
|
||||
|
||||
-c, --critical "a b c" set critical threshold for:
|
||||
a: 1min, b: 5min, c: 15min average
|
||||
(default: ${CRITICAL[@]})
|
||||
@@ -35,8 +38,6 @@ EOF
|
||||
shift
|
||||
done
|
||||
|
||||
a=( $(cut -d' ' -f 1-3 </proc/loadavg) )
|
||||
|
||||
echo "before ${a[@]}"
|
||||
level=0
|
||||
txt=OK
|
||||
|
56
mountpoint.sh
Executable file
56
mountpoint.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
path=""
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
(-h|--help) cat <<EOF
|
||||
$0 [OPTIONS] PATH
|
||||
|
||||
-h, --help show this help
|
||||
|
||||
PATH
|
||||
|
||||
Path to check.
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Icinga plugin to check whether a given path is available. Detects
|
||||
problems, e.g. with glusterfs: In case of a problem, there is an error
|
||||
message such as "socket not connected".
|
||||
|
||||
EOF
|
||||
exit;;
|
||||
(*) if test $# -ne 1; then
|
||||
echo "ERROR: please specify an existing path, not $*" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
path="$1";;
|
||||
esac
|
||||
if test $# -lt 1; then
|
||||
echo "ERROR: missing option, try $0 --help"
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if ! test -d "$path"; then
|
||||
echo "ERROR: no such path $path" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
time=$(mktemp)
|
||||
out=$(mktemp)
|
||||
err=$(mktemp)
|
||||
if /usr/bin/time -f "elapsed=%es" -qo $time ls "$path" > $out 2> $err && test -s $out; then
|
||||
if [[ $(<$time) =~ elapsed=0.0[012]s ]]; then
|
||||
level=0
|
||||
STATUS="OK - ${path}:"
|
||||
else
|
||||
level=1
|
||||
STATUS="WARNING - ${path}:"
|
||||
fi
|
||||
else
|
||||
level=2
|
||||
STATUS="CRITICAL - $(<$err):"
|
||||
fi
|
||||
echo ${STATUS} $(<$time)
|
||||
rm $time $out $err 2>&1 > /dev/null
|
||||
exit $level
|
Reference in New Issue
Block a user