echocat/nagios-plugin-check_mountpoints

Actived -a and -w options when any mountpoints in /etc/fstab is in RO

arigaud opened this issue · 0 comments

Hello

Nice plugin but i have an issue.

I use -a option to check all mountpoints and -w to write file but manytimes machines are ro mountpoints and touch don't work, its normal.

I suggest you to insert a condition in line 266, but i think my code is not the better way to exclude RO mountpoints for this test.

            elif [ ${WRITETEST} -eq 1 ] && egrep -q "${MP}.*rw" ${FSTAB}; then
            ## if wanted an RW, check if it is writable
                    TOUCHFILE=${MP}/.mount_test_from_$(hostname)
                    touch ${TOUCHFILE} &>/dev/null
                    if [ $? -ne 0 ]; then
                            log "CRIT: ${TOUCHFILE} is not writable."
                            ERR_MESG[${#ERR_MESG[*]}]="${TOUCHFILE} is not writable."
                    else
                            rm ${TOUCHFILE} &>/dev/null
                    fi