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

Can't exclude directory with regex_excl in vfs.dir.size

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 4.0.4rc1, 4.2.0alpha2, 4.2 (plan)
    • 3.4.14
    • Agent (G)
    • None
    • Debian 9
    • Sprint 43, Sprint 44, Sprint 45, Sprint 46, Nov 2018, Sprint 47, Dec 2018, Sprint 74 (Mar 2021)
    • 3

      I'm trying to get size of specified directory but exclude size of one subdirectory and files inside it. Directory structure looks like this:

       

      logs/
        archive/
          01.log
          02.log
        01.log
        02.log

       

      I want to exclude whole 'archive' folder and all files in it. Based on documentation regex_excl is what I need.

      regex_excl - regex describing the file, directory and symbolic link name pattern for exclusion (don't exclude any if empty; empty string is default value)

      But using regex_excl with directory name only excludes size of directory file itself (i.e. 4096 bytes) but not whole subtree size.

      Steps to reproduce:

      1. Create test directory structure like described above.
      2. Query size from Zabbix Agent
      3. # zabbix_get -s servername -k "vfs.dir.size[/tmp/logs]"
        3347012
        # du -bcs /tmp/logs
        3347012 /tmp/logs
        3347012 total
        
        # zabbix_get -s servername -k "vfs.dir.size[/tmp/logs,,archive]"
        3342916
        # du --exclude=archive -bcs /tmp/logs
        1850526 /tmp/logs
        1850526 total
        
        # zabbix_get -s servername -k "vfs.dir.size[/tmp/logs,,\.log]"
        8192
        # du --exclude=*log -bcs /tmp/logs
        8192    /tmp/logs
        8192    total

      Result:

      • With first request we get size of all files in target folder (/tmp/logs). du return same size.
      • With second request we get size of all files excluding size of 'archive' directory file (3347012 - 3342916 = 4096 bytes). 'du' returns different result because it does not count size of files in 'archive' directory.****
      • 3-rd request returns only size of 2 directory files: 'logs' and 'archive' all '*.log' files are excluded.

      Expected:
      Based on documentation description I expect regex_excl operate same way as --exclude key of du utility, but it behaves in different, unpredictable way.

            andris Andris Mednis
            hatifnatt Roman
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: