Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-26477

vfs.dir.get ignores entries with last modification time at unixtime=zero

XMLWordPrintable

    • Sprint candidates

      Steps to reproduce:

      1. start a zabbix agent, for example:
        sudo docker run --name some-zabbix-agent -e ZBX_ACTIVE_ALLOW=false -e ZBX_ACTIVESERVERS="" -e ZBX_DEBUGLEVEL=4 -e ZBX_SERVER_HOST=127.0.0.1 zabbix/zabbix-agent2:7.2.7-ubuntu
        
      2. do a zabbix_get with key vfs.dir.get for any non-empty directory and count the returned occurences, for example:
        sudo docker exec -it some-zabbix-agent zabbix_get -s 127.0.0.1 -k 'vfs.dir.get[/usr/sbin/zabbix-agent2-plugin]' | python3 -m json.tool | grep pathname | cat -n
        

        which returns

             1            "pathname": "/usr/sbin/zabbix-agent2-plugin/mssql",
             2            "pathname": "/usr/sbin/zabbix-agent2-plugin/mongodb",
             3            "pathname": "/usr/sbin/zabbix-agent2-plugin/nvidia-gpu",
             4            "pathname": "/usr/sbin/zabbix-agent2-plugin/postgresql",
             5            "pathname": "/usr/sbin/zabbix-agent2-plugin/ember-plus",
        
      3. set the last modification time of any of the files in the directory to unix timestamp zero (1970-01-01T00:00:00Z)
        sudo docker exec -itu 0 some-zabbix-agent touch -d @0 /usr/sbin/zabbix-agent2-plugin/mssql
        
      4. repeat step two, the output has one less entry than in step 2
             1            "pathname": "/usr/sbin/zabbix-agent2-plugin/mongodb",
             2            "pathname": "/usr/sbin/zabbix-agent2-plugin/nvidia-gpu",
             3            "pathname": "/usr/sbin/zabbix-agent2-plugin/postgresql",
             4            "pathname": "/usr/sbin/zabbix-agent2-plugin/ember-plus"
        
      5. (optional), verify that the missing file still exists
        sudo docker exec -it some-zabbix-agent zabbix_get -s 127.0.0.1 -k 'vfs.file.get[/usr/sbin/zabbix-agent2-plugin/mssql]' | python3 -m json.tool` returns
        which returns
        {
            "basename": "mssql",
            "pathname": "/usr/sbin/zabbix-agent2-plugin/mssql",
            "dirname": "/usr/sbin/zabbix-agent2-plugin",
            "type": "file",
            "user": "root",
            "group": "root",
            "permissions": "0755",
            "uid": 0,
            "gid": 0,
            "size": 7612824,
            "time": {
                "access": null,
                "modify": "1970-01-01T00:00:00Z",
                "change": "2025-05-26T17:12:44.289446205Z"
            },
            "timestamp": {
                "access": null,
                "modify": 0,
                "change": 1748279564
            }
        }
        
      6. (optional) set the last modification time of the file in the directory to unix timestamp one (1970-01-01T00:00:01Z)
        Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
        sudo docker exec -itu 0 some-zabbix-agent touch -d @1 /usr/sbin/zabbix-agent2-plugin/mssql
        
      7. (optional) notice the file is again listed
        sudo docker exec -it some-zabbix-agent zabbix_get -s 127.0.0.1 -k 'vfs.dir.get[/usr/sbin/zabbix-agent2-plugin]' | python3 -m json.tool | grep pathname | cat -n
        

        which returns

             1            "pathname": "/usr/sbin/zabbix-agent2-plugin/mssql",
             2            "pathname": "/usr/sbin/zabbix-agent2-plugin/mongodb",
             3            "pathname": "/usr/sbin/zabbix-agent2-plugin/nvidia-gpu",
             4            "pathname": "/usr/sbin/zabbix-agent2-plugin/postgresql",
             5            "pathname": "/usr/sbin/zabbix-agent2-plugin/ember-plus",
        

      Result:
      Output at step 2 differs from output at step 4
      Expected:
      Output at step 2 matches output at step 4

            zabbix.dev Zabbix Development Team
            rumo Marc Rumo
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: