| Version 1 (modified by trac, 7 years ago) (diff) |
|---|
CheckFileSize CheckFileSize is part of the wiki:CheckFile 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 becaous you can change the size for each drive by specifying multiple Size options. {|Option, Values, Description
| MaxWarn | Size with optional postfix | The maximum size the directory is allowed before a warning state is returned. |
| MaxCrit | Size with optional postfix | The maximum size the directory is allowed before a critical state is returned. |
| MinWarn | Size with optional postfix | The minimum size the directory is allowed before a warning state is returned. |
| MinCrit | Size with optional postfix | 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. |
|}
The “Size with optional postfix” is a way to simply specify large sizes by adding 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 and make sure it stays below 1 gigabyte:
CheckFileSize ShowAll MaxWarn=1024M MaxCrit=4096M File:WIN=c:\WINDOWS\*.* WARNING: WIN: 2G (2325339822B)|WIN=2325339822;1073741824;4294967296 define command {
command_name CheckFileSize command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MaxWarn=$ARG1$ MaxCrit=$ARG2$ File:$ARG4$=$ARG5$
}
check_command CheckFileSize!1024M!4096M!WIN!c:\WINDOWS\*.*
Check the size of the pagefile.sys and make sure it stays above 1 gigabyte:
CheckFileSize ShowAll MinWarn=1G MinCrit=512M File=c:\pagefile.sys OK: c:\pagefile.sys: 1G (1610612736B) define command {
command_name CheckPageFile? command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MinWarn=$ARG1$ MinCrit=$ARG2$ File:PageFile=c:\pagefile.sys
} check_command CheckPageFile?!1G!512M
Sample of using individual size for multiple files.:
CheckFileSize MaxWarn=2G MaxCrit=4G File=c:
pagefile.sys MaxWarn=1K MaxCrit=512 File=c:
boot.ini OK all file sizes are within bounds. define command {command_name CheckMyFiles? 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} check_command CheckMyFiles?








