Zabbix vfs.fs.size gives wrong result when filesystem is not mounted

monitoringzabbix

I am using an item vfs.fs.size[/bakcrypt,free] (generated by autodiscovery) to monitor diskspace on an encrypted file system (and of course others). The encrypted filesystem in not auto mounted immediately at system startup because a passphrase has to be entered manually.

The problem is, that while my /bakcrypt is not (yet) mounted vfs.fs.size[/bakcrypt,free] gives the size of the "parent" filesystem (/) which is wrong. This leads to wrong triggers/alarms and jumps in the disk space graph.

Is there any way to prevent vfs.fs.size from giving a result if the named filesystem is not currently mounted?

Or is there a means of "conitional expression"? Something like whenmounted(/bakcrypt,vfs.fs.size[/bakcrypt,free]).

Best Answer

You should add a check, something like

vfs.file.regmatch[/proc/mounts,^\S+ /bakcrypt .*]

and then customize your original trigger alert for the disk space with a condition, if the regmatch = 1 and diskspace is low, then alert.