0

I'm trying to exclude a partition from check_disk command in Icinga2 and it's not working as expected.

The problem is due to /snap/core being recognised as a partition like this. enter image description here

So, I've opened the hosts file and added disk_partitions_excluded from the documentation.

/* Define disks and attributes for service apply rules in `services.conf`. */
  vars.disks["disk"] = {
    /* No parameters. */
    disk_partitions_excluded  = "/snap/core/*"
  }
  vars.disks["disk /"] = {
    disk_partitions = "/"
  }

But even after doing so and restarting Icinga2 with systemcl restart icinga2 the error doesn't go away.

Keith
  • 4,627
  • 14
  • 25
intelis
  • 175
  • 2
  • 10

2 Answers2

1

I've been able to fix it by checking existing partitions on the system

root@icinga2:/etc/icinga2/conf.d# sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
NAME   FSTYPE    SIZE MOUNTPOINT      LABEL
loop0  squashfs   91M /snap/core/6350
loop1  squashfs 89.4M /snap/core/6818
sda               40G
├─sda1             1M
└─sda2 ext4       40G /
sr0             1024M

and then explicitly specifying them in the exclude parameter

/* Define disks and attributes for service apply rules in `services.conf`. */
  vars.disks["disk"] = {
    /* No parameters. */
    disk_partitions_excluded = ["/snap/core/6350", "/snap/core/6818"]
  }
  vars.disks["disk /"] = {
    disk_partitions = "/"
  }

I'm not sure why the wildcard isn't working.

intelis
  • 175
  • 2
  • 10
0

One solution might be to use disk_ignore_ereg_path:

/* Define disks and attributes for service apply rules in `services.conf`. */
  vars.disks["disk"] = {
    disk_all = true
    disk_ignore_ereg_path = ["/snap/core/.*"]
  }
  vars.disks["disk /"] = {
    disk_partitions = "/"
  }

however, disk_all has to be set to true to have all other disks monitored.

reox
  • 165
  • 2
  • 10