On Wed, Oct 26, 2016 at 11:29 PM, Markus Frosch
<markus.fro...@icinga.com> wrote:
>
> Uhm, it would be interesting to know what you are trying to achieve.

All of my hosts have a variable vars.range = "<cluster>". cluster is
the name we give to a group of identical hosts. This name is assigned
in our range repository outside Icinga and gets pulled when our Icinga
config files are generated.

For each cluster, I need to create a Service object. I need to do this
programmatically in Icinga2. I already am creating a HostGroup for
each cluster and also a "dummy" Host for each cluster, so I thought I
could iterate through these with a for loop and create the Service
Object inside the for loop, assigning each Service object to the dummy
host.

But, it appears that get_objects() only works *inside* a Host or
Service object. But does nothing if called outside such an object.

>
> Your problem is that the hostgroup won't get registred until after the full 
> config is loaded.
>
> Steps:
> 1. Load and eval config
> 2. Commit changes (registring objects) (and evaluating applies)
> 3. Activating objects (enabling actions and behavior)
>

Any suggestions on how I can achieve my goal?


-- 
---
Michael Martinez
http://www.michael--martinez.com
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to