Now that we have some keys in Consul, we want to get that into a Nagios configuration file using Consul-Template. Consul-Template requires only two files which are used to create a third.

hosts.hcl – template configuration
hosts.ctmpl – template
hosts.cfg – output

I’m using Ubuntu 16.04 and here’s where I put the files;


File Contents


template {
  source = "/etc/consul-template.d/templates/hosts.ctmpl"
  destination = "/etc/nagios3/conf.d/hosts.cfg"


Tagged on: