Allowing for multiple -x options to exclude tmpfs paths that are not excluded by -X in Director

  • Icinga Web 2 version: 2.9.5
  • Used modules and their versions (System - About)
|director|1.8.1|
|doc|2.9.5|
|fileshipper|1.2.0|
|incubator|0.6.0|
|monitoring|2.9.5|
  • Web browser used: Chromium on Fedora
  • Icinga 2 version used (icinga2 --version): 2.13.2-1
  • PHP version used (php --version): 7.4.26
  • Server operating system and version: Fedora 34

Is there a way to include multiple -x options? I’m seeing several tmpfs directories that are not automatically being excluded. Examples include one from X2Go, /tmp/.x2go-moniot/spool/C-ouruser-50-1637675492_stDMATE_dp32 and /run/media/ouruser/SanDisk1. I had another thread which mentioned this and I was able to get a -x option added as a Data Field.

excludepartitions
customproperty
minux

But is there a way to allow multiple values for -x? Wouldn’t this also be considered a bug as the default -X options to exclude tmpfs are not being caught?

Hi, yes it’s possible. The field type must be an array. The director is doing the rest while rendering the config.

But if I understand your screenshoot correctly, you’re still doing that?!?

I had it as a string, I’ll reset it as an array. I take it the plus sign allows adding an entry.

What I can’t figure out is how to exclude a path that changes, i.e.,. with X2Go the /tmp path changes to something like /tmp/.x2go-ouruser/spool/C-ouruser-50-1637702868_stDMATE_dp32

I tried a wild card * after /spool to no avail.

From what the docs of check_disk says (Nagios Plugins / Monitoring Plugins - depending what you are using) it must be a device:

 -p, --path=PATH, --partition=PARTITION
    Mount point or block device as emitted by the mount(8) command (may be repeated)
 -x, --exclude_device=PATH <STRING>
    Ignore device (only works if -p unspecified)

Maybe this parameter are helping you:

     -R, --eregi-path=PATH, --eregi-partition=PARTITION
        Case insensitive regular expression for path/partition (may be repeated)
     -r, --ereg-path=PATH, --ereg-partition=PARTITION
        Regular expression for path or partition (may be repeated)

Thanks I tried this:

vars["-R"] = " /tmp/.x2go-*/spool/C-*-50-*_stD*_dp32"
    vars["-x"] = [ " /tmp/.x2go-*/spool/C-*-50-*_stD*_dp32" ]
    vars["_override_servicevars"] += {
        "Service Template for Server Monitoring Disk Usage" = {
            "-R" = "/tmp/.x2go-*/spool/C-*-50-*_stD*_dp32"
            "-x" = [ "/run/user/1003/doc" ]
            disk_partition_excluded = "/run/user/1003/doc"
            disk_partitions_excluded = "/run/user/0/doc"
        }

With the new params: Could you show us the complete command what the director is rendering new. You’ll find it in the “inspect” function in the service.

Here it is and I am not seeing the -R with inspect
'/usr/lib64/nagios/plugins/check_disk' '-c' '8%' '-w' '12%' '-X' 'fuse' '-X' 'none' '-X' 'tmpfs' '-X' 'sysfs' '-X' 'proc' '-X' 'configfs' '-X' 'devtmpfs' '-X' 'devfs' '-X' 'nfs' '-X' 'nsfs' '-X' 'debugfs' '-X' 'tracefs' '-X' 'overlay' '-X' 'snap' '-X' 'snapd' '-X' 'squashfs' '-X' 'fuse.gvfsd-fuse' '-X' 'fuse.gvfsd-fuse-daemon' '-X' 'fdescfs' '-X' 'cgroup' '-X' 'tmp' '-m' '-x' '/run/user/xxxx/doc' '-x' '/run/user/yyyy/doc'

But they are custom vars:

minusr
customvaras

In Director → Services → Template → Preview:

template Service "Service Template for Server Monitoring Disk Usage" {
    check_command = "disk"
    enable_notifications = true
    command_endpoint = host_name
    vars["-R"] = "/tmp/.x2go-*/spool/C-*-50-*_stD*_dp32"
    vars["-x"] = [ "-x /run/user/xxxx/doc" ]
    vars.disk_exclude_type = [
        "fuse",
        "none",
        "tmpfs",
        "sysfs",
        "proc",
        "configfs",
        "devtmpfs",
        "devfs",
        "nfs",
        "nsfs",
        "debugfs",
        "tracefs",
        "overlay",
        "snap",
        "snapd",
        "squashfs",
        "fuse.gvfsd-fuse",
        "fuse.gvfsd-fuse-daemon",
        "fdescfs",
        "cgroup",
        "tmp"
    ]
    vars.disk_partitions_excluded = "/run/user/xxxx/doc"
}

Well I’ll be darned. I saw in another thread about the df -aT command:

gvfsd-fuse                                                          fuse.gvfsd-fuse          0          0          0    - /run/user/xxxx/gvfs
portal                                                              fuse.portal              0          0          0    - /run/user/xxxx/doc
myuser@127.0.0.1:/cygdrive/C/Users/myuser/X2GO~1/S-5B9B~1/spool     fuse.sshfs               0          0          0    - /tmp/.x2go-myuser/spool/C-myuser-51-1638210896_stDXFCE_dp32

So I added fuse.sshfs and fuse.portal to vars.disk_exclude_type (Services → Service Templates, which is the -X option) and all the errors went away. Hope this helps someone down the line but perhaps this should be documented somewhere?

I’d guess it’s left to the user to choose to exclude a given file system type based on their own environment and needs. You were alerted to it, addressed it as you saw fit and it should never be an issue again :slight_smile: I’d guess sshfs is less used than nfs.

If you think the parameter discription is not really clear, you (as I copy from the plugin docs -x is for a device) you could create an issue for the nagios /monitoring plugins :wink: