`CheckDisk`
CheckDisk can check various file and disk related things.

# `CheckDisk` — CheckDisk

CheckDisk can check various file and disk related things.

Queries (Overview):

A list of all available queries (check commands)

Command | Description
--- | ---
`check_drivesize` | Check the size (free-space) of a drive or volume.
`check_files` | Check various aspects of a file and/or folder.
`checkdrivesize` | Legacy version of check_drivesize
`checkfiles` | Legacy version of check_drivesize

Commands (Overview):

TODO: Add a list of all external commands (this is not check commands)

## Queries

A quick reference for all available queries (check commands) in the CheckDisk module.

### `check_drivesize`

`CheckDisk` `check_drivesize`
Check the size (free-space) of a drive or volume.

Usage:

Option | Default Value | Description
--- | --- | ---
`help` | N/A | Show help screen (this screen)
`help-pb` | N/A | Show help screen as a protocol buffer payload
`show-default` | N/A | Show default values for a given command
`help-short` | N/A | Show help screen (short format).
`debug` | N/A | Show debugging information in the log
`show-all` | N/A | Show debugging information in the log
`filter` |  | Filter which marks interesting items.
`warning` | used > 80% | Filter which marks items which generates a warning state.
`warn` |  | Short alias for warning
`critical` | used > 90% | Filter which marks items which generates a critical state.
`crit` |  | Short alias for critical.
`ok` |  | Filter which marks items which generates an ok state.
`empty-state` | unknown | Return status to use when nothing matched filter.
`perf-config` |  | Performance data generation configuration
`top-syntax` | ${status} ${problem_list} | Top level syntax.
`ok-syntax` | %(status) All %(count) drive(s) are ok | ok syntax.
`empty-syntax` | %(status): No drives found | Empty syntax.
`detail-syntax` | ${drive_or_name}: ${used}/${size} used | Detail level syntax.
`perf-syntax` | ${drive_or_id} | Performance alias syntax.
`drive` |  | The drives to check.
`ignore-unreadable` | N/A | Ignore drives which are not reachable by the current user.
`mounted` | N/A | Show only mounted rives i.e. drives which have a mount point.
`magic` |  | Magic number for use with scaling drive sizes.
`exclude` |  | A list of drives not to check
`total` | N/A | Include the total of all matching drives

#### Samples

To check the size of the C:drive and make sure it has atleast 10% free space:

    check_drivesize "crit=free<10%" drive=c:
    L     client CRITICAL: c:: 205GB/223GB used
    L     client  Performance data: 'c: free'=18GB;0;22;0;223 'c: free %'=8%;0;9;0;100

To check the size of all the drives and make sure it has atleast 10% free space:

    check_drivesize "crit=free<10%" drive=*
    L     client OK: All drives ok
    L     client  Performance data: 'C:\ free'=18GB;0;2;0;223 'C:\ free %'=8%;0;0;0;100 'D:\ free'=18GB;0;4;0;465 'D:\ free %'=3%;0;0;0;100 'M:\ free'=83GB;0;27;0;2746 'M:\ free %'=3%;0;0;0;100

To check the size of all the drives and display all values, not just problems:

    check_drivesize drive=* --show-all
    L     client CRITICAL: c:: 205GB/223GB used
    L     client  Performance data: 'c: free'=18GB;0;22;0;223 'c: free %'=8%;0;9;0;100

To check the size of all the drives and return the value in gigabytes. By default units on performance data will be scaled to “something apropriate”:

    check_drivesize "perf-config=*(unit:g)"
    L        cli CRITICAL: CRITICAL C:\: 208.147GB/223.471GB used, D:\: 399.607GB/465.759GB used
    L        cli  Performance data: 'C:\ used'=0.00019g;0.00017;0.00019;0;0.00021 'C:\ used %'=93%;79;89;0;100 'D:\ used'=0.00038g;0.00035;0.00039;0;0.00044 'D:\ used %'=85%;79;89;0;100 'E:\ used'=0g;0;0;0;0 '\\?\Volume{d458535f-27c7-11e4-be66-806e6f6e6963}\ used'=0g;0;0;0;0 '\\?\Volume{d458535f-27c7-11e4-be66-806e6f6e6963}\ used %'=33%;79;89;0;100

To check the size of a mounted volume (c:volumne_test) and make sure it has 1M free space warn if free space is less then 10M:

    check_drivesize "crit=free<1M" "warn=free<10M" drive=c:\\volumne_test
    C:: Total: 74.5G - Used: 71.2G (95%) - Free: 3.28G (5%) < critical,C:;5%;10;5;

To check the size of all volumes and make sure they have 1M space free:

    check_drivesize "crit=free<1M" drive=all-volumes
    L     client OK: All drives ok
    L     client  Performance data: 'C:\ free'=18GB;0;2;0;223 'C:\ free %'=8%;0;0;0;100 'D:\ free'=18GB;0;4;0;465 'D:\ free %'=3%;0;0;0;100 'E:\ free'=0B;0;0;0;0 'F:\ free'=0B;0;0;0;0

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

    check_drivesize "crit=free<1g" drive=* "filter=type in ('fixed', 'remote')"
    L     client OK: All drives ok
    L     client  Performance data: 'C:\ free'=18GB;0;2;0;223 'C:\ free %'=8%;0;0;0;100 'D:\ free'=18GB;0;4;0;465 'D:\ free %'=3%;0;0;0;100 'M:\ free'=83GB;0;27;0;2746 'M:\ free %'=3%;0;0;0;100

To check all fixed and network drives but ignore C and F:

    check_drivesize "crit=free<1g" drive=* "filter=type in ('fixed', 'remote')" exclude=C:\\ exclude=D:\\
    L     client OK: All drives ok
    L     client  Performance data: 'M:\ free'=83GB;0;27;0;2746 'M:\ free %'=3%;0;0;0;100

