Zabbix Linux vfs User parameter Templates

Zabbix monitoring offers several virtual file system item types out of the box. But there are still some missing. I created a GitHup Repository to provide some additional items as User parameter.

Linux vfs README.md vscode

During my daily work I was tasked with two additional values, Zabbix should provide to our Administrators:

  • Were Linux configuration files from a certain installed daemon modified? (/etc/postfix/)
  • What is the timestamp of the oldest file in a certain directory? (EDI)

In both cases, the affected machines are Debian Linux virtual machines with Zabbix agent 3.4+ installed and configured. Zabbix offers no way to solve these challenges out of the box, but is easily customizable via User Parameter and custom Low Level Discovery to add this features.

I published my work on GitHub, where you can take a look at the Scripts, example Templates and User Parameter.

Example code:

#!/usr/bin/perl

$base = $ARGV[0];

opendir(DIR, $base) || die "cannot open directory: $!";
@subdirs = grep { /^[^.]/ && -f "$base/$_" } readdir(DIR);
closedir(DIR);

$first = 1;

print "{\n";
print "\t\"data\":[\n";

for (@subdirs)
{
    print ",\n" if !$first;
    print "\t\t{\"{#FILENAME}\":\"$_\"}";
    $first = 0;
}

print "\n\t]\n";
print "}\n";
# EXAMPLE
UserParameter=vfs.file.age[*],/usr/local/bin/zabbix_vfs.file.old.sh $1
UserParameter=vfs.file.discovery[*],/etc/zabbix/zabbix_agentd.d/vfs-file-discovery.pl $1
UserParameter=vfs.dir.discovery[*],/etc/zabbix/zabbix_agentd.d/vfs-dir-discovery.pl $1

Source: https://github.com/xenadmin/zabbix-templates/tree/master/zabbix-vfs-linux

Author: Marco

Marco is an IT-System administrator and IT-Consultant with 10+ years experience. He is specialized in the delivery of virtual Apps and Desktops with Citrix solutions. In 2017 he has been awarded Citrix Technology Advocate by Citrix for his community work (#CTA). His second core area is availability & performance monitoring with Zabbix, a leading open-source solution. His employer is the German IT-Company ANAXCO, which is developing a Transport Management Software (TMS) based on Microsoft Dynamics AX. More about Marco

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.