| Version 33 (modified by marty_one, 13 months ago) (diff) |
|---|
TracNav
Modules
- overview
Checks and commands
- overview
CauseCrashes...
CheckNSCP...
CheckDisk
CheckLogFile...
CheckEventLog...
CheckSystem...
CheckHelpers...
CheckTaskSched...
CheckTaskSched2...
CheckWMI...
Scripting Languages?...
Servers and protocols?...
Utilities and tools?...
Documentation...
Guides...
Information...
Sponsoring...
Donate...
CheckFileSize
CheckFileSize is part of the wiki:CheckDisk module
This check does a recursive size calculation of the directory (or file) specified. A request has one or more options described in the table below. The order only matter in that the size has to be specified before the File option this because you can change the size for each drive by specifying multiple Size options.
| Option | Values | Description |
| MaxWarn | size-value | The maximum size the directory is allowed before a warning state is returned. |
| MaxCrit | size-value | The maximum size the directory is allowed before a critical state is returned. |
| MinWarn | size-value | The minimum size the directory is allowed before a warning state is returned. |
| MinCrit | size-value | The minimum size the directory is allowed before a critical state is returned. |
| ShowAll | None | A Boolean flag to show size of directories that are not in an alarm state. If this is not specified only drives with an alarm state will be listed in the resulting string. |
| File | File or directory name | The name of the file or directory that should have its size calculated. Notice that large directory structures will take a long time to check. |
| File:<alias> | File or directory name | Same as the file option but using a short alias in the returned data. |
| debug | A boolean flag to set debug to true (0.3.8) | |
| ignore-perf-data | A boolean flag to disable returning performance data | |
The size-value is a normal numeric-value with a unit postfix. The available postfixes are B for Byte, K for Kilobyte, M for Megabyte and finally G for Gigabyte.
Examples
Check the size of the windows directory
Check the size of the windows directory and make sure it stays below 1 gigabyte. Sample Command:
CheckFileSize ShowAll MaxWarn=1024M MaxCrit=4096M File:_WIN=c:/WINDOWS/*.*
WARNING: WIN: 2G (2325339822B)Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MaxWarn=$ARG1$ MaxCrit=$ARG2$ File:$ARG3$=$ARG4$
}
<<CheckFileSize>> 1024M!4096M!_WIN!c:/WINDOWS/*.*
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckFileSize -a ShowAll MaxWarn=1024M MaxCrit=4096M File:_WIN=c:/WINDOWS/*.*
Check the size of the pagefile.sys
Check the size of the pagefile.sys and make sure it stays above 1 gigabyte. Sample Command:
CheckFileSize ShowAll MinWarn=1G MinCrit=512M File=c:/pagefile.sys
OK: c:/pagefile.sys: 1G (1610612736B)Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MinWarn=$ARG2$ MinCrit=$ARG1$ File=c:/pagefile.sys
}
<<CheckFileSize>> 512M!1G
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckFileSize -a ShowAll MinWarn=1G MinCrit=512M File=c:/pagefile.sys
Check the size of the file with spaces
Check the size of the mydb.db and make sure it stays below 1 gigabyte. Note that when passing the path/file as an argument, put that argument within quotes. Ex: monitorFileSize!100M!200M!myfile!"c:/Program\ Files/...". Sample Command:
CheckFileSize ShowAll MaxWarn=1024M MaxCrit=1500M "File:mydb=c:/Program\ Files/MyApp/mydb.db"
OKNagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MaxWarn=$ARG1$ MaxCrit=$ARG2$ "File:mydb=c:/Program\ Files/MyApp/mydb.db"
}
<<CheckFileSize>> 1024M!1500M
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckFileSize -a ShowAll MaxWarn=1024M MaxCrit=1500M "File:mydb=c:/Program\ Files/MyApp/mydb.db"
Multiple files
Sample of using individual size for multiple files. Sample Command:
CheckFileSize MaxWarn=2G MaxCrit=4G File=c:/pagefile.sys MaxWarn=1K MaxCrit=512 File=c:/boot.ini
OK: all file sizes are within bounds.Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a MaxWarn=2G MaxCrit=4G File=c:/pagefile.sys MaxWarn=1K MaxCrit=512 File=c:/boot.ini
}
<<CheckFileSize>>
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckFileSize -a MaxWarn=2G MaxCrit=4G File=c:/pagefile.sys MaxWarn=1K MaxCrit=512 File=c:/boot.ini
Single file
I have had to set this up like this for our Windows Server. Sample Command:
CheckFileSize MaxWarn=2G MaxCrit=4G File=c:/pagefile.sys MaxWarn=1K MaxCrit=512 File=c:/boot.ini
OK: all file sizes are within bounds.Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a MaxWarn=2G MaxCrit=4G File=c:/pagefile.sys MaxWarn=1K MaxCrit=512 File=c:/boot.ini
}
<<CheckFileSize>>
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckFileSize -a MaxWarn=2G MaxCrit=4G File=c:/pagefile.sys MaxWarn=1K MaxCrit=512 File=c:/boot.ini
Some exchange database thing
Sample Command:
CheckFileSize MaxWarn=13G MaxCrit=15.5G File=d:/exchsrvr/mdbdata/priv1.edb
OK: all file sizes are within bounds.Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a MaxWarn=$ARG1$ MaxCrit=$ARG2$ File=$ARG3$
}
<<CheckFileSize>> 13G!15.5G!d:/exchsrvr/mdbdata/priv1.edb
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckFileSize -a MaxWarn=13G MaxCrit=15.5G File=d:/exchsrvr/mdbdata/priv1.edb