To checking UNC Paths. Please note that I need to use \ to escape the back-slashes from check_nrpe you can escape using ‘ instead which is simpler:

    check_drivesize drive=\\\\medin-ds\\data\\ "crit=free<10%"
    L     client CRITICAL: \\medin-ds\data\: 2.6TB/2.68TB used
    L     client  Performance data: '\\medin-ds\data\ free'=83GB;0;274;0;2746 '\\medin-ds\data\ free %'=3%;0;9;0;100

Important

Please note that UNC paths are only avalible in each session meaning a user mounted share will not be visible to NSClient++ (since services run in their own session). But as long as NSClient++ can access the share it still works as long as you specify the UNC path. In other words the following will NOT work:

    check_drivesize drive=m:

But the following will:

    check_drivesize drive=\\myserver\\mydrive

Important

Do not forget the trailing .

Default via NRPE:

    check_nrpe --host 192.168.56.103 --command check_drivesize
    C:\: 205GB/223GB used, D:\: 448GB/466GB used, M:\: 2.6TB/2.68TB used|'C:\ used'=204GB;44;22;0;223 'C:\ used %'=91%;19;9;0;100 'D:\ used'=447GB;93;46;0;465...

#### Arguments

`help` (CheckDisk, check_drivesize)
  Show help screen (this screen)

`help-pb` (CheckDisk, check_drivesize)
  Show help screen as a protocol buffer payload

`show-default` (CheckDisk, check_drivesize)
  Show default values for a given command

`help-short` (CheckDisk, check_drivesize)
  Show help screen (short format).

`debug` (CheckDisk, check_drivesize)
  Show debugging information in the log

`show-all` (CheckDisk, check_drivesize)
  Show debugging information in the log

`filter` (CheckDisk, check_drivesize)
  Filter which marks interesting items.
  Interesting items are items which will be included in the check.
  They do not denote warning or critical state but they are checked use this to filter out unwanted items.
  Available options:

  Key | Value
  drive | Technical name of drive
  drive_or_id | Drive letter if present if not use id
  drive_or_name | Drive letter if present if not use name
  free | Shorthand for total_free (Number of free bytes)
  free_pct | Shorthand for total_free_pct (% free space)
  id | Drive or id of drive
  mounted | Check if a drive is mounted
  name | Descriptive name of drive
  size | Total size of drive
  total_free | Number of free bytes
  total_free_pct | % free space
  total_used | Number of used bytes
  total_used_pct | % used space
  type | Type of drive
  used | Number of used bytes
  used_pct | Shorthand for total_used_pct (% used space)
  user_free | Free space available to user (which runs NSClient++)
  user_free_pct | % free space available to user
  user_used | Number of used bytes (related to user)
  user_used_pct | % used space available to user
  count | Number of items matching the filter
  total | Total number of items
  ok_count | Number of items matched the ok criteria
  warn_count | Number of items matched the warning criteria
  crit_count | Number of items matched the critical criteria
  problem_count | Number of items matched either warning or critical criteria
  list | A list of all items which matched the filter
  ok_list | A list of all items which matched the ok criteria
  warn_list | A list of all items which matched the warning criteria
  crit_list | A list of all items which matched the critical criteria
  problem_list | A list of all items which matched either the critical or the warning criteria
  detail_list | A special list with critical, then warning and fainally ok
  status | The returned status (OK/WARN/CRIT/UNKNOWN)

`warning` (CheckDisk, check_drivesize)
  Filter which marks items which generates a warning state.
  If anything matches this filter the return status will be escalated to warning.
  Available options:

  Key | Value
  drive | Technical name of drive
  drive_or_id | Drive letter if present if not use id
  drive_or_name | Drive letter if present if not use name
  free | Shorthand for total_free (Number of free bytes)
  free_pct | Shorthand for total_free_pct (% free space)
  id | Drive or id of drive
  mounted | Check if a drive is mounted
  name | Descriptive name of drive
  size | Total size of drive
  total_free | Number of free bytes
  total_free_pct | % free space
  total_used | Number of used bytes
  total_used_pct | % used space
  type | Type of drive
  used | Number of used bytes
  used_pct | Shorthand for total_used_pct (% used space)
  user_free | Free space available to user (which runs NSClient++)
  user_free_pct | % free space available to user
  user_used | Number of used bytes (related to user)
  user_used_pct | % used space available to user
  count | Number of items matching the filter
  total | Total number of items
  ok_count | Number of items matched the ok criteria
  warn_count | Number of items matched the warning criteria
  crit_count | Number of items matched the critical criteria
  problem_count | Number of items matched either warning or critical criteria
  list | A list of all items which matched the filter
  ok_list | A list of all items which matched the ok criteria
  warn_list | A list of all items which matched the warning criteria
  crit_list | A list of all items which matched the critical criteria
  problem_list | A list of all items which matched either the critical or the warning criteria
  detail_list | A special list with critical, then warning and fainally ok
  status | The returned status (OK/WARN/CRIT/UNKNOWN)

`warn` (CheckDisk, check_drivesize)
  Short alias for warning

