Checkmk Windows agent fileinfo plugin

Hi all,

I am trying to configure a check for monitoring the size and age of a single file on a Windows server. I have managed to do it, by adjusting the configuration in the Checkmk Agent YAML file, under C:\Program Files (x86)\checkmk\service\check_mk.yml, under this section,

fileinfo:
    enabled: yes
    path: [
           - 'C:\tmp\test.txt'
          ]

then I created the monitoring rule under WATO in Checkmk, Setup > Service monitoring rules > Size and age of single files. Everything works properly and I get the notifications I need.

Here’s the thing, the actual file I would like to monitor, rolls over every night and the date changes to the current, for example today the log file is 20220315.log and tomorrow, it will become 20220316.log. So I need a way to adjust it dynamically, based on current date.

I have used the examples for using the date variable from this link, https://docs.checkmk.com/latest/en/mk_filestats.html - $DATE:%Y%m%d$, but I think it does not work properly for Windows hosts, here’s how it looks like,

fileinfo:
    enabled: yes
    path: [
           - 'C:\logs\$DATE:%Y%m%d$.log'
          ]

when running C:\Program Files (x86)\checkmk\service> .\check_mk_agent.exe test to test it out, I get the following,

C:\logs\$DATE:%Y%m%d$.log|missing|1647332814

Any thoughts on making it work?

Thank you.

I believe my issue is similar to this topic, https://forum.checkmk.com/t/check-mk-english-fileinfo-groups-date-specific-files-on-windows/16323, but there was no reply provided.

Hi,
this works for the Linux agent:

Karl

Hi Karl,

Right, that does make sense I guess, thank you. Any thoughts on making it work under Windows please?

Hi,
you can extend your pattern to *.log and then check for the age of this file - once a day.

Karl

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.