Ad Widget

Collapse

Monitor files in folder creation date question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jrosetto
    Member
    • Apr 2015
    • 38

    #1

    Monitor files in folder creation date question

    I'm looking for a way to monitor files inside a folder and get an alert if no new files have been created within 7 days.

    I have an incremental backup dumping into a folder using duplicate. Basically it makes one master set of files and then creates incremental files there after.

    Is there a way in zabbix to monitor and give an alert if no files have been created in the directory for a set time?

    Any help or suggestions are greatly appreciated.

    Thanks.
  • Firm
    Senior Member
    • Dec 2009
    • 342

    #2
    Use vfs.file.time on folder. It's updated if files are created/deleted.

    Comment

    • jrosetto
      Member
      • Apr 2015
      • 38

      #3
      I jumped the gun. Let me start from the beginning.

      I am trying to create a low level discovery for any folder in the /home directory and give me the current size of it.

      This command gives me what I need but I am having issues converting it into JSON format for LLD

      du -h /home -d 1

      Output

      477M /home/cscrogersdt
      240K /home/routerbackup
      27G /home/cscjimmylt
      285M /home/aaaglass
      302M /home/smeadeddt
      3.0G /home/csclesdt
      21M /home/cscreceptiondt
      372M /home/aaamikedt
      43G /home/spmbiffdt
      1.5G /home/aaatracydt
      30M /home/iconcs
      30G /home/spmmikedt
      858M /home/embdougdt
      104G /home


      Also I'm not exactly sure what to make the key for the item.

      Any ideas?
      Last edited by jrosetto; 29-02-2016, 22:59.

      Comment

      • Firm
        Senior Member
        • Dec 2009
        • 342

        #4
        LLD should be used to automatically create Items, not feeding them with changing values. You need to create Items that represents folders and query agent for size of these folders.

        It may looks like this (add to zabbix_agentd.conf e.g.):
        Code:
        # LLD rule
        UserParameter=folder.discovery[*],/usr/bin/find $1 -maxdepth $2 -type d| /usr/bin/awk 'BEGIN {first=1; printf "%s","{\"data\":["} {if (first != 1) printf "%s",","; first=0; printf "{\"{#FOLDER_NAME}\":\"%s\"}",$$1} END {print "]}"}'
        # Folder size
        UserParameter=folder.size[*],/usr/bin/du -bs $1
        Create Discovery rule in Zabbix with "folder.discovery[/home,1]" key.

        Then create Item prototype with name like "Directory $1 size" and key like "folder.size[{#FOLDER_NAME}]" and type numeric unsigned.

        Create Graphs/Triggers if needed.

        Comment

        • jrosetto
          Member
          • Apr 2015
          • 38

          #5
          Thanks for the help. Everything is working perfectly. I did have to modify UserParameter=folder.size[*],/usr/bin/du -bs $1 adding | awk { print $ 1 } so it only gets the value. Also the vfs.file.time works great.

          Thanks for taking the time, it is greatly appreciated.

          Comment

          Working...