`critical` (CheckDisk, check_drivesize)
  Filter which marks items which generates a critical state.
  If anything matches this filter the return status will be escalated to critical.
  Available options:

  Key | Value
  drive | Technical name of drive
  drive_or_id | Drive letter if present if not use id
  drive_or_name | Drive letter if present if not use name
  free | Shorthand for total_free (Number of free bytes)
  free_pct | Shorthand for total_free_pct (% free space)
  id | Drive or id of drive
  mounted | Check if a drive is mounted
  name | Descriptive name of drive
  size | Total size of drive
  total_free | Number of free bytes
  total_free_pct | % free space
  total_used | Number of used bytes
  total_used_pct | % used space
  type | Type of drive
  used | Number of used bytes
  used_pct | Shorthand for total_used_pct (% used space)
  user_free | Free space available to user (which runs NSClient++)
  user_free_pct | % free space available to user
  user_used | Number of used bytes (related to user)
  user_used_pct | % used space available to user
  count | Number of items matching the filter
  total | Total number of items
  ok_count | Number of items matched the ok criteria
  warn_count | Number of items matched the warning criteria
  crit_count | Number of items matched the critical criteria
  problem_count | Number of items matched either warning or critical criteria
  list | A list of all items which matched the filter
  ok_list | A list of all items which matched the ok criteria
  warn_list | A list of all items which matched the warning criteria
  crit_list | A list of all items which matched the critical criteria
  problem_list | A list of all items which matched either the critical or the warning criteria
  detail_list | A special list with critical, then warning and fainally ok
  status | The returned status (OK/WARN/CRIT/UNKNOWN)

`crit` (CheckDisk, check_drivesize)
  Short alias for critical.

`ok` (CheckDisk, check_drivesize)
  Filter which marks items which generates an ok state.
  If anything matches this any previous state for this item will be reset to ok.
  Available options:

  Key | Value
  drive | Technical name of drive
  drive_or_id | Drive letter if present if not use id
  drive_or_name | Drive letter if present if not use name
  free | Shorthand for total_free (Number of free bytes)
  free_pct | Shorthand for total_free_pct (% free space)
  id | Drive or id of drive
  mounted | Check if a drive is mounted
  name | Descriptive name of drive
  size | Total size of drive
  total_free | Number of free bytes
  total_free_pct | % free space
  total_used | Number of used bytes
  total_used_pct | % used space
  type | Type of drive
  used | Number of used bytes
  used_pct | Shorthand for total_used_pct (% used space)
  user_free | Free space available to user (which runs NSClient++)
  user_free_pct | % free space available to user
  user_used | Number of used bytes (related to user)
  user_used_pct | % used space available to user
  count | Number of items matching the filter
  total | Total number of items
  ok_count | Number of items matched the ok criteria
  warn_count | Number of items matched the warning criteria
  crit_count | Number of items matched the critical criteria
  problem_count | Number of items matched either warning or critical criteria
  list | A list of all items which matched the filter
  ok_list | A list of all items which matched the ok criteria
  warn_list | A list of all items which matched the warning criteria
  crit_list | A list of all items which matched the critical criteria
  problem_list | A list of all items which matched either the critical or the warning criteria
  detail_list | A special list with critical, then warning and fainally ok
  status | The returned status (OK/WARN/CRIT/UNKNOWN)

`empty-state` (CheckDisk, check_drivesize)
  Return status to use when nothing matched filter.
  If no filter is specified this will never happen unless the file is empty.

`perf-config` (CheckDisk, check_drivesize)
  Performance data generation configuration
  TODO: obj ( key: value; key: value) obj (key:valuer;key:value)

`top-syntax` (CheckDisk, check_drivesize)
  Top level syntax.
  Used to format the message to return can include strings as well as special keywords such as:

  Key | Value
  %(drive) | Technical name of drive
  %(drive_or_id) | Drive letter if present if not use id
  %(drive_or_name) | Drive letter if present if not use name
  %(free) | Shorthand for total_free (Number of free bytes)
  %(free_pct) | Shorthand for total_free_pct (% free space)
  %(id) | Drive or id of drive
  %(mounted) | Check if a drive is mounted
  %(name) | Descriptive name of drive
  %(size) | Total size of drive
  %(total_free) | Number of free bytes
  %(total_free_pct) | % free space
  %(total_used) | Number of used bytes
  %(total_used_pct) | % used space
  %(type) | Type of drive
  %(used) | Number of used bytes
  %(used_pct) | Shorthand for total_used_pct (% used space)
  %(user_free) | Free space available to user (which runs NSClient++)
  %(user_free_pct) | % free space available to user
  %(user_used) | Number of used bytes (related to user)
  %(user_used_pct) | % used space available to user
  ${count} | Number of items matching the filter
  ${total} | Total number of items
  ${ok_count} | Number of items matched the ok criteria
  ${warn_count} | Number of items matched the warning criteria
  ${crit_count} | Number of items matched the critical criteria
  ${problem_count} | Number of items matched either warning or critical criteria
  ${list} | A list of all items which matched the filter
  ${ok_list} | A list of all items which matched the ok criteria
  ${warn_list} | A list of all items which matched the warning criteria
  ${crit_list} | A list of all items which matched the critical criteria
  ${problem_list} | A list of all items which matched either the critical or the warning criteria
  ${detail_list} | A special list with critical, then warning and fainally ok
  ${status} | The returned status (OK/WARN/CRIT/UNKNOWN)

`ok-syntax` (CheckDisk, check_drivesize)
  ok syntax.
  DEPRECATED! This is the syntax for when an ok result is returned.
  This value will not be used if your syntax contains %(list) or %(count).

