Check command 'memory' does not exist

Hello,

I have created custom command in master in /etc/icinga2/zones.d/global-templates/memory.conf file:

object CheckCommand "memory" {
  import "plugin-check-command"
  command = [ PluginDir + "/check_mem" ]

  arguments = {
    "-w" = "$warning_mem$"
    "-c" = "$critical_mem$"
    "-W" = "$warning_swap$"
    "-C" = "$critical_swap$"  
  }
  vars.warning_mem = "80"
  vars.critical_mem = "90"
  vars.warning_swap = "40"
  vars.critical_swap = "60"
}

Now when I monitor this in the client. It is showing “Check command ‘memory’ does not exist.” in icingaweb2.

NOTE: The icinga2 feature API is enabled in the client.

Is the check script installed on your Icinga2 host? (PluginDir is usualy /usr/lib/nagios/plugins)

Do you use a distributed master/satellite setup? If yes, script should be available on all Icinga2 nodes.

1 Like

I solved it by doing following:

mkdir -p /var/lib/icinga2/api/zones/global-templates/_etc
chown nagios. /var/lib/icinga2/ -R

Added following in /etc/icinga2/zones.conf

object Zone "global-templates" {
  global = true
}

Comment out following line in /etc/icinga2/icinga2.conf

//include_recursive "conf.d"

Then restarted icinga2

Hi,

glad that you solved the issue.

I just want to mention that you actually do not have to do anything manually in the /var/lib/icinga2 - especially in /var/lib/icniga2/api/zones directory. Of course there are a few very rare limitations but most of them are related to disaster recovery or recovery from failures or the PKI setup. In general it’s a good idea to forget about that path and let icinga2 handle the content. :slight_smile:

yes, that should be the case. But strange the path was not there so I had to do it manually.