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

Inconsistencies in vfs.fs.size used size reporting

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 4.0.22
    • Agent (G)
    • None

      When calculating 'used' file system size agent subtracts free blocks from total blocks. But when calculating 'pused' agent uses available blocks rather than free blocks and used+available as total size rather than total blocks.

      if (NULL != total)
      	*total = (zbx_uint64_t)s.f_blocks * s.ZBX_BSIZE;
      
      if (NULL != free)
      	*free = (zbx_uint64_t)s.f_bavail * s.ZBX_BSIZE;
      
      if (NULL != used)
      	*used = (zbx_uint64_t)(s.f_blocks - s.f_bfree) * s.ZBX_BSIZE;
      
      if (NULL != pfree)
      {
      	if (0 != s.f_blocks - s.f_bfree + s.f_bavail)
      		*pfree = (double)(100.0 * s.f_bavail) / (s.f_blocks - s.f_bfree + s.f_bavail);
      	else
      		*pfree = 0;
      }
      
      if (NULL != pused)
      {
      	if (0 != s.f_blocks - s.f_bfree + s.f_bavail)
      		*pused = 100.0 - (double)(100.0 * s.f_bavail) / (s.f_blocks - s.f_bfree + s.f_bavail);
      	else
      		*pused = 0;
      }
      

      As the result used + free is not equal to total (there can be ~5% difference), also pused, pfree also differs by few percents from value calculated by using total, used, free statistics.

      The explanation of used statvfs free/available metrics:

          fsblkcnt_t     f_blocks;   /* size of fs in f_frsize units */
          fsblkcnt_t     f_bfree;    /* # free blocks */
          fsblkcnt_t     f_bavail;   /* # free blocks for unprivileged users */
      

            zabbix.dev Zabbix Development Team
            wiper Andris Zeila
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: