[ZBX-8806] vfs.fs.discovery: use mount command to retrieve mountpoints Created: 2014 Sep 22  Updated: 2017 May 30  Resolved: 2015 Jan 08

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.2.4
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Bruno Galindro da Costa Assignee: Unassigned
Resolution: Won't fix Votes: 0
Labels: filesystem, jail, json, lld, mountpoint
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty


Attachments: File vfs.fs.discovery.json    

 Description   

I've a monitored node that has a jail filesystem mounted in /jail. But, in df -h it isn't displayed. If I execute mount, various mountpoints are displayed including /jail directories and files:

mount
/dev/mapper/ubuntutemplate-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sda1 on /boot type ext2 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
/etc/ConsoleKit on /jail/etc/ConsoleKit type none (ro,nosuid,bind)
/etc/ImageMagick on /jail/etc/ImageMagick type none (ro,nosuid,bind)
/etc/NetworkManager on /jail/etc/NetworkManager type none (ro,nosuid,bind)
/etc/ODBCDataSources on /jail/etc/ODBCDataSources type none (ro,nosuid,bind)
/etc/R on /jail/etc/R type none (ro,nosuid,bind)
/etc/UPower on /jail/etc/UPower type none (ro,nosuid,bind)
/etc/X11 on /jail/etc/X11 type none (ro,nosuid,bind)
.
.
.

As you can see, all jailed mountpoints are listed with none fs type.

But, vfs.fs.discovery result is considering those mountpoints as ext4 filesystems. This is because (I think!) that vfs.fs.discovery reads /proc/mounts to retrieve the mounted filesystems instead of executing the mount command. The json returned by vfs.fs.discovery is attached as vfs.fs.discovery.json.

This is causing a problem to me because the Filter of my filesystem discovery rule configuration is considering {#FSTYPE} macro and the global regex is the above:

File systems for discovery
^(btrfs|ext2|ext3|ext4|jfs|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|ntfs|fat32|zfs)$

I can't change {#FSTYPE} to {#FSNAME} to filter those filesystem names because there are many VMs in my datacenter that could have a real ext4 device mounted at /jail.

I've tried to make another script (vfs.fs.discovery.py) to consider the mount command output instead of /proc/mounts content. But, I'll need to distribute it to all of my VMs because the Mounted filesystem discovery rule is associated with my Linux Basic Template that is used with all of them.

So, I suggest to change the behaviour of vfs.fs.discovery to consider the mount command output instead of /proc/mounts content.



 Comments   
Comment by Bruno Galindro da Costa [ 2014 Oct 01 ]

This problem is ocurring with zfs snapshots too:

ZFS snapshots
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0000",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0200",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Sat_20140920_0200",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/daily_Sun_20140921_2030",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Sat_20140920_0600",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0100",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0300",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0400",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0500",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0600",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Fri_20140919_0300",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Sat_20140920_0500",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0800",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Sat_20140920_0000",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Mon_20140922_0900",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Sat_20140920_0300",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Sat_20140920_0100",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/daily_Sat_20140920_2030",
	"{#FSTYPE}":"zfs"},
{
	"{#FSNAME}":"\/home\/.zfs\/snapshot\/hourly_Sat_20140920_0400",
	"{#FSTYPE}":"zfs"}]}

Any return??

Comment by Volker Fröhlich [ 2014 Oct 17 ]

See ZBXNEXT-1772

Comment by Bruno Galindro da Costa [ 2015 Jan 08 ]

Guys, after installed Zabbix 2.4, my problem was solved because now it implements multiple filters in LLD Rules ZBXNEXT-581

So, I've created a new regular expression with this content:

Name: Exclude ZFS snapshots from LLD
Expression: \.zfs.*/snapshot
Expression Type: Result is FALSE

In the Mounted filesystem discovery LLD, I've added a new filter with the bellow content and with Type of calculation And

{#FSTYPE} matches @Exclude ZFS snapshots from LLD

Please, mark this issue as resolved.
Thanks.

Comment by richlv [ 2015 Jan 08 ]

as volter mentioned, different ways to obtain mounts will be discussed in ZBXNEXT-1772 thus this issue indeed can be closed - thanks for the update.

note that i closed it as wontfix as we did not make any changes in actual mountpoint discovery

Comment by romale [ 2016 Mar 17 ]

This https://support.zabbix.com/browse/ZBX-8806?focusedCommentId=132953&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-132953 not worked on zabbix v2.4.5 (revision 53282).
I've tried discovering FS on freebsd 10 with zabbix agent v2.4.7 (revision 56694) installed.

Update.
Worked if:
A

{#FSNAME}

matches @Exclude ZFS snapshots from LLD
AND
B

{#FSTYPE}

matches @File systems for discovery

Generated at Tue May 13 08:32:29 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.