Skip to content

Zabbix and how to the filesystem template to send warn or crit for fixed free space values

We are monitoring our servers with zabbix.

A lot of servers are running in a slightly different configuration, especially when it comes to harddisk space. Furthermore, it is fine to operate on "almost full" disk or "near the limit".

The task was to adjust the existing zabbix templates without creating and maintaining our own ones. A part of our servers should warn us if there is only 5 GB of free disk space left and should send us a crit if the amount of free disk space drops below 3 GB.

So we ended up with a bit of calcuation. E.G. a server has 170 GB of disk space, we are running the following math.

#calcuation for critical, if free disk space is below 3 GB
$percentage = (3 GB / 100 %) * 170 GB; #results in 5.1 %
$numberForZabbix = (100 % - $percentage) #100 - 5.1 = 94.9

Once we have done the math for the warning (5 GB) and for all the servers, we can go into the host configuration and use the mighty macro section.

For the example host above, we want to add the following two macro lines

Macro|Value
{$VFS.FS.PUSED.MAX.CRIT}|94.9
{$VFS.FS.PUSED.MAX.WARN}|91.5

Of course, the crit message now says "more than 94.9 percent of disk space used" but this is the compromise we have to deal with. The other solution would be to maintain our own template, what we want to avoid.