[icinga-users] Defining multiple services or importing from a single conf file.

Antony Stone Antony.Stone at icinga.open.source.it
Mon Jan 30 21:48:16 CET 2017


On Monday 30 January 2017 at 21:13:20, Garrett Pye wrote:

> Little confused about the usage of multiple services in a host file. Below
> is a sample from one host file where intent is the automate duplication for
> 308 servers all with different host_names. To invoke each service does the
> host.conf file have to have each service separate?

Bear in mind the filenames host.conf, service.conf etc are immaterial - Icinga 
simply reads all files ending in .conf and processes their contents.

> My confusion with working in Icinga2 is defining the services in the
> services.conf file and importing/calling it in each host file as a single
> line item. Seems to me the same information is duplicated between the
> template and service.conf files and each host_name.conf file.

Rather than "assign where host.name == " (which means you do have to have one 
assign statement for every host), consider using something like "assign where 
host.vars.systemX" and then in each *host* definition simply include 
"vars.systemX = true".

That means you have one more line per host definition, and a single service 
definition, which then works for all hosts of that type.

In place of "serviceX", use some word which means something suitable for 
whatever these things do - an example from my own network is "vars.PBX = 
true", which tells me this machine is running Asterisk, and needs the 
appropriate Asterisk checks to be applied to it.


Hope that helps,


Antony.

-- 
"When you talk about Linux versus Windows, you're talking about which 
operating system is the best value for money and fit for purpose. That's a very 
basic decision customers can make if they have the information available to 
them. Quite frankly if we lose to Linux because our customers say it's better 
value for money, tough luck for us."

 - Steve Vamos, MD of Microsoft Australia

                                                   Please reply to the list;
                                                         please *don't* CC me.


More information about the icinga-users mailing list