Ad Widget

Collapse

Monitor a directory for files older than X minutes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bbeaver
    Junior Member
    • Apr 2014
    • 8

    #1

    Monitor a directory for files older than X minutes

    I need to implement a monitor that will watch a particular directory on a Windows server, and alert if any files within this spool directory become older than a specified time. I'm currently handling this by using the Zabbix UserParameter option within my Windows Zabbix agent, and calling a Nagios plugin called check_winfile. This does what I need, but, I would prefer to handle using a Zabbix delivered function. Will Zabbix do this? I've been unable to find a Zabbix item that will provide this functionality. Thanks
  • coreychristian
    Senior Member
    Zabbix Certified Specialist
    • Jun 2012
    • 159

    #2
    If there are just some specific file names, you could use vfs.file.time[file,<mode>], otherwise you would need to use a user parameter as you are.

    Doing just a quick search (haven't tested anything) You could change your user parameter to something like the following if you need a count of the directory.

    forfiles /d -1 | find /C ""

    Comment

    • bbeaver
      Junior Member
      • Apr 2014
      • 8

      #3
      Thanks for the reply. Unfortunately the Windows forfiles command doesn't deal with minutes easily. I need to find files older than X minutes, not days. And if I'm going to write scripting to handle this, I may as well just reuse what has already been done, (check_winfile). Also, I won't always know the file names, so I need to alert if any files within a particular directory are older than X minutes.

      Comment

      • wpagane
        Member
        • Apr 2021
        • 31

        #4
        Originally posted by bbeaver
        Thanks for the reply. Unfortunately the Windows forfiles command doesn't deal with minutes easily. I need to find files older than X minutes, not days. And if I'm going to write scripting to handle this, I may as well just reuse what has already been done, (check_winfile). Also, I won't always know the file names, so I need to alert if any files within a particular directory are older than X minutes.
        Have you resolved that? I'm facing the same problem. Thank You.

        Comment

        Working...