Default Icinga2 installation comes with /etc/icinga2/conf.d/hosts/localhost.conf, being host definition:

object Host "localhost" {
  import "generic-host"

  address = "127.0.0.1"
  address6 = "::1"

  vars.os = "Linux"
  vars.sla = "24x7"
}

It also comes with some services defined for this host, in /etc/icinga2/conf.d/hosts/localhost/ directory - for example, /etc/icinga2/conf.d/hosts/localhost/load.conf (other being apt.conf, disk.conf, http.conf etc.):

object Service "load" {
  import "generic-service"

  host_name = "localhost"
  check_command = "load"
  vars.sla = "24x7"
}


As it is logical for just one host, it implicates quite many config edits if we want to add more hosts with a similar approach:

1) we have to add /etc/icinga2/conf.d/hosts/server1.example.com.conf file for every new server (it is OK)

2) we have to add a new directory, /etc/icinga2/conf.d/hosts/server1.example.com/ with service definitions apt.conf, disk.conf, http.conf etc.) (it is OK)

3) we have to correct "host_name = " line in every service definition in /etc/icinga2/conf.d/hosts/server1.example.com/ - it can be quite a lot of changes, error-prone, if edited manually


What are better approaches to achieve the same effect? Say, is it possible to just copy a directory with service definitions in /etc/icinga2/conf.d/hosts/server1.example.com/ for ever new host, but to use some special variable like "host_name = $server$"?


--
Tomasz Chmielewski
http://www.sslrack.com

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to