`empty-syntax` (CheckDisk, check_drivesize)
  Empty syntax.
  DEPRECATED! This is the syntax for when nothing matches the filter.
  Possible values are:

  Key | Value
  %(drive) | Technical name of drive
  %(drive_or_id) | Drive letter if present if not use id
  %(drive_or_name) | Drive letter if present if not use name
  %(free) | Shorthand for total_free (Number of free bytes)
  %(free_pct) | Shorthand for total_free_pct (% free space)
  %(id) | Drive or id of drive
  %(mounted) | Check if a drive is mounted
  %(name) | Descriptive name of drive
  %(size) | Total size of drive
  %(total_free) | Number of free bytes
  %(total_free_pct) | % free space
  %(total_used) | Number of used bytes
  %(total_used_pct) | % used space
  %(type) | Type of drive
  %(used) | Number of used bytes
  %(used_pct) | Shorthand for total_used_pct (% used space)
  %(user_free) | Free space available to user (which runs NSClient++)
  %(user_free_pct) | % free space available to user
  %(user_used) | Number of used bytes (related to user)
  %(user_used_pct) | % used space available to user
  ${count} | Number of items matching the filter
  ${total} | Total number of items
  ${ok_count} | Number of items matched the ok criteria
  ${warn_count} | Number of items matched the warning criteria
  ${crit_count} | Number of items matched the critical criteria
  ${problem_count} | Number of items matched either warning or critical criteria
  ${list} | A list of all items which matched the filter
  ${ok_list} | A list of all items which matched the ok criteria
  ${warn_list} | A list of all items which matched the warning criteria
  ${crit_list} | A list of all items which matched the critical criteria
  ${problem_list} | A list of all items which matched either the critical or the warning criteria
  ${detail_list} | A special list with critical, then warning and fainally ok
  ${status} | The returned status (OK/WARN/CRIT/UNKNOWN)

`detail-syntax` (CheckDisk, check_drivesize)
  Detail level syntax.
  This is the syntax of each item in the list of top-syntax (see above).
  Possible values are:

  Key | Value
  %(drive) | Technical name of drive
  %(drive_or_id) | Drive letter if present if not use id
  %(drive_or_name) | Drive letter if present if not use name
  %(free) | Shorthand for total_free (Number of free bytes)
  %(free_pct) | Shorthand for total_free_pct (% free space)
  %(id) | Drive or id of drive
  %(mounted) | Check if a drive is mounted
  %(name) | Descriptive name of drive
  %(size) | Total size of drive
  %(total_free) | Number of free bytes
  %(total_free_pct) | % free space
  %(total_used) | Number of used bytes
  %(total_used_pct) | % used space
  %(type) | Type of drive
  %(used) | Number of used bytes
  %(used_pct) | Shorthand for total_used_pct (% used space)
  %(user_free) | Free space available to user (which runs NSClient++)
  %(user_free_pct) | % free space available to user
  %(user_used) | Number of used bytes (related to user)
  %(user_used_pct) | % used space available to user
  ${count} | Number of items matching the filter
  ${total} | Total number of items
  ${ok_count} | Number of items matched the ok criteria
  ${warn_count} | Number of items matched the warning criteria
  ${crit_count} | Number of items matched the critical criteria
  ${problem_count} | Number of items matched either warning or critical criteria
  ${list} | A list of all items which matched the filter
  ${ok_list} | A list of all items which matched the ok criteria
  ${warn_list} | A list of all items which matched the warning criteria
  ${crit_list} | A list of all items which matched the critical criteria
  ${problem_list} | A list of all items which matched either the critical or the warning criteria
  ${detail_list} | A special list with critical, then warning and fainally ok
  ${status} | The returned status (OK/WARN/CRIT/UNKNOWN)

`perf-syntax` (CheckDisk, check_drivesize)
  Performance alias syntax.
  This is the syntax for the base names of the performance data.
  Possible values are:

  Key | Value
  %(drive) | Technical name of drive
  %(drive_or_id) | Drive letter if present if not use id
  %(drive_or_name) | Drive letter if present if not use name
  %(free) | Shorthand for total_free (Number of free bytes)
  %(free_pct) | Shorthand for total_free_pct (% free space)
  %(id) | Drive or id of drive
  %(mounted) | Check if a drive is mounted
  %(name) | Descriptive name of drive
  %(size) | Total size of drive
  %(total_free) | Number of free bytes
  %(total_free_pct) | % free space
  %(total_used) | Number of used bytes
  %(total_used_pct) | % used space
  %(type) | Type of drive
  %(used) | Number of used bytes
  %(used_pct) | Shorthand for total_used_pct (% used space)
  %(user_free) | Free space available to user (which runs NSClient++)
  %(user_free_pct) | % free space available to user
  %(user_used) | Number of used bytes (related to user)
  %(user_used_pct) | % used space available to user
  ${count} | Number of items matching the filter
  ${total} | Total number of items
  ${ok_count} | Number of items matched the ok criteria
  ${warn_count} | Number of items matched the warning criteria
  ${crit_count} | Number of items matched the critical criteria
  ${problem_count} | Number of items matched either warning or critical criteria
  ${list} | A list of all items which matched the filter
  ${ok_list} | A list of all items which matched the ok criteria
  ${warn_list} | A list of all items which matched the warning criteria
  ${crit_list} | A list of all items which matched the critical criteria
  ${problem_list} | A list of all items which matched either the critical or the warning criteria
  ${detail_list} | A special list with critical, then warning and fainally ok
  ${status} | The returned status (OK/WARN/CRIT/UNKNOWN)

`drive` (CheckDisk, check_drivesize)
  The drives to check.
  Multiple options can be used to check more then one drive or wildcards can be used to indicate multiple drives to check. Examples: drive=c, drive=d:, drive=*, drive=all-volumes, drive=all-drives

`ignore-unreadable` (CheckDisk, check_drivesize)
  Ignore drives which are not reachable by the current user.
  For instance Microsoft Office creates a drive which cannot be read by normal users.

`mounted` (CheckDisk, check_drivesize)
  Show only mounted rives i.e. drives which have a mount point.

`magic` (CheckDisk, check_drivesize)
  Magic number for use with scaling drive sizes.

`exclude` (CheckDisk, check_drivesize)
  A list of drives not to check

`total` (CheckDisk, check_drivesize)
  Include the total of all matching drives

### `check_files`

`CheckDisk` `check_files`
Check various aspects of a file and/or folder.

Usage:

Option | Default Value | Description
--- | --- | ---
`help` | N/A | Show help screen (this screen)
`help-pb` | N/A | Show help screen as a protocol buffer payload
`show-default` | N/A | Show default values for a given command
`help-short` | N/A | Show help screen (short format).
`debug` | N/A | Show debugging information in the log
`show-all` | N/A | Show debugging information in the log
`filter` |  | Filter which marks interesting items.
`warning` |  | Filter which marks items which generates a warning state.
`warn` |  | Short alias for warning
`critical` |  | Filter which marks items which generates a critical state.
`crit` |  | Short alias for critical.
`ok` |  | Filter which marks items which generates an ok state.
`empty-state` | unknown | Return status to use when nothing matched filter.
`perf-config` |  | Performance data generation configuration
`top-syntax` | ${status}: ${problem_count}/${count} files (${problem_list}) | Top level syntax.
`ok-syntax` | %(status): All %(count) files are ok | ok syntax.
`empty-syntax` | No files found | Empty syntax.
`detail-syntax` | ${name} | Detail level syntax.
`perf-syntax` | ${name} | Performance alias syntax.
`path` |  | The path to search for files under.
`file` |  | Alias for path.
`paths` |  | A comma separated list of paths to scan
`pattern` | . | The pattern of files to search for (works like a filter but is faster and can be combined with a filter).
`max-depth` |  | Maximum depth to recurse
`total` | N/A | Include the total of all matching files

#### Samples

Order is somewhat important but mainly in the fact that some operations are more costly then others. For instance line_count requires us to read and count the lines in each file so choosing between the following: Fast version:

    filter=create < -2d and line_count > 100

Show version:

    filter=line_count > 100 and create < -2d

The first one will be significantly faster if you have a thousand old files and 3 new ones. But looking at the following:

    filter=create < -2d and size > 100k

Swapping them would not be noticeable.

Checking file versions:

    check_files path=D:/tmp pattern=*.exe "filter=version != 1.0" "syntax=%filename%: %version%" MaxWarn=1
    WARNING:explorer.exe: 6.0.2900.5512, explorer.exe: 1 > warning|'explorer.exe'=1;0;0;

Checking file versions using exact bound:

    check_files path=D:/tmp pattern=*.exe "filter=version != 1.0" "syntax=%filename%: %version%" warn=gt:1 crit==1
    WARNING:explorer.exe: 6.0.2900.5512, explorer.exe: 1 > warning|'explorer.exe'=1;0;0;

Using the line count with limited recursion:

    check_files path=D:\windows pattern=*.txt max-dir-depth=1 "filter=line_count gt 100" "syntax=%filename%: %line_count%" MaxWarn=1
    WARNING:test.txt: 3, test.txt: 1 > warning|'test.txt'=1;0;0;

Check file sizes:

    check_files path=D:\tmp pattern=*.txt "filter=size gt 20" "syntax=%filename%: %size%" MaxWarn=1
    WARNING:test.txt: 26B, found files: 1 > warning|'found files'=1;0;0;

#### Arguments

`help` (CheckDisk, check_files)
  Show help screen (this screen)

`help-pb` (CheckDisk, check_files)
  Show help screen as a protocol buffer payload

`show-default` (CheckDisk, check_files)
  Show default values for a given command

`help-short` (CheckDisk, check_files)
  Show help screen (short format).

`debug` (CheckDisk, check_files)
  Show debugging information in the log

`show-all` (CheckDisk, check_files)
  Show debugging information in the log

`filter` (CheckDisk, check_files)
  Filter which marks interesting items.
  Interesting items are items which will be included in the check.
  They do not denote warning or critical state but they are checked use this to filter out unwanted items.
  Available options:

  Key | Value
  access | Last access time
  access_l | Last access time (local time)
  access_u | Last access time (UTC)
  age | Seconds since file was last written
  creation | When file was created
  creation_l | When file was created (local time)
  creation_u | When file was created (UTC)
  file | The name of the file
  filename | The name of the file
  line_count | Number of lines in the file (text files)
  name | The name of the file
  path | Path of file
  size | File size
  total | True if this is the total object
  version | Windows exe/dll file version
  write | Alias for written
  written | When file was last written to
  written_l | When file was last written to (local time)
  written_u | When file was last written to (UTC)
  count | Number of items matching the filter
  total | Total number of items
  ok_count | Number of items matched the ok criteria
  warn_count | Number of items matched the warning criteria
  crit_count | Number of items matched the critical criteria
  problem_count | Number of items matched either warning or critical criteria
  list | A list of all items which matched the filter
  ok_list | A list of all items which matched the ok criteria
  warn_list | A list of all items which matched the warning criteria
  crit_list | A list of all items which matched the critical criteria
  problem_list | A list of all items which matched either the critical or the warning criteria
  detail_list | A special list with critical, then warning and fainally ok
  status | The returned status (OK/WARN/CRIT/UNKNOWN)

`warning` (CheckDisk, check_files)
  Filter which marks items which generates a warning state.
  If anything matches this filter the return status will be escalated to warning.
  Available options:

  Key | Value
  access | Last access time
  access_l | Last access time (local time)
  access_u | Last access time (UTC)
  age | Seconds since file was last written
  creation | When file was created
  creation_l | When file was created (local time)
  creation_u | When file was created (UTC)
  file | The name of the file
  filename | The name of the file
  line_count | Number of lines in the file (text files)
  name | The name of the file
  path | Path of file
  size | File size
  total | True if this is the total object
  version | Windows exe/dll file version
  write | Alias for written
  written | When file was last written to
  written_l | When file was last written to (local time)
  written_u | When file was last written to (UTC)
  count | Number of items matching the filter
  total | Total number of items
  ok_count | Number of items matched the ok criteria
  warn_count | Number of items matched the warning criteria
  crit_count | Number of items matched the critical criteria
  problem_count | Number of items matched either warning or critical criteria
  list | A list of all items which matched the filter
  ok_list | A list of all items which matched the ok criteria
  warn_list | A list of all items which matched the warning criteria
  crit_list | A list of all items which matched the critical criteria
  problem_list | A list of all items which matched either the critical or the warning criteria
  detail_list | A special list with critical, then warning and fainally ok
  status | The returned status (OK/WARN/CRIT/UNKNOWN)

