theforeman / smart_proxy_monitoring

Smart proxy plugin for monitoring system integration
GNU General Public License v3.0
7 stars 10 forks source link

ICINGA2 issue with Zone and Satellite #25

Open bmx0r opened 5 years ago

bmx0r commented 5 years ago

Hi, I setup a monitoring proxy to target a icinga2 master that belongs to "ZoneA" when I deploy a host, he is created in "ZoneA" in icinga2 and visible in the GUI (icingaweb). For a different network zone I use a Icinga2 satellite that belongs to "ZoneB".

When I deploy a host in this ZoneB, thru the previously mention monitoring proxy, foreman seems to assign the ZoneA.

Therefore I create another monitoring proxy pointing to my Icinga2 SAtellite in ZoneB, here i can see that the host is created, i can even see that he is checked (thru the foreman sync status) but when I look at my icingaweb2 the host does not show up...

According to the following issue it might be normal: https://github.com/Icinga/icinga2/issues/6052

Maybe I miss something obvious,... maybe we could pass the zone as a parameter from foreman? (i'm keen to make a PR if someone show me where it should be added, I'm not a ruby fan :p )

Maybe it is related to my icingaweb2 config?

Any help would be really appreciate

dgoetz commented 5 years ago

If I understand it correctly, the problem is you create the host in a different zone than master. Sync is only top-down in the hierarchy so from master to satellite. So what you would need is the possibility to set different templates (one without zone or the master zone and another with satellite zone), but unfortunately this is not implemented yet. The smart proxy could handle it but there is no GUI for it: https://github.com/theforeman/foreman_monitoring/issues/18

bmx0r commented 5 years ago

Thanks for this fast answer, indeed I didn't thought that I could workaround this by defining the zone in another icinga Host template. About the GUI... IMHO it should be "just" getting a host(group) variable, if you point we where in the code it should be done, i might have a look at it but maybe it is more something relate to the plugin than the proxy?

dgoetz commented 5 years ago

I am still not very familiar with the UI part, so perhaps @timogoebel can help here. I think for setting this on host or hostgroup it would need an additional tab, which allows to set the template and additional parameters to be send to the smart proxy.

bmx0r commented 5 years ago

I also find this: https://github.com/theforeman/foreman_monitoring/blob/master/app/models/concerns/foreman_monitoring/host_extensions.rb in monitoring_attributes it seems that the theforeman_monitoring is gathering attribute ans set them to the host, which are then posted to the proxy somehow...

timogoebel commented 5 years ago

@bmx0r: That happens here: https://github.com/theforeman/foreman_monitoring/blob/1006f703af498890c8a7bc0604f9b69df7e7eccb/app/services/monitoring.rb#L37-L39

bmx0r commented 5 years ago

I don't think i have the skills to create a PR :/ I also find this : https://github.com/theforeman/smart_proxy_monitoring/blob/master/lib/smart_proxy_monitoring_icinga2/monitoring_icinga2_main.rb#L105 Which make me think the proxy is ready and I should be able to add a Host Parameters called "templates" But i guess this host parameters must be added here first : https://github.com/theforeman/foreman_monitoring/blob/master/app/models/concerns/foreman_monitoring/host_extensions.rb#L56

maybe by adding something like this :owner_name => owner.try(:name), :templates => templates.try(:to_s),