Ad Widget

Collapse

Key vfs.fs.discovery and mount bind

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dramon
    Junior Member
    • Mar 2013
    • 2

    #1

    Key vfs.fs.discovery and mount bind

    I am running Zabbix 2.0.5 on CentOS 5 machine with mounts:
    Code:
    /dev/md1 on / type ext3 (rw)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    /dev/md0 on /boot type ext3 (rw)
    tmpfs on /dev/shm type tmpfs (rw)
    /dev/md2 on /mnt/data type ext3 (rw,acl)
    /dev/md3 on /mnt/db type ext3 (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    /mnt/data/home on /home type none (rw,bind)
    /mnt/data/mysql on /var/lib/mysql type none (rw,bind)
    /mnt/data/www on /var/www type none (rw,bind)
    when I try to list values for vfs.fs.discovery, I get:
    {
    "data":[
    {
    "{#FSNAME}":"\/",
    "{#FSTYPE}":"rootfs"},
    {
    "{#FSNAME}":"\/",
    "{#FSTYPE}":"ext3"},
    {
    "{#FSNAME}":"\/dev",
    "{#FSTYPE}":"tmpfs"},
    {
    "{#FSNAME}":"\/proc",
    "{#FSTYPE}":"proc"},
    {
    "{#FSNAME}":"\/sys",
    "{#FSTYPE}":"sysfs"},
    {
    "{#FSNAME}":"\/selinux",
    "{#FSTYPE}":"selinuxfs"},
    {
    "{#FSNAME}":"\/proc\/bus\/usb",
    "{#FSTYPE}":"usbfs"},
    {
    "{#FSNAME}":"\/dev\/pts",
    "{#FSTYPE}":"devpts"},
    {
    "{#FSNAME}":"\/boot",
    "{#FSTYPE}":"ext3"},
    {
    "{#FSNAME}":"\/dev\/shm",
    "{#FSTYPE}":"tmpfs"},
    {
    "{#FSNAME}":"\/mnt\/data",
    "{#FSTYPE}":"ext3"},
    {
    "{#FSNAME}":"\/mnt\/db",
    "{#FSTYPE}":"ext3"},
    {
    "{#FSNAME}":"\/proc\/sys\/fs\/binfmt_misc",
    "{#FSTYPE}":"binfmt_misc"},
    {
    "{#FSNAME}":"\/misc",
    "{#FSTYPE}":"autofs"},
    {
    "{#FSNAME}":"\/home",
    "{#FSTYPE}":"ext3"},
    {
    "{#FSNAME}":"\/var\/lib\/mysql",
    "{#FSTYPE}":"ext3"},
    {
    "{#FSNAME}":"\/var\/www",
    "{#FSTYPE}":"ext3"},
    {
    "{#FSNAME}":"\/var\/named\/chroot\/proc",
    "{#FSTYPE}":"proc"},
    {
    "{#FSNAME}":"\/var\/named\/chroot\/var\/run\/dbus",
    "{#FSTYPE}":"ext3"}]}
    And this is wrong becouse mount points mounted with "bind" option and with file system "none" are detected with "ext3" file system.
  • just4fun
    Member
    • Jun 2010
    • 32

    #2
    Hi dramon,

    this is "normal behaviour" as Zabbix utilizes /proc/mounts to find out which filesystems
    have been mounted...

    I'm not sure if there's another (easy) way to find only the "real" filesystems, maybe /etc/mtab
    would be a better option?

    Comment

    • dramon
      Junior Member
      • Mar 2013
      • 2

      #3
      OK.
      The most easy way, how to solve this, will be to kick "vfs.fs.discovery" out and write my own bash script to send JSON list of filesystems using zabbix_send.
      But I am not sure how many people really want to watch binded filesystems

      Comment

      • just4fun
        Member
        • Jun 2010
        • 32

        #4
        Hi dramon,

        I've already fixed this by replacing the key "vfs.fs.discovery" with a self-written "vfs.fs.realdiscovery" (that I've added to each agent's UserParameter) and this "realdiscovery" only sends back "real" filesystems.

        Comment

        • spidernik84
          Junior Member
          • Aug 2011
          • 17

          #5
          Originally posted by just4fun
          Hi dramon,

          I've already fixed this by replacing the key "vfs.fs.discovery" with a self-written "vfs.fs.realdiscovery" (that I've added to each agent's UserParameter) and this "realdiscovery" only sends back "real" filesystems.
          Hi just4fun, any chance you have that script still around?
          I have the same need.

          Thanks

          Comment

          • just4fun
            Member
            • Jun 2010
            • 32

            #6
            Hi spidernik,

            it's not a script but a short C-programm:

            Code:
            #include <stdio.h>
            #include <stdlib.h>
            #include <sys/types.h>
            #include <sys/stat.h>
            #include <mntent.h>
            
            #include "cJSON.h"
            
            int main (int argc, char **argv) {
            
                    struct mntent   *m;
                    FILE            *f;
                    cJSON           *root, *data, *fsa, *fs;
            
                    root = cJSON_CreateObject();
            
                    cJSON_AddItemToObject(root, "data", fsa=cJSON_CreateArray());
            
                    if (NULL != (f = setmntent("/etc/mtab", "r"))) {
                            while (NULL != (m = getmntent(f))) {
                                    cJSON_AddItemToArray(fsa, fs=cJSON_CreateObject());
            
                                    cJSON_AddStringToObject(fs, "{#FSNAME}", m->mnt_dir);
                                    cJSON_AddStringToObject(fs, "{#FSTYPE}", m->mnt_type);
                            }
            
                            endmntent(f);
                    }
            
                    printf ("%s\n", cJSON_Print(root));
            }
            Just look for the cJSON library from Dave Gamble (I don't remember where I
            picked it up) and compile it. Works here for me for any RHEL-based system.

            Comment

            Working...