Exclude partition in Icinga2 check disk [check_disk] not working
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.
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.
Solution 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.