1 Discovery of mounted filesystems

Overview

It is possible to discover mounted filesystems and their properties:

  • mountpoint name
  • mountpoint type
  • filesystem size
  • inode statistics
  • mount options

To do that, you may use a combination of:

  • the vfs.fs.get agent item as the master item
  • dependent low-level discovery rule and item prototypes

Configuration

Master item

Create a Zabbix agent item using the following key:

  1. vfs.fs.get

1 Discovery of mounted filesystems - 图1

Set the type of information to “Text” for possibly big JSON data.

The data returned by this item will contain something like the following for a mounted filesystem:

  1. [
  2. {
  3. "fsname": "/",
  4. "fstype": "ext4",
  5. "bytes": {
  6. "total": 249405239296,
  7. "free": 24069537792,
  8. "used": 212595294208,
  9. "pfree": 10.170306,
  10. "pused": 89.829694
  11. },
  12. "inodes": {
  13. "total": 15532032,
  14. "free": 12656665,
  15. "used": 2875367,
  16. "pfree": 81.487503,
  17. "pused": 18.512497
  18. },
  19. "options": "rw,noatime,errors=remount-ro"
  20. }
  21. ]
Dependent LLD rule

Create a low-level discovery rule as “Dependent item” type:

1 Discovery of mounted filesystems - 图2

As master item select the vfs.fs.get item we created.

In the “LLD macros” tab define custom macros with the corresponding JSONPath:

1 Discovery of mounted filesystems - 图3

In the “Filters” tab you may add a regular expression that filters only read-write filesystems:

1 Discovery of mounted filesystems - 图4

Dependent item prototype

Create an item prototype with “Dependent item” type in this LLD rule. As master item for this prototype select the vfs.fs.get item we created.

1 Discovery of mounted filesystems - 图5

Note the use of custom macros in the item prototype name and key:

  • Name: Free disk space on {#FSNAME}, type: {#FSTYPE}
  • Key: Free[{#FSNAME}]

As type of information, use:

  • Numeric (unsigned) for metrics like ‘free’, ‘total’, ‘used’
  • Numeric (float) for metrics like ‘pfree’, ‘pused’ (percentage)

In the item prototype “Preprocessing” tab select JSONPath and use the following JSONPath expression as parameter:

  1. $.[?(@.fsname=='{#FSNAME}')].bytes.free.first()

1 Discovery of mounted filesystems - 图6

When discovery starts, one item per each mountpoint will be created. This item will return the number of free bytes for the given mountpoint.