3

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]).

dsteinkopf
  • 161
  • 1
  • 8

1 Answers1

1

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.

SBO
  • 544
  • 1
  • 5
  • 12
  • It won't solve your grah issue tho.. I'll make another answer if I find something out to resolve this, I need to get at the office to make some tests, I'm in the subway atm. – SBO Feb 13 '17 at 09:30
  • Thank you very much, looks good, nice idea - I'll try this and give feedback. As you also noticed - this won't solve the graph-jumps-problem. I'd be happy to get a solution for this, too. – dsteinkopf Feb 13 '17 at 11:12
  • I've just tried this idea and the trigger works as expected using this expression: `{martiniesrv:vfs.fs.size[/bakcrypt,free].last(0)}<20G and {martiniesrv:vfs.file.regmatch[/proc/mounts,^\S+ /bakcrypt .*].last(0)}>0`. In addition to this I've added a trigger to just check if /bakcrypt is mounted: `{martiniesrv:vfs.file.regmatch[/proc/mounts,^\S+ /bakcrypt .*].last(0)}=0`. Thank you again for this help. I'd appreciate getting any idea for the graphing problem. – dsteinkopf Feb 18 '17 at 06:10
  • I still experienced a problem with my diskspace trigger: The 2 items in the trigger expression are not updated at the same time. So it can happen that the mount-check still results in "true" but the size-checks already has the low value because /bakcrypt is not mounted. My solution is the following expression: `{martiniesrv:vfs.fs.size[/bakcrypt,free].max(#2)}<20G and {martiniesrv:vfs.file.regmatch[/proc/mounts,^\S+ /bakcrypt .*].last()}>0` – dsteinkopf Feb 21 '17 at 17:52
  • Glad I was able to help you for one part of your problem. I did some tests on my side, still didn't find a workaround for this graph issue, I'm not sure there's one.. I'll ask on the Zabbix forum to see if someone has an idea for this. – SBO Feb 22 '17 at 10:31
  • Now I read something about calculated items. Do you have an idea how to build an appropriate expression for an item to get a "clean" disk space graph? – dsteinkopf Mar 08 '17 at 17:09