Monitoring files on a host can be a very useful part of application monitoring. Here we will describe some use cases and how to configure them.
With Checkmk you can monitor single files for pure existence, it's age and size, etc. But it is also sometimes necessary to group several files into one service and impose those rules and thresholds to such a file group.
1. Configuration of the agent
In the first step we need to tell the agent which files should be monitored. This can be done with the Checkmk agent bakery in Checkmk Enterprise, Enterprise Free and managed service edition. In Checkmk RAW Edition this needs to be done manually.
1a. With agent bakery (Enterprise editions):
Create a new rule of type Setup → Agents → Windows, Linux, Solaris, AIX → Agent rules → Count, size and age of files (Linux, Windows) and specify which files to be transferred:
Take a look at the inline help for possible patterns.
Bake & Sign the agent to deploy the new agent configuration.
1b. Without agent bakery (RAW edition):
In the file C:\ProgramData\checkmk\agent\check_mk.user.yml create a fileinfo section like this:
fileinfo:
enabled: true
path:
- c:\temp\*.txt
- c:\path\to\file.dat
and restart the Checkmk agent.
Please be aware that paths and files are case-sensitive, even in the Windows agent
2. Monitoring of single files
You can now rediscover your host, and you will find the single files that you configured in step 1 and you can add them to monitoring:
After that you can create rules to specify how to monitor those files.
Go to the "hamburger" menu of that service and click parameters for this service
and click on "Size and age of single files" to create a rule as desired,
for example like this with a threshold for the maximum age