1

I've a icinga2 installation monitoring some debian hosts using native agent.

All checks are working fine except apt. The results displayed are taken from the icinga2 master machine and I can't understand why.

This is my apt service config:

apply Service "apt" {
  import "generic-service"

  check_command = "apt"

  assign where (host.name == NodeName || host.vars.linux_ver == "debian")
//  assign where host.name == NodeName
}

Any hints?

sgargel
  • 190
  • 1
  • 15

1 Answers1

3

Question is old, but: You will need to define the remote client (command_endpoint) in some way, otherwise it will only check on the master. I assume your agent configuration is running, so you have already configured the zones.conf. I suggest adding a second service for the remote clients:

apply Service "apt2" {
  import "generic-service"
  check_interval = 10m   // * how often to check
  check_command = "apt"  // * call the plugin
  command_endpoint = host.vars.remote_client // * execute the plugin on the remote machine

  //vars.apt_only_critical = "1" //uncomment if you want.

  assign where host.vars.remote_client && host.vars.linux_apt == "1" // * only check where remote client is set and vars.linux_apt is set to "1" 
}

Host configuration:

object Host "<HostName>" {
  import "generic-host" // * default stuff
  address = "<HostAddress>" // * default stuff
  vars.linux_apt = "1" // * Set this host to be checked by the new service
  vars.remote_client = "<HostNameAsConfiguredInZones.conf>" // * Needed for the remote service checks. Check `zones.conf` on what to insert here for your host.
}
30000MONKEYS
  • 113
  • 2
  • 11