Hello,
i try to create a check_by_ssh command to check free disk space.
I have managed to get the command executed, but I am failing to pass the disk_exclude_type parameter.
When I try, I get the following error message:
Error: Error while evaluating expression: Mixing both strings and non-strings in macros is not allowed.
Location: in /usr/share/icinga2/include/command-plugins.conf: 2167:18-2167:42
/usr/share/icinga2/include/command-plugins.conf(2165): }
/usr/share/icinga2/include/command-plugins.conf(2166): “-C” = {{
/usr/share/icinga2/include/command-plugins.conf(2167): var command = macro(“$by_ssh_command$”)
^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/share/icinga2/include/command-plugins.conf(2168): var arguments = macro(“$by_ssh_arguments$”)
/usr/share/icinga2/include/command-plugins.conf(2169):
I am relatively sure that I have to use the argument by_ssh_arguments, but I couldn’t find an example for it.
At the moment I have worked around the error by writing the individual filesystems into the command.
However, this makes the command rather complicated and difficult to read.
Working Configuration:
object CheckCommand "check_disk_by_ssh" {
import "plugin-check-command"
command = [ PluginDir + "/check_by_ssh" ]
timeout = 1m
vars.by_ssh_address = "$check_address$"
vars.by_ssh_command = "/home/icinga/nagios_commands/check_disk -w $disk_wfree$ -c $disk_cfree$ -X none -X tmpfs -X sysfs -X proc -X configfs -X devtmpfs -X devfs -X mtmfs -X tracefs -X cgroup -X fuse.gvfsd-fuse -X fuse.gvfs-fuse-daemon -X fdescfs -X overlay -X nsfs -X squashfs -m"
vars.by_ssh_quiet = false
vars.check_address = {
arguments = [ ]
deprecated = false
name = "<anonymous>"
side_effect_free = false
type = "Function"
}
vars.check_ipv4 = "$by_ssh_ipv4$"
vars.check_ipv6 = "$by_ssh_ipv6$"
vars.disk_cfree = "10%"
vars.disk_exclude_type = [
"none",
"tmpfs",
"sysfs",
"proc",
"configfs",
"devtmpfs",
"devfs",
"mtmfs",
"tracefs",
"cgroup",
"fuse.gvfsd-fuse",
"fuse.gvfs-fuse-daemon",
"fdescfs",
"overlay",
"nsfs",
"squashfs"
]
vars.disk_megabytes = true
vars.disk_wfree = "20%"
}
Not Working Configuration:
object CheckCommand "check_disk_by_ssh" { import "plugin-check-command" command = [ PluginDir + "/check_by_ssh" ] timeout = 1m vars.by_ssh_address = "$check_address$" vars.by_ssh_command = "/home/icinga/nagios_commands/check_disk -w $disk_wfree$ -c $disk_cfree$ -X $disk_exclude_type$ -m" vars.by_ssh_quiet = false vars.check_address = { arguments = [ ] deprecated = false name = "<anonymous>" side_effect_free = false type = "Function" } vars.check_ipv4 = "$by_ssh_ipv4$" vars.check_ipv6 = "$by_ssh_ipv6$" vars.disk_cfree = "10%" vars.disk_exclude_type = [ "none", "tmpfs", "sysfs", "proc", "configfs", "devtmpfs", "devfs", "mtmfs", "tracefs", "cgroup", "fuse.gvfsd-fuse", "fuse.gvfs-fuse-daemon", "fdescfs", "overlay", "nsfs", "squashfs" ] vars.disk_megabytes = true vars.disk_wfree = "20%" }
Best regards
Viktor