Am 28.09.2014 um 23:05 schrieb Tomasz Chmielewski:
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:

The provided sample configuration really is an _example_ for a single
host. while the service.conf file already holds a general apply
definition. While it may not be reasonable to just use the "single host
with services" style, there are certain users and tools organizing the
configuration like that.

Since this is a complicated topic for starters, there's adedicated
section on configuration best practices on the documentation:
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#configuration-best-practice

Kind regards,
Michael


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$"?




-- 
Michael Friedrich, DI (FH)
Application Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | michael.friedr...@netways.de

** Puppet Camp Duesseldorf 2014 - Oktober - netways.de/puppetcamp **
** OSMC 2014 - November - netways.de/osmc **
** OpenNebula Conf 2014 - Dezember - opennebulaconf.com **
** OSDC 2015 - April - osdc.de **
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to