Check windows mount point NTFS Disk space


#1

Hi to all,

I have some servers that have local Hard disk mount as example C: and for this I have no problem to monitoring the
Disk Space
Few of this server has a directory as NTFS mount point ex: C:\DATA that is attach to a Storage are Network.
How I can monitoring the C:\DATA disk space ?

Bye


#2

Hello folks ,

I am having the same problem. I had already tried some plugins like check_disk_snmp.pl check_snmp_disk and every time I am receving erros in order to obtain info abou NTFS Mount Point.

Thanks in advance


#3

Hi I noticed this problem as well.
The default snmp from windows does not supply the information on mounted disks.
A workaround is installing SNMP informant.

Below you find the bash script that i use to check the disks via snmp informant.

you find the disks paths by running a snmpwalk -v 2c -c <community> <host> 1.3.6.1.4.1.9600.1.1

#!/bin/bash
#copyright (c) Tom Vansant
#license GPLv2

#version 1.0.0

PROGNAME=$0

print_usage() {
  echo "Usage: $PROGNAME -C <community> -H <hostname or ip> -p <path to check> -v <snmpversion>"
  echo "                 -c <critical value freespace in %,MB or GB> -w <warning value freespace in %,MB or GB>"
  echo "Usage: $PROGNAME -h"
  exit 3
}
crit_reading() {
crit=`echo $critical|grep M|cut -d "M" -f 1`
if test -z $crit
        then
        crit=`echo $critical|grep "%"|cut -d "%" -f 1`
        else
        critunit="MB"
        return
fi

if test -z $crit
        then
        crit=`echo $critical|grep G|cut -d "G" -f 1`
        else
        critunit="%"
        return
fi

if test -z $crit
        then
        echo "please specify the critical value like 10%,1000MB or 1GB"
        exit 3
        else
        critunit="GB"
fi
}

warn_reading() {
warn=`echo $warning|grep M|cut -d "M" -f 1`
if test -z $warn
        then
        warn=`echo $warning|grep "%"|cut -d "%" -f 1`
        else
        warnunit="MB"
        return
fi

if test -z $warn
        then
        warn=`echo $warning|grep G|cut -d "G" -f 1`
        else
        warnunit="%"
        return
fi

if test -z $warn
        then
        echo "please specify the warning value like 10%,1000MB or 1GB"
        exit 3
        else
        warnunit="GB"
fi
}

if test -z $1
        then
        print_usage
fi

while test -n "$1"; do
  case "$1" in
  --help)
    print_usage
    ;;
  -h)
    print_usage
    ;;
  --filename)
    logfile=$2
    shift
    ;;
  -H)
    hostname=$2
    shift
    ;;
  -p)
    pathtocheck=$2
    shift
    ;;
  -v)
    case "$2" in
      "1")
        snmpv=$2
        shift
        ;;
      "2c")
        snmpv=$2
        shift
        ;;
      "3")
        snmpv=$2
        shift
        ;;
      esac
      ;;
  -C)
        com=$2
        shift
        ;;
  -w)
        warning=$2
        shift
        ;;
  -c)
        critical=$2
        shift
        ;;
  *)
      echo "Unknown argument: $1"
      print_usage
      ;;
  esac
  shift
done

index=`snmpwalk -v $snmpv -c $com $hostname 1.3.6.1.4.1.9600.1.1.1.1.1 |grep $pathtocheck |sed s/"STRING: "//|cut -d = -f 1|sed s/"SNMPv2-SMI::enterprises.9600.1.1.1.1.1."//`
if test -z $index
then
        echo "DISK WARNING [No info from snmp]"
        exit 1
fi
profree=`snmpwalk -v $snmpv -c $com $hostname 1.3.6.1.4.1.9600.1.1.1.1.5.$index | sed s/"Gauge32: "//|cut -d = -f 2`

freeMB=`snmpwalk -v $snmpv -c $com $hostname 1.3.6.1.4.1.9600.1.1.1.1.20.$index | sed s/"Gauge32: "//|cut -d = -f 2`
freeMB=$((freeMB * 1000))
sizeMB=$(( $freeMB / $profree * 100 ))
sizeMB=$(( $sizeMB / 1000))
freeMB=$(( $freeMB / 1000))
usedMB=$(( $sizeMB - $freeMB ))

proinuse=$(( 100 - $profree ))
profree=`echo $profree |sed s/" "//g`
# echo $profree and $freeMB $usedMB $sizeMB

#echo "Diskinfo 	Totalsize	: $sizeMB MB"
#echo "		Inuse		: $usedMB MB ($proinuse %)"
#echo "		Free		: $freeMB MB ($profree %)"
#exit

sizeGB=$(( $sizeMB / 1024 ))
usedGB=$(( $usedMB / 1024 ))
availableGB=$(( $sizeGB - $usedGB ))


#echo $sizeGB $usedGB $availableGB $availableMB

crit_reading
warn_reading
checkwarn=0
case $warnunit in
%)
        if (("$warn" > "$profree"))
        then
                checkwarn=1
        fi
        ;;
MB)
        if (("$warn" > "$freeMB"))
        then
                checkwarn=1
        fi
        ;;
GB)
        if (("$warn" > "$availableGB"))
        then
                checkwarn=1
        fi
        ;;
esac
#echo $checkwarn
if (( $sizeGB < 10 ))
	then 
		unit=MB
		usedGB=$usedMB
		availableGB=$freeMB		
	else
		unit=GB
fi

if (("$checkwarn" == "1"))
        then
        checkcrit=0
        case $critunit in
        %)
               if (("$crit" > "$profree"))
                then
			echo "DISK CRITICAL $usedGB $unit in Use/$availableGB $unit Free]"
                        checkcrit=1
                        exit 2
                fi
                ;;
        MB)
                if (("$crit" > "$freeMB"))
                then
                        echo "DISK CRITICAL $usedGB $unit in Use/$availableGB $unit Free]"
                        checkcrit=1
                        exit 2
                fi
                ;;
        GB)
                if (("$crit" > "$availableGB"))
                then
                        echo "DISK CRITICAL $usedGB $unit in Use/$availableGB $unit Free]"
                        checkcrit=1
                        exit 2
                fi
                ;;
        GB)
                if (("$crit" > "$availableGB"))
                then
                        echo "DISK CRITICAL $usedGB $unit in Use/$availableGB $unit Free]"
                        checkcrit=1
                        exit 2
                fi
                ;;
        esac
        if (("$checkcrit" == "0" ))
        then
                        echo "DISK WARNING $usedGB $unit in Use/$availableGB $unit Free]"
                        exit 1
        fi
        else
                        echo "DISK OK $usedGB $unit in Use/$availableGB $unit Free]"
                        exit 0
fi