Skip to content

Commit

Permalink
on error we exit with status CRITICAL, we should state so in the outp…
Browse files Browse the repository at this point in the history
…ut too.
  • Loading branch information
bs-github committed Nov 1, 2012
1 parent 3056596 commit 2b93032
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions check_mountpoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ elif [ -z "${MPS}" ]; then
fi

if [ ! -f /proc/mounts -a "${MTAB}" == "/proc/mounts" ]; then
log "WARN: /proc wasn't mounted!"
log "CRIT: /proc wasn't mounted!"
mount -t proc proc /proc
ERR_MESG[${#ERR_MESG[*]}]="WARN: mounted /proc $?"
ERR_MESG[${#ERR_MESG[*]}]="CRIT: mounted /proc $?"
fi

if [ ! -f "${MTAB}" ]; then
log "WARN: ${MTAB} don't exist!"
echo "WARN: ${MTAB} don't exist!"
log "CRIT: ${MTAB} don't exist!"
echo "CRIT: ${MTAB} don't exist!"
exit $STATE_CRITICAL
fi

Expand All @@ -213,15 +213,15 @@ for MP in ${MPS} ; do
if [ ! -f /proc/vz/veinfo -a ${AUTO} -ne 1 -a ${IGNOREFSTAB} -ne 1 ]; then
awk '{if ($'${FSF}'=="nfs" || $'${FSF}'=="nfs4" || $'${FSF}'=="davfs" || $'${FSF}'=="cifs" || $'${FSF}'=="fuse"){print $'${MF}'}}' ${FSTAB} | ${GREP} -q ${MP} &>/dev/null
if [ $? -ne 0 ]; then
log "WARN: ${MP} don't exists in /etc/fstab"
log "CRIT: ${MP} don't exists in /etc/fstab"
ERR_MESG[${#ERR_MESG[*]}]="${MP} don't exists in fstab ${FSTAB}"
fi
fi

## check kernel mounts
${GREP} -q -E "\W${MP}\W(nfs|nfs4|davfs|cifs|fuse|simfs)\W" ${MTAB} &>/dev/null
if [ $? -ne 0 ]; then
log "WARN: ${MP} isn't mounted"
log "CRIT: ${MP} isn't mounted"
ERR_MESG[${#ERR_MESG[*]}]="${MP} isn't mounted"
fi

Expand All @@ -241,14 +241,14 @@ for MP in ${MPS} ; do
else
## if it not stales, check if it is a directory
if [ ! -d ${MP} ]; then
log "WARN: ${MP} don't exists in filesystem"
log "CRIT: ${MP} don't exists in filesystem"
ERR_MESG[${#ERR_MESG[*]}]="${MP} don't exists in filesystem"
elif [ ${WRITETEST} -eq 1 ]; then
## if wanted, check if it is writable
TOUCHFILE=${MP}/mount_test_from_$(hostname)
touch ${TOUCHFILE} &>/dev/null
if [ $? -ne 0 ]; then
log "WARN: ${TOUCHFILE} is not writable."
log "CRIT: ${TOUCHFILE} is not writable."
ERR_MESG[${#ERR_MESG[*]}]="${TOUCHFILE} is not writable."
fi
fi
Expand Down

0 comments on commit 2b93032

Please sign in to comment.