CheckDriveSize

CheckDriveSize is part of the CheckDisk module

This check verifies the size of various drives specified on the command line. A request has one or more options described in the table below. The order only matters in that the size has to be specified before the Drive option because you can change the size for each drive by specifying multiple Size options.

OptionValuesDescription
MaxWarnFreesize-value or %The maximum allowed free space for the drive(s).
MaxCritFreesize-value or %The maximum allowed free space for the drive(s).
MinWarnFreesize-value or %The minimum allowed free space for the drive(s).
MinCritFreesize-value or %The minimum allowed free space for the drive(s).
MaxWarnUsedsize-value or %The maximum allowed used space for the drive(s).
MaxCritUsedsize-value or %The maximum allowed used space for the drive(s).
MinWarnUsedsize-value or %The minimum allowed used space for the drive(s).
MinCritUsedsize-value or %The minimum allowed used space for the drive(s).
ShowAllEmpty, longIf present will display information even if an item is not reporting a state. If set to long will display more information.
DriveA Drive letter or the path of a mounted VolumeThe letter of the drive to check.
FilterTypeFIXED, CDROM, REMOVABLE, REMOTEFilter for drive type to prevent checking drives of certain kinds (most useful when using CheckAll?). The default is FIXED
CheckAllNone,volumesCheck all available drives. Volume support is available since (0.3.8)
CheckAllOthersNoneCheck all drives (matching Filters) except those specified in the Drive= clause.
ignore-perf-dataA boolean flag to disable returning performance data

The size-value or % is a normal numeric-value with an optional unit or percentage postfix to specify large sizes. The available postfixes are B for Byte, K for Kilobyte, M for Megabyte, G for Gigabyte and finally % for percent free space.

Examples

Check C:

Check the size of C:\ and make sure it has 10% free space:

Sample Command:

CheckDriveSize ShowAll MinWarnFree=10% MinCritFree=5% Drive=c:\
CRITICAL: C:: Total: 74.5G - Used: 71.2G (95%) - Free: 3.28G (5%) < critical
Nagios Configuration:
define command {
  command_name <<CheckDriveSize>>
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=$ARG2$ MinCritFree=5% Drive=c:\
}
<<CheckDriveSize>> c:,5%!10%
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=10% MinCritFree=5% Drive=c:\

Volumes

To check the size of mounted volume c:\volumne_test and make sure it has 1M free space

Sample Command:

CheckDriveSize ShowAll MaxWarn=1M MaxCrit=2M Drive=c:\volumne_test
CRITICAL: C:: Total: 74.5G - Used: 71.2G (95%) - Free: 3.28G (5%) < critical
Nagios Configuration:
define command {
  command_name <<CheckDriveSize>>
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a ShowAll MaxWarn=$ARG2$ MaxCrit=$ARG3$ Drive=$ARG1$
}
<<CheckDriveSize>> c:\volumne_test!1M!2M
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckDriveSize -a ShowAll MaxWarn=1M MaxCrit=2M Drive=c:\volumne_test

Volumes

To check the size of all volume has 1M free space

Sample Command:

CheckDriveSize ShowAll MaxWarn=1M MaxCrit=2M CheckAll=volumes
CRITICAL: C:: Total: 74.5G - Used: 71.2G (95%) - Free: 3.28G (5%) < critical
Nagios Configuration:
define command {
  command_name <<CheckDriveSize>>
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a ShowAll MaxWarn=$ARG2$ MaxCrit=$ARG3$ CheckAll=volumes
}
<<CheckDriveSize>> c:\volumne_test!1M!2M
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckDriveSize -a ShowAll MaxWarn=1M MaxCrit=2M CheckAll=volumes

All fixed and network disks

To check the size of all fixed and network drives and make sure they have at least 1gig free space

Sample Command:

CheckDriveSize MinWarn=50% MinCrit=25% CheckAll FilterType=FIXED FilterType=REMOTE
CRITICAL: C:\;76514398208;1073741824;536870912; D:\;199303897088;1073741824;536870912; X:\;35467034624;1073741824;536870912; Y:\;299649466368;1073741824;536870912;
Nagios Configuration:
define command {
  command_name <<CheckDriveSize>>
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a MinWarn=$ARG2$ MinCrit=$ARG1$ CheckAll FilterType=FIXED FilterType=REMOTE
}
<<CheckDriveSize>> 25%!50%
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckDriveSize -a MinWarn=50% MinCrit=25% CheckAll FilterType=FIXED FilterType=REMOTE

Fixed and Network (ignore some)

Check all fixed and network drives but ignore C and F. Not sure about this (should be simpler ways)

Sample Command:

CheckDriveSize CheckAllOthers FilterType=FIXED FilterType=REMOTE MinWarn=25% MinCrit=50% Drive=C Drive=F
OK: ...
Nagios Configuration:
define command {
  command_name <<CheckDriveSize>>
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a CheckAllOthers FilterType=FIXED FilterType=REMOTE MinWarn=$ARG1$ MinCrit=$ARG2$ Drive=C Drive=F
}
<<CheckDriveSize>> 25%!50%
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckDriveSize -a CheckAllOthers FilterType=FIXED FilterType=REMOTE MinWarn=25% MinCrit=50% Drive=C Drive=F

Checking UNC Paths

Important to not forget the trailing \.

Sample Command:

CheckDriveSize Drive=x:\ FilterType=REMOTE ShowAll MaxWarnUsed=90% MaxCritUsed=95%
OK: ...
Nagios Configuration:
define command {
  command_name <<CheckDriveSize>>
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a Drive=x:\ FilterType=REMOTE ShowAll MaxWarnUsed=90% MaxCritUsed=$ARG2$
}
<<CheckDriveSize>> x:,90%!95%
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckDriveSize -a Drive=x:\ FilterType=REMOTE ShowAll MaxWarnUsed=90% MaxCritUsed=95%

Simple Config

Another example for a working config.

Sample Command:

CheckDriveSize Drive=c:\\volumes\\somevolume\\ ShowAll MaxWarnUsed=90% MaxCritUsed=95%
OK: ...
Nagios Configuration:
define command {
  command_name <<CheckDriveSize>>
  command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a Drive=c:\\volumes\\somevolume\\ ShowAll MaxWarnUsed=90% MaxCritUsed=$ARG2$
}
<<CheckDriveSize>> c:\\volumes\\somevolume\,90%!95%
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckDriveSize -a Drive=c:\\volumes\\somevolume\\ ShowAll MaxWarnUsed=90% MaxCritUsed=95%