Ad Widget

Collapse

vfs.file.exists - Current Date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • syntax1127
    Junior Member
    • Nov 2014
    • 19

    #1

    vfs.file.exists - Current Date

    Hi,
    I need to make a trigger on Zabbix that will send an Email when a specific file in specific folder with the current day exists or not.
    So I tried the command :
    Zabbix-get -s x.x.x.x(remote machine ip ) -k "vfs.file.exists[c:\tmp\14-11-25.zip]
    This return 1 which means the file exists and it's OK.
    However, this is not good enough because I need to check it daily.
    Meaning I need to check whether file have been received everyday.
    In other words, I need to make sure that a zip file with the current date has arrived to specific folder. Moreover the format of the file is yy-mm-dd.zip and cannot be changed.
    Any idea how to accomplish that?
    Thanks in advance
  • syntax1127
    Junior Member
    • Nov 2014
    • 19

    #2
    Hi

    No one? No Idea?
    Please help...Thanks again

    Comment

    • miglesiassarria
      Junior Member
      • Apr 2016
      • 3

      #3
      i have the same case.
      someone can help me please?

      Comment

      • DukeNukem3D
        Junior Member
        • Jan 2015
        • 12

        #4
        Absolutely same case, plz help

        Comment

        • DukeNukem3D
          Junior Member
          • Jan 2015
          • 12

          #5
          Hi all!

          I found a workaround:
          create simple bash script in 'externalscripts' directory on your server like this:

          Code:
          #!/bin/sh
          #
          # filename format example 192.168.49.9_2016-05-01.cfg
          
          ip=$1
          date=`date +%F`
          filename='/tftp/'$ip'_'$date'.cfg'
          
          # echo $ip
          # echo $date
          # echo $filename
          
          
          if [ -e $filename ]; then
           echo 1
          else
           echo 0
          fi
          My files are located exactly on the same server, but you can modify it.

          Then create item with external check and key ip-date["{HOST.CONN}"] - it will pass Host's IP address to the script as first argument. After it create trigger depending on your needs.

          Comment

          • neb
            Junior Member
            • Apr 2020
            • 1

            #6
            is no any new way to insert date in vfs.file.exists ?
            Upd:
            pre-solving problem - using "UserParameter" feature: in agent config add
            Code:
            UserParameter=test[*],if exist c:\$1%date%.txt (echo 0) else echo 1
            and item key is:
            Code:
            test[backup_file_name]
            and triggers for "missing backup" is:
            Code:
            {my_host:test[backup_file_name].last(#1)}=1
            Last edited by neb; 18-04-2020, 17:28.

            Comment

            • duan.vutien
              Junior Member
              • Oct 2022
              • 1

              #7
              Thanks neb, this is exactly what I was looking for.

              Comment

              Working...