[icinga-users] Create Endpoint & Zone for each host

Paré, Caroline Caroline.Pare at transports.gouv.qc.ca
Mon Jan 16 21:11:11 CET 2017


Hello,

Can you delete my address in your list.
I have already unsubscribed and it seems it doesn't work...

Regards,

Merci et bonne journée!

Caroline Paré | (418) 266-6656 # 24705
Chargée de projets et
Responsable des systèmes Linux et du Laboratoire
Direction des technologies de l'information (DTI)
Service des infrastructures et des technologies appliqués aux opérations (SITAO)
Ministère des Transports, de la Mobilité durable et de l’Électrification des transports
930 chemin ste-foy, 2e étage – Québec (QC) – G1S 4X9
  [cid:image001.jpg at 01D0C2CE.E4155840] Devez-vous vraiment imprimer ce courriel? Pensez à l’environnement!
-         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ce courriel est confidentiel et ne s'adresse qu'à son destinataire.
S'il vous a été transmis par mégarde, veuillez le détruire et m'en aviser aussitôt. Merci!


De : icinga-users [mailto:icinga-users-bounces at lists.icinga.org] De la part de Volker Janzen
Envoyé : 16 janvier 2017 15:10
À : icinga-users at lists.icinga.org
Objet : [icinga-users] Create Endpoint & Zone for each host

Hi,

I like to simplify adding new hosts to my top-down config sync setup. Currently, I need to add Endpoint & Zone entries for each host to my zones.conf file by hand.


I found a config snippet that suggested to add a host template like this:


/etc/icinga2/zones.d/global-templates/generic-agent.conf

template Host "generic-agent" {
 import "generic-host"

 object Endpoint __name {
   host = "$host.address$"
 }

 object Zone __name {
   parent = "master"
   endpoints = [ __name ]
 }
}

A new host should then get only a host defition: /etc/icinga2/zones.d/child/host.conf

object Host "child" {
       import "generic-agent"
       check_command = "hostalive"
       address = ...
       vars.os = "Linux"
       zone = "master"
}

When I check this configuration changes, Icinga2 shows this error:

critical/config: Error: Error while evaluating expression: Objects may not be created outside of an activation context.
Location: in /etc/icinga2/zones.d/global-templates/generic-agent.conf: 4:3-4:24<x-apple-data-detectors://0>
/etc/icinga2/zones.d/global-templates/generic-agent.conf(2):   import "generic-host"
/etc/icinga2/zones.d/global-templates/generic-agent.conf(3):
/etc/icinga2/zones.d/global-templates/generic-agent.conf(4):   object Endpoint __name {
                                                              ^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/zones.d/global-templates/generic-agent.conf(5):     host = "$host.address$"
/etc/icinga2/zones.d/global-templates/generic-agent.conf(6):   }

critical/config: 1 error

I'm not sure what this error message means and how I could fix this error to achieve what I explained above.


Regards,
    Volker

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.icinga.org/pipermail/icinga-users/attachments/20170116/5d90d24e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1701 bytes
Desc: image001.jpg
URL: <http://lists.icinga.org/pipermail/icinga-users/attachments/20170116/5d90d24e/attachment-0001.jpg>


More information about the icinga-users mailing list