########################################################### check_nfs_client -e 
#!/bin/bash
function printUsage() {
        local BASENAME=`basename $0`
        echo "Usage: $BASENAME [-V] [-h] [-w warning_threshold] [-c critical threshold] [-u url] [-l username] [-a password]  -H hostname"
}

function printVersion() {
        local VERSION="0.0.1-alpha"
        local BASENAME=`basename $0`
        echo "$BASENAME (nagios-plugins-hosteurope 1.0.0) $VERSION"
        echo "This nagios plugin comes with ABSOLUTELY NO WARRANTY. You may not redistribute
copies of the plugins under the terms of any FOO General Public License.
For more information about these matters, bang your head against the WALL."
}

function printHelp() {
        printUsage
        echo "This plugin checks  blabla"
        echo "Example: blbla"
        echo " "
        echo "-V        Version"
        echo "-h        help"
        echo "-e        alarms enabled, defaults to true. if false always return ok"
        echo " "
        exit 0
}

while getopts ":Vht:w:c:H:va:l:p:e:" Option
do
        case $Option in
        V)
                printVersion
                exit 3
        ;;
        h)
                printHelp
                exit 3
        ;;
        e)
                if [ "$OPTARG" == "FALSE" ] ; then
                        echo "OK - check skipped / disabled"
                        exit 0
                fi
        ;;
        esac
done
shift $(($OPTIND - 1))

# stale mount ?
[ `df -k | grep "Stale NFS file handle" | wc -l` -gt 0 ] && (echo "NOK - Stale NFS mounts."; exit 2)

# Nothing caused to exit early, so we're okay.
echo "OK - No stale NFS mounts."
exit 0
