2 issues with Puppet and checkcommand

Hi,
I’ve found 2 issues while using puppet to set the “checkcommand”. One is related to the behavior of the puppet module itself and the other is (presumably) with the checkconfig itself.
Description: I’m trying to set multiple filesystem exclusions for the check_disk plugin.

FIRST ISSUE

icinga2::object::checkcommand { ‘main-disk’:
import => [‘plugin-check-command’,],
command => [‘PluginDir + /check_disk’,],
arguments => {
‘-x’ => ‘/dev/sda/’,
‘–exclude-type’ => ‘overlay’,
‘–exclude-type’ => ‘tmpfs’,
},

@@ -27,6 +27,6 @@
command = [ PluginDir + "/check_disk", ]
arguments = {
"-x" = "/dev/sda/"
- "--exclude-type" = "overlay"
+ "--exclude-type" = "tmpfs"
}
}
I’ve made many different attempts but it looks to me that it accepts only unique arguments despite the --exclude-type can be specified multiple times (I’ve tried on the command line directly and it works well (shown below).

SECOND ISSUE
When I try to apply the change directly on the Icinga2 checkcommand file it doesn’t fail but it is not behaving as expected. In fact looks like only one exclusion parameter would work as I keep getting related alerts which are not supposed to show up.
object CheckCommand "main-disk" {
import "plugin-check-command"

command = [ PluginDir + "/check_disk", ]
arguments = {
"-x" = "/dev/sda/"
"--exclude-type" = "overlay"
"--exclude-type" = "tmpfs"
}
}

The command on the shell works well:
(without exclusions)

# ./check_disk -x /dev/sda1

DISK OK - free space: /dev 7449 MB (100% inode=99%); /run 1388 MB (92% inode=99%); / 114187 MB (47% inode=87%); /dev/shm 7464 MB (99% inode=99%); /run/lock 5 MB (100% inode=99%); /sys/fs/cgr
oup 7464 MB (100% inode=99%); /run/user/0 1492 MB (100% inode=99%); /run/user/108 1492 MB (100% inode=99%); /var/lib/docker/overlay2/81fa7be5380210b65873ba7f9b3fd991c33b89dc974555e879e10547b
487d66f/merged 114187 MB (47% inode=87%);| /dev=0MB;;;0;7449 /run=104MB;;;0;1492 /=127334MB;;;0;254519 /dev/shm=0MB;;;0;7464 /run/lock=0MB;;;0;5 /sys/fs/cgroup=0MB;;;0;7464 /run/user/0=0MB;;
;0;1492 /run/user/108=0MB;;;0;1492 /var/lib/docker/overlay2/81fa7be5380210b65873ba7f9b3fd991c33b89dc974555e879e10547b487d66f/merged=127334MB;;;0;254519

(with only one exclusion)
# ./check_disk -x /dev/sda1 --exclude-type=tmpfs

DISK OK - free space: /dev 7449 MB (100% inode=99%); / 114187 MB (47% inode=87%); /var/lib/docker/overlay2/81fa7be5380210b65873ba7f9b3fd991c33b89dc974555e879e10547b487d66f/merged 114187 MB (
47% inode=87%);| /dev=0MB;;;0;7449 /=127334MB;;;0;254519 /var/lib/docker/overlay2/81fa7be5380210b65873ba7f9b3fd991c33b89dc974555e879e10547b487d66f/merged=127334MB;;;0;254519

(with both exclusions)
# ./check_disk -x /dev/sda1 --exclude-type=overlay --exclude-type=tmpfs

DISK OK - free space: /dev 7449 MB (100% inode=99%); / 114187 MB (47% inode=87%);| /dev=0MB;;;0;7449 /=127334MB;;;0;254519

Am I missing something?
Thanks in advance.

Passing the same argument multiple times requires some special treatment. In your case, it should look like this:

object CheckCommand "main-disk" {
  import "plugin-check-command"

  command = [ PluginDir + "/check_disk", ]
  arguments = {
    "-x" = "/dev/sda/"
    "--exclude-type" = "$main_disk_exclude_type$"
  }

  vars.main_disk_exclude_type = [ "overlay", "tmpfs" ]
}

For more details, see https://icinga.com/docs/icinga2/latest/doc/03-monitoring-basics/#command-arguments-repeat-key and https://icinga.com/docs/icinga2/latest/doc/09-object-types/#checkcommand-arguments (especially value and repeat_key).

I don’t know how to do this with the Puppet module, but hopefully this gives enough pointers for you so that you can try to adapt your Puppet configuration accordingly.