`warn` (CheckDisk, check_files)
  Short alias for warning

`critical` (CheckDisk, check_files)
  Filter which marks items which generates a critical state.
  If anything matches this filter the return status will be escalated to critical.
  Available options:

  Key | Value
  access | Last access time
  access_l | Last access time (local time)
  access_u | Last access time (UTC)
  age | Seconds since file was last written
  creation | When file was created
  creation_l | When file was created (local time)
  creation_u | When file was created (UTC)
  file | The name of the file
  filename | The name of the file
  line_count | Number of lines in the file (text files)
  name | The name of the file
  path | Path of file
  size | File size
  total | True if this is the total object
  version | Windows exe/dll file version
  write | Alias for written
  written | When file was last written to
  written_l | When file was last written to (local time)
  written_u | When file was last written to (UTC)
  count | Number of items matching the filter
  total | Total number of items
  ok_count | Number of items matched the ok criteria
  warn_count | Number of items matched the warning criteria
  crit_count | Number of items matched the critical criteria
  problem_count | Number of items matched either warning or critical criteria
  list | A list of all items which matched the filter
  ok_list | A list of all items which matched the ok criteria
  warn_list | A list of all items which matched the warning criteria
  crit_list | A list of all items which matched the critical criteria
  problem_list | A list of all items which matched either the critical or the warning criteria
  detail_list | A special list with critical, then warning and fainally ok
  status | The returned status (OK/WARN/CRIT/UNKNOWN)

`crit` (CheckDisk, check_files)
  Short alias for critical.

`ok` (CheckDisk, check_files)
  Filter which marks items which generates an ok state.
  If anything matches this any previous state for this item will be reset to ok.
  Available options:

  Key | Value
  access | Last access time
  access_l | Last access time (local time)
  access_u | Last access time (UTC)
  age | Seconds since file was last written
  creation | When file was created
  creation_l | When file was created (local time)
  creation_u | When file was created (UTC)
  file | The name of the file
  filename | The name of the file
  line_count | Number of lines in the file (text files)
  name | The name of the file
  path | Path of file
  size | File size
  total | True if this is the total object
  version | Windows exe/dll file version
  write | Alias for written
  written | When file was last written to
  written_l | When file was last written to (local time)
  written_u | When file was last written to (UTC)
  count | Number of items matching the filter
  total | Total number of items
  ok_count | Number of items matched the ok criteria
  warn_count | Number of items matched the warning criteria
  crit_count | Number of items matched the critical criteria
  problem_count | Number of items matched either warning or critical criteria
  list | A list of all items which matched the filter
  ok_list | A list of all items which matched the ok criteria
  warn_list | A list of all items which matched the warning criteria
  crit_list | A list of all items which matched the critical criteria
  problem_list | A list of all items which matched either the critical or the warning criteria
  detail_list | A special list with critical, then warning and fainally ok
  status | The returned status (OK/WARN/CRIT/UNKNOWN)

`empty-state` (CheckDisk, check_files)
  Return status to use when nothing matched filter.
  If no filter is specified this will never happen unless the file is empty.

`perf-config` (CheckDisk, check_files)
  Performance data generation configuration
  TODO: obj ( key: value; key: value) obj (key:valuer;key:value)

`top-syntax` (CheckDisk, check_files)
  Top level syntax.
  Used to format the message to return can include strings as well as special keywords such as:

  Key | Value
  %(access) | Last access time
  %(access_l) | Last access time (local time)
  %(access_u) | Last access time (UTC)
  %(age) | Seconds since file was last written
  %(creation) | When file was created
  %(creation_l) | When file was created (local time)
  %(creation_u) | When file was created (UTC)
  %(file) | The name of the file
  %(filename) | The name of the file
  %(line_count) | Number of lines in the file (text files)
  %(name) | The name of the file
  %(path) | Path of file
  %(size) | File size
  %(total) | True if this is the total object
  %(version) | Windows exe/dll file version
  %(write) | Alias for written
  %(written) | When file was last written to
  %(written_l) | When file was last written to (local time)
  %(written_u) | When file was last written to (UTC)
  ${count} | Number of items matching the filter
  ${total} | Total number of items
  ${ok_count} | Number of items matched the ok criteria
  ${warn_count} | Number of items matched the warning criteria
  ${crit_count} | Number of items matched the critical criteria
  ${problem_count} | Number of items matched either warning or critical criteria
  ${list} | A list of all items which matched the filter
  ${ok_list} | A list of all items which matched the ok criteria
  ${warn_list} | A list of all items which matched the warning criteria
  ${crit_list} | A list of all items which matched the critical criteria
  ${problem_list} | A list of all items which matched either the critical or the warning criteria
  ${detail_list} | A special list with critical, then warning and fainally ok
  ${status} | The returned status (OK/WARN/CRIT/UNKNOWN)

`ok-syntax` (CheckDisk, check_files)
  ok syntax.
  DEPRECATED! This is the syntax for when an ok result is returned.
  This value will not be used if your syntax contains %(list) or %(count).

`empty-syntax` (CheckDisk, check_files)
  Empty syntax.
  DEPRECATED! This is the syntax for when nothing matches the filter.
  Possible values are:

  Key | Value
  %(access) | Last access time
  %(access_l) | Last access time (local time)
  %(access_u) | Last access time (UTC)
  %(age) | Seconds since file was last written
  %(creation) | When file was created
  %(creation_l) | When file was created (local time)
  %(creation_u) | When file was created (UTC)
  %(file) | The name of the file
  %(filename) | The name of the file
  %(line_count) | Number of lines in the file (text files)
  %(name) | The name of the file
  %(path) | Path of file
  %(size) | File size
  %(total) | True if this is the total object
  %(version) | Windows exe/dll file version
  %(write) | Alias for written
  %(written) | When file was last written to
  %(written_l) | When file was last written to (local time)
  %(written_u) | When file was last written to (UTC)
  ${count} | Number of items matching the filter
  ${total} | Total number of items
  ${ok_count} | Number of items matched the ok criteria
  ${warn_count} | Number of items matched the warning criteria
  ${crit_count} | Number of items matched the critical criteria
  ${problem_count} | Number of items matched either warning or critical criteria
  ${list} | A list of all items which matched the filter
  ${ok_list} | A list of all items which matched the ok criteria
  ${warn_list} | A list of all items which matched the warning criteria
  ${crit_list} | A list of all items which matched the critical criteria
  ${problem_list} | A list of all items which matched either the critical or the warning criteria
  ${detail_list} | A special list with critical, then warning and fainally ok
  ${status} | The returned status (OK/WARN/CRIT/UNKNOWN)

`detail-syntax` (CheckDisk, check_files)
  Detail level syntax.
  This is the syntax of each item in the list of top-syntax (see above).
  Possible values are:

  Key | Value
  %(access) | Last access time
  %(access_l) | Last access time (local time)
  %(access_u) | Last access time (UTC)
  %(age) | Seconds since file was last written
  %(creation) | When file was created
  %(creation_l) | When file was created (local time)
  %(creation_u) | When file was created (UTC)
  %(file) | The name of the file
  %(filename) | The name of the file
  %(line_count) | Number of lines in the file (text files)
  %(name) | The name of the file
  %(path) | Path of file
  %(size) | File size
  %(total) | True if this is the total object
  %(version) | Windows exe/dll file version
  %(write) | Alias for written
  %(written) | When file was last written to
  %(written_l) | When file was last written to (local time)
  %(written_u) | When file was last written to (UTC)
  ${count} | Number of items matching the filter
  ${total} | Total number of items
  ${ok_count} | Number of items matched the ok criteria
  ${warn_count} | Number of items matched the warning criteria
  ${crit_count} | Number of items matched the critical criteria
  ${problem_count} | Number of items matched either warning or critical criteria
  ${list} | A list of all items which matched the filter
  ${ok_list} | A list of all items which matched the ok criteria
  ${warn_list} | A list of all items which matched the warning criteria
  ${crit_list} | A list of all items which matched the critical criteria
  ${problem_list} | A list of all items which matched either the critical or the warning criteria
  ${detail_list} | A special list with critical, then warning and fainally ok
  ${status} | The returned status (OK/WARN/CRIT/UNKNOWN)

`perf-syntax` (CheckDisk, check_files)
  Performance alias syntax.
  This is the syntax for the base names of the performance data.
  Possible values are:

  Key | Value
  %(access) | Last access time
  %(access_l) | Last access time (local time)
  %(access_u) | Last access time (UTC)
  %(age) | Seconds since file was last written
  %(creation) | When file was created
  %(creation_l) | When file was created (local time)
  %(creation_u) | When file was created (UTC)
  %(file) | The name of the file
  %(filename) | The name of the file
  %(line_count) | Number of lines in the file (text files)
  %(name) | The name of the file
  %(path) | Path of file
  %(size) | File size
  %(total) | True if this is the total object
  %(version) | Windows exe/dll file version
  %(write) | Alias for written
  %(written) | When file was last written to
  %(written_l) | When file was last written to (local time)
  %(written_u) | When file was last written to (UTC)
  ${count} | Number of items matching the filter
  ${total} | Total number of items
  ${ok_count} | Number of items matched the ok criteria
  ${warn_count} | Number of items matched the warning criteria
  ${crit_count} | Number of items matched the critical criteria
  ${problem_count} | Number of items matched either warning or critical criteria
  ${list} | A list of all items which matched the filter
  ${ok_list} | A list of all items which matched the ok criteria
  ${warn_list} | A list of all items which matched the warning criteria
  ${crit_list} | A list of all items which matched the critical criteria
  ${problem_list} | A list of all items which matched either the critical or the warning criteria
  ${detail_list} | A special list with critical, then warning and fainally ok
  ${status} | The returned status (OK/WARN/CRIT/UNKNOWN)

`path` (CheckDisk, check_files)
  The path to search for files under.
  Notice that specifying multiple path will create an aggregate set you will not check each path individually.In other words if one path contains an error the entire check will result in error.

`file` (CheckDisk, check_files)
  Alias for path.

`paths` (CheckDisk, check_files)
  A comma separated list of paths to scan

`pattern` (CheckDisk, check_files)
  The pattern of files to search for (works like a filter but is faster and can be combined with a filter).

`max-depth` (CheckDisk, check_files)
  Maximum depth to recurse

`total` (CheckDisk, check_files)
  Include the total of all matching files

### `checkdrivesize`

`CheckDisk` `checkdrivesize`
Legacy version of check_drivesize

Usage:

Option | Default Value | Description
--- | --- | ---
`help` | N/A | Show help screen (this screen)
`help-pb` | N/A | Show help screen as a protocol buffer payload
`show-default` | N/A | Show default values for a given command
`help-short` | N/A | Show help screen (short format).
`CheckAll` | true | Checks all drives.
`CheckAllOthers` | true | Checks all drives turns the drive option into an exclude option.
`Drive` |  | The drives to check
`FilterType` |  | The type of drives to check fixed, remote, cdrom, ramdisk, removable
`perf-unit` |  | Force performance data to use a given unit prevents scaling which can cause problems over time in some graphing solutions.
`ShowAll` | short | Configures display format (if set shows all items not only failures, if set to long shows all cores).
`MaxWarn` |  | Maximum value before a warning is returned.
`MaxCrit` |  | Maximum value before a critical is returned.
`MinWarn` |  | Minimum value before a warning is returned.
`MinCrit` |  | Minimum value before a critical is returned.
`MaxWarnFree` |  | Maximum value before a warning is returned.
`MaxCritFree` |  | Maximum value before a critical is returned.
`MinWarnFree` |  | Minimum value before a warning is returned.
`MinCritFree` |  | Minimum value before a critical is returned.
`MaxWarnUsed` |  | Maximum value before a warning is returned.
`MaxCritUsed` |  | Maximum value before a critical is returned.
`MinWarnUsed` |  | Minimum value before a warning is returned.
`MinCritUsed` |  | Minimum value before a critical is returned.

#### Arguments

`help` (CheckDisk, checkdrivesize)
  Show help screen (this screen)

`help-pb` (CheckDisk, checkdrivesize)
  Show help screen as a protocol buffer payload

`show-default` (CheckDisk, checkdrivesize)
  Show default values for a given command

`help-short` (CheckDisk, checkdrivesize)
  Show help screen (short format).

`CheckAll` (CheckDisk, checkdrivesize)
  Checks all drives.

`CheckAllOthers` (CheckDisk, checkdrivesize)
  Checks all drives turns the drive option into an exclude option.

`Drive` (CheckDisk, checkdrivesize)
  The drives to check

`FilterType` (CheckDisk, checkdrivesize)
  The type of drives to check fixed, remote, cdrom, ramdisk, removable

`perf-unit` (CheckDisk, checkdrivesize)
  Force performance data to use a given unit prevents scaling which can cause problems over time in some graphing solutions.

`ShowAll` (CheckDisk, checkdrivesize)
  Configures display format (if set shows all items not only failures, if set to long shows all cores).

`MaxWarn` (CheckDisk, checkdrivesize)
  Maximum value before a warning is returned.

`MaxCrit` (CheckDisk, checkdrivesize)
  Maximum value before a critical is returned.

`MinWarn` (CheckDisk, checkdrivesize)
  Minimum value before a warning is returned.

`MinCrit` (CheckDisk, checkdrivesize)
  Minimum value before a critical is returned.

`MaxWarnFree` (CheckDisk, checkdrivesize)
  Maximum value before a warning is returned.

`MaxCritFree` (CheckDisk, checkdrivesize)
  Maximum value before a critical is returned.

`MinWarnFree` (CheckDisk, checkdrivesize)
  Minimum value before a warning is returned.

`MinCritFree` (CheckDisk, checkdrivesize)
  Minimum value before a critical is returned.

`MaxWarnUsed` (CheckDisk, checkdrivesize)
  Maximum value before a warning is returned.

`MaxCritUsed` (CheckDisk, checkdrivesize)
  Maximum value before a critical is returned.

`MinWarnUsed` (CheckDisk, checkdrivesize)
  Minimum value before a warning is returned.

`MinCritUsed` (CheckDisk, checkdrivesize)
  Minimum value before a critical is returned.

### `checkfiles`

`CheckDisk` `checkfiles`
Legacy version of check_drivesize

Usage:

Option | Default Value | Description
--- | --- | ---
`help` | N/A | Show help screen (this screen)
`help-pb` | N/A | Show help screen as a protocol buffer payload
`show-default` | N/A | Show default values for a given command
`help-short` | N/A | Show help screen (short format).
`syntax` |  | Syntax for individual items (detail-syntax).
`master-syntax` |  | Syntax for top syntax (top-syntax).
`path` |  | The file or path to check
`pattern` |  | Deprecated and ignored
`alias` |  | Deprecated and ignored
`debug` | N/A | Debug
`max-dir-depth` |  | The maximum level to recurse
`filter` |  | The filter to use when including files in the check
`warn` |  | Deprecated and ignored
`crit` |  | Deprecated and ignored
`MaxWarn` |  | Maximum value before a warning is returned.
`MaxCrit` |  | Maximum value before a critical is returned.
`MinWarn` |  | Minimum value before a warning is returned.
`MinCrit` |  | Minimum value before a critical is returned.

#### Arguments

`help` (CheckDisk, checkfiles)
  Show help screen (this screen)

`help-pb` (CheckDisk, checkfiles)
  Show help screen as a protocol buffer payload

`show-default` (CheckDisk, checkfiles)
  Show default values for a given command

`help-short` (CheckDisk, checkfiles)
  Show help screen (short format).

`syntax` (CheckDisk, checkfiles)
  Syntax for individual items (detail-syntax).

`master-syntax` (CheckDisk, checkfiles)
  Syntax for top syntax (top-syntax).

`path` (CheckDisk, checkfiles)
  The file or path to check

`pattern` (CheckDisk, checkfiles)
  Deprecated and ignored

`alias` (CheckDisk, checkfiles)
  Deprecated and ignored

`debug` (CheckDisk, checkfiles)
  Debug

`max-dir-depth` (CheckDisk, checkfiles)
  The maximum level to recurse

`filter` (CheckDisk, checkfiles)
  The filter to use when including files in the check

`warn` (CheckDisk, checkfiles)
  Deprecated and ignored

`crit` (CheckDisk, checkfiles)
  Deprecated and ignored

`MaxWarn` (CheckDisk, checkfiles)
  Maximum value before a warning is returned.

`MaxCrit` (CheckDisk, checkfiles)
  Maximum value before a critical is returned.

`MinWarn` (CheckDisk, checkfiles)
  Minimum value before a warning is returned.

`MinCrit` (CheckDisk, checkfiles)
  Minimum value before a critical is returned.

comments powered by Disqus