Check command "check_zpools" does not exist but it does

Hi All,

I’m getting this error when trying to use a custom command.

I created the command in zones.d/master/commands.conf and created a service in zones.d/master/services.conf.

The plugin/script is on both the master and the targeted host in the PluginDir and it has the correct rights to execute. The “does not exist” messages suggests that its not being picked up somehow?

From zones.conf

object Endpoint “anita.” {
host = “10.XXX.XXXX.50”
}

object Zone “anita.” {
endpoints = [ “anita.” ]
parent = “master”
}

From zones.d/master/commands.conf

object CheckCommand “check_zpools” {
command = [ PluginDir + “/check_zpools.sh” ]

arguments = {
“-p” = {
required = true
value = “$zpool_pool$”
}
“-w” = {
required = true
value = “$zpool_warn$”
}
“-c” = {
required = true
value = “$zpool_crit$”
}
}
}

from zones.d/master/services.conf.

apply Service “zfs pools” {
import “generic-service”
command_endpoint = host.vars.agent_endpoint
check_command = “check_zpools”
vars.zpool_warn = “80”
vars.zpool_crit = “90”
vars.zpool_pool = “ALL”
assign where hosts that I want to target…
}

Any help would be appreciated!

Hi,
is there anything related in the log files (/var/log/icinga2/icinga2.log or /var/log/icinga2/error.log)?
Could you check grep PluginDir /etc/icinga2/constants.conf and crosscheck if check_zpools.sh is at the correct position?

Hi & welcome to the icinga community,

Your check command does exist on your master but not at your agent (where it is needed). Putting any command objects in zones.d/master/commands.conf is the reason for this behavior. You could verify if your command object using icinga object list -n check_zpools at your master and at your agent.

Best practice is to place every command objects in a global zone that is defined at every agent and the master.

1 Like

Hi Roland,

So even though I have it configured to push config from the master, I’ll have to manually create the command myself? Where should I be creating the command?

I think, @rsx is refering to the skript itself. Is that available on the agent (the targeted host)?

“Best practice is to place every command objects in a global zone that is
defined at every agent and the master.”

Antony.

Global zones are configured in zones.conf. You then need to create a directory below zones.d with exact the same name and place every command objects in files within this directory. Details can be found here.

1 Like

Hi @lorenz yes the script is on the target host.

@rsx So thats what I was missing. Thank you!