Why Monitor a Directory in the First Place
- Processing backlogs: Files are just piling up faster than they are getting consumed
- Stalled interfaces: A source system that's stopped delivering files entirely
- Silent failures: A scheduled job that didn't trigger at all, so the target folder is sitting completely empty
- Runaway growth: The directory expanding rapidly and threatening available disk space
Pre-requisites for configuring Directory Monitoring on Windows Server Using Datadog
- The Datadog Agent (v6 or v7) has to already be installed and running on the Windows server. This is an important detail: the Directory check runs locally on the Agent, so it can only watch folders on the same machine it's installed on. It can't reach across the network to monitor a remote share.
- The Agent service itself needs to be healthy. You can confirm this either through the Datadog Agent Manager GUI or by executing the command below in PowerShell:
"C:\\Program Files\\Datadog\\Datadog Agent\\bin\\agent.exe" status - You'll need administrator access to the server, since you'll be modifying configuration files under `%ProgramData%\\Datadog` and restarting Datadog Agent.
- The account under which the Agent service runs (commonly ddagentuser) must have read permissions on the folder you intend to monitor. If this permission is missing, the check will fail with a permissions error.
What Metrics Does the Directory Check Actually Give You
- system.disk.directory.bytes (gauge) - It will tell the total size of the directory, shown as bytes
- system.disk.directory.file.bytes (gauge) -It will tell the total size of the file, shown as bytes
- system.disk.directory.file.created_sec_ago (gauge) - It will tell the duration since creation, shown as seconds
- system.disk.directory.file.modified_sec_ago (gauge) - It will tell the Duration since last modification, shown as seconds
- system.disk.directory.files (gauge) - It will give the count of files in the directory, shown as files
- system.disk.directory.folders (gauge) - It will give the count of folders in the directory, shown as files
Realtime Walkthrough: Monitoring a Folder's File Count
Step 1: Find the Configuration File
- Log in to the target Windows server with an administrator account.
- Navigate to the Agent's configuration folder, typically %ProgramData%\Datadog\conf.d.
- Open the `directory.d` subfolder inside it.
- You'll usually find either a `conf.yaml` or a `conf.yaml.example` file there. If only the `.example` version exists, duplicate it and rename the copy to `conf.yaml`. This matters because the Agent only reads files literally named `conf.yaml`; the example file is ignored entirely.
Step 2: Point the Check at Your Folder
Step 3: Restart the Datadog Agent
- Windows Button + R and type services.msc -> Datadog Agent (Restart)
- Open PowerShell and type Restart-Service -Name DatadogAgent -Force
Step 4: Confirm the Agent Picked It Up
Seeing above PowerShell output block can confirm the Agent has loaded your configuration and is actively watching `C:\\Veerpedia`. As an extra check, running `agent.exe status` and looking under Collector / Running Checks for the directory entry will confirm it's actually executing, not just configured.
Step 5: Verify the Metric in Datadog
With the check running server-side, the last step is confirming the data is landing in Datadog:
- Log in to the Datadog web app.
- Go to Metrics > Explorer.
- Search for `system.disk.directory.file.created\_sec\_ago.count` — remember, this is the sub-metric that effectively gives you the file count.
In the from field, scope it down using the tag you set, e.g. `name:c\_veerpedia`, and optionally the host tag too. Please refer to the snapshot below for your understanding.
Switch the visualisation to Query Value and set a short time window (Past 5 Minutes works well for testing). And you should see a number reflecting how many files are currently in the folder. An empty directory shows as "No data."
Once you have confirmed it's accurate, either share the metric directly or click Save to Dashboard so the application team has it visible going forward.
Note: We can also configure Monitors to trigger alerts when a specific count of files gets stuck in the Directory, so that the application team will fix the issue before it impacts operations
Troubleshooting Steps
- Check not showing in Datadog configcheck output: Make sure the file name is exactly conf.yaml and not conf.yaml.example or conf.yaml.txt. The file should be placed under: %ProgramData%\Datadog\conf.d\directory.d\ After fixing the name or location, restart the Agent once.
- The agent fails to start, or the check shows an error after editing. This usually happens because of a YAML syntax or indentation error. Validate the file carefully, ensure you’re using spaces (not tabs), and check the Agent logs here: %ProgramData%\Datadog\logs\agent.log
- Error: ‘No such file or directory’ / directory not found: Confirm that the path actually exists on this machine and that backslashes are properly escaped (for example: "C:\\Veerpedia").
- If the folder may not always be present and you want to avoid the check failing, set ignore_missing: true in the instance configuration.
- Permission denied: The Datadog Agent service runs as ddagentuser. Give this account read access to the directory and its contents, then restart the Agent.





