Count, size and age of files - delays windows agent

Hi Josef,

Issue: The “Count, size and age of files” rule (mk_filestats / fileinfo) causes massive slowdowns on some Windows hosts — agent runtime jumps from ~2 seconds to ~48–50 seconds, while the same rule runs fine on other hosts with similar file counts.

This is a well-known performance problem with the Windows agent when monitoring files.

Main causes:

  • The plugin uses globbing to scan directories. Even with only ~200 matching files, Windows can be very slow if the folder contains thousands of files, is on HDD, heavily fragmented, or scanned by antivirus in real-time.
  • Too broad patterns (e.g. C:\Backups** or recursive search) make it dramatically worse.

Quick recommendations:

  1. Make your include patterns as narrow and specific as possible (e.g. C:\PG_Backups*.backup instead of broad wildcards).
  2. Test the section manually on the slow host:
"C:\Program Files (x86)\checkmk\agent\check_mk_agent.exe" fileinfo
  1. Consider running the rule less frequently or switch to a custom local check (PowerShell) for better performance.
  2. On servers with many files, use aggregation options like count_only where possible.

See also:

Can you share the exact include/exclude patterns you are using in the rule? That usually helps pinpoint the bottleneck.

by the way
3. Consider running the rule less frequently or switch to a custom local check (PowerShell) for better performance.

it`s my preference

Greets Bernd