Hi
I’ve a problem with global template and/or my structure.
/etc/icinga2/zones.d # ll
zone1
zone2
global-templates
global-templates contains my differents services, example
/etc/icinga2/zones.d/global-templates/packs
/etc/icinga2/zones.d/global-templates/packs/service1
cat /etc/icinga2/zones.d/global-templates/packs/service1/templates.conf
template Host "service1-host" {
// templates to use
import "generic-host"
// object vars
XXXX
}
With config:
ll -d /etc/icinga2/zones.d/global-templates/packs/service1
services
templates.conf
services/service1.conf
Then I’ve added with API some hosts with this service:
cat /var/lib/icinga2/api/packages/_api/XXXXXXXXX/conf.d/hosts/host1.conf
object Host "host1" {
import "service1-host"
import "generic-host"
address = "XX.XX.XX.XX"
vars = {
}
version = 1578994440.580861
zone = "zone1"
}
API created this object with success.
But when i restart icinga2, on my satellite of zone1 I have:
/var/log/icinga2/icinga2.log.1:/var/lib/icinga2/api/packages/_api/XXXXXXXXXXXXXXXX/conf.d/hosts/host1.conf(2): import "service1-host"
/var/log/icinga2/icinga2.log.1:[2020-01-13 13:18:10 +0100] critical/ApiListener: Error: Import references unknown template: 'service1-host’
If I look on
/var/lib/icinga2/api/zones-stage/global-templates/_etc/packs/oco/templates.conf
My service service1-host is present
I’ve activated global-templates in my config in /etc/icinga2/zones.conf
/* global templates for top down sync config */
object Zone "global-templates" {
global = true
}
Then I can precise that icinga2 daemon --validate reports no error for this service1-host
Is there anything I miss?
Thanks for help
Alex