[icinga-users] Using check_multi with Icinga2

Michael Martinez mwtzzz at gmail.com
Fri Aug 12 23:15:30 CEST 2016


On Fri, Aug 12, 2016 at 12:32 PM, Gunnar Beutner
<Gunnar.Beutner at netways.de> wrote:
> You’re going to have to move the attribute declaration _into_ the apply rule:
Hmmm..
Let me explain what I need to do, and maybe the folks here can help
suggest how to achieve it;

Outside of Icinga, I gather a list of amazon instances and the ELBs
that they are attached to. I am using Jinja templates to produce the
Icinga host objects from this list. In order to associate each ELB to
which hosts belong to it, I have done two things:

a) in each host object, have a vars._elb variable that contains the
names of the ELBs the host belongs to
b) outside of the host objects, created a "global" elb["elbname"]
array that contains the hostnames of the hosts that belong to it

Now, I need to create a Service object (for each ELB) that contains a
vars.cluster_data variable which contains the hosts in the ELB, as
follows:
vars.cluster_data = {{ get_host("hostname1").state + "," +
get_host("hostname2").state + "," + ....
}}

I was trying to do this by referencing the "global" elb array as I
mentioned, but apparently this global data is not available within the
Service definition.

What woudl be the right approach?

Perhaps instead of creating an ELB array, I should create a hostgroup
for each ELB, and put the ELB's members as members of the hostgroup.
Then I can reference them in my Service definition?
-- 
---
Michael Martinez
http://www.michael--martinez.com


More information about the icinga-users mailing list