Herramientas de usuario

Herramientas del sitio


unattended_installations:configuration_validation

Configuration Validation

Once you've edited the configuration files make sure to tell Icinga 2 to validate the configuration changes. Icinga 2 will log any configuration error including a hint on the file, the line number and the affected configuration line itself.

The following example creates an apply rule without any assign condition.

 apply Service "5872-ping4" {
 import "generic-service"
 check_command = "ping4"
 //assign where match("5872-*", host.name)
 }

Validate the configuration with the init script option checkconfig:

 # /etc/init.d/icinga2 checkconfig

You can also use the CLI command icinga2 object list after validation passes to analyze object attributes, inheritance or created objects by apply rules.

Example filtered by Service objects with the name ping*:

  # icinga2 object list --type Service --name *ping*
Object 'nbmif.int.netways.de!ping4' of type 'Service':
  * __name = 'nbmif.int.netways.de!ping4'
  * check_command = 'ping4'
  % = modified in '/etc/icinga2/conf.d/services.conf', lines 17:3-17:25
  * check_interval = 60
  % = modified in '/etc/icinga2/conf.d/templates.conf', lines 28:3-28:21
  * host_name = 'nbmif.int.netways.de'
  % = modified in '/etc/icinga2/conf.d/services.conf', lines 14:1-14:21
  * max_check_attempts = 3
  % = modified in '/etc/icinga2/conf.d/templates.conf', lines 27:3-27:24
  * name = 'ping4'
  % = modified in '/etc/icinga2/conf.d/services.conf', lines 14:1-14:21
  * retry_interval = 30
  % = modified in '/etc/icinga2/conf.d/templates.conf', lines 29:3-29:22
  * templates = [ 'ping4', 'generic-service' ]
  % += modified in '/etc/icinga2/conf.d/services.conf', lines 14:1-14:21
  % += modified in '/etc/icinga2/conf.d/templates.conf', lines 26:1-30:1
  * type = 'Service'
  * vars
  % += modified in '/etc/icinga2/conf.d/services.conf', lines 18:3-18:19
  * sla = '24x7'
  % = modified in '/etc/icinga2/conf.d/services.conf', lines 18:3-18:19

Reload on Configuration Changes

Everytime you have changed your configuration you should first tell Icinga 2 to validate. If there are no validation errors you can safely reload the Icinga 2 daemon.

 # /etc/init.d/icinga2 reload

Note

The reload action will send the SIGHUP signal to the Icinga 2 daemon which will validate the configuration in a separate process and not stop the other events like check execution, notifications, etc.

unattended_installations/configuration_validation.txt · Última modificación: 2022/11/02 17:58 por 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki