title: Observe directory: size, file count and growth rate
agents: linux, windows
catalog: os/storage
license: GPLv2
distribution: check_mk
description:
 Monitors one or more directories configured via the "Observe directory" agent Bakery
 rule. For every immediate subdirectory of each configured directory -- and for the
 configured directory itself -- this check reports:

 - the total size in bytes, recursively (including all nested subdirectories),
 - the total number of files, recursively,
 - size growth: the plain change in size since the closest measurement at least
   "growth interval" (a configurable check parameter, default 1 day) in the past --
   e.g. with a 30-minute interval, "grew by 5 GiB" means exactly that, over the last
   ~30 minutes, not a rate normalised to some other unit,
 - file count growth: the same, for the number of files -- catches a runaway
   process creating many small files even before it has moved enough bytes to trip
   the size threshold.

 Upper levels can be configured for size, size growth, file count and file count
 growth, either as fixed values or via Checkmk's Predictive Monitoring. A freshly
 discovered service reports "collecting baseline" for both growth signals until it
 has a measurement old enough to compare against (i.e. for about one "growth
 interval" after discovery, or after the interval is increased).

 The agent side only ever reports the current, absolute size and file
 count; all history and both growth computations happen in this check
 plugin, so the growth interval can be changed at any time without
 redeploying the agent plugin.

 Linux hosts run the Python agent plugin, Windows hosts its PowerShell port
 (observe_directory.ps1); both report the same section, and one Bakery rule
 deploys whichever matches the host's agent package.

 This check will go stale (UNKNOWN) if the observe_directory agent plugin
 is not deployed or not configured on a host, like any other missing
 section.

item:
 The absolute path of the configured directory (for the directory itself),
 or "{directory}/{subdirectory name}" for each of its immediate
 subdirectories ("{directory}\{subdirectory name}" on Windows hosts).

discovery:
 One service is created for every immediate subdirectory found by the
 agent plugin, plus one service for the watched directory itself. This can
 be tuned (minimum size/file count, name exclude patterns, whether to
 discover the directory itself) via the "Observe directory: service
 discovery" ruleset.
