Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example and documentation for syncing hiera data to icinga objects #342

Closed
yaron-idan opened this issue Jul 26, 2017 · 8 comments
Closed
Assignees
Milestone

Comments

@yaron-idan
Copy link

Expected Behavior

We have been using the puppet-icinga2-legacy module for a while now, and are in the process of upgrading to this module. We've been using the icinga2::objects class to sync between hiera and our icinga2 server, and it's been working great for us so far. Here's a link to the feature I'm referring to - https://github.com/Icinga/puppet-icinga2-legacy#hiera

Current Behavior

Currently, it seems this module doesn't contain this module, and we've been wondering why.

Possible Solution

Adding the icinga2::objects class into this module, or any other class with similar functionality that will allow hiera data to be synced with icinga2.

Context

This breaks our current flow for creating icinga2 objects, which allowed us to empower every dev member in our team to easily monitor his/hers services.

@yaron-idan yaron-idan changed the title Synching hiera data to icinga objects Syncing hiera data to icinga objects Jul 27, 2017
@lbetz
Copy link
Contributor

lbetz commented Jul 31, 2017

We do less is more in this module. When you wanna have the same behavior do it on your on at your profile layer. Use the create_resource function for puppet 3 or the iteration in puppet 4.

@yaron-idan
Copy link
Author

What about reusing the objects class that was present in the legacy module? Should it work out of the box if I point it at the object classes of the new module or was it removed for a specific reason and isn't compatible with the current module?
Thanks.

@yaron-idan
Copy link
Author

When using iterations like suggested in this issue I've encountered some strange behavior -
The following hiera document -

{
   "icinga2::object::dependency":{
      "internet_to_host":{
        "assign":["host.name != \"Yahoo\" && host.name != \"icinga2-win1\""],
        "parent_host_name":"Yahoo",
        "disable_checks":true,
        "disable_notifications":true,
        "apply_target": "Host",
        "apply": true
      }
}

Is being transformed into the following icinga object -

# This file is managed by Puppet. DO NOT EDIT.

apply Dependency "internet_to_host" to Host {
  parent_host_name = "Yahoo"
  disable_checks = true
  disable_notifications = true
  assign where host.name != ""Yahoo"" && host.name != ""icinga2-win1""
}

I figured something is wrong with the way we are escaping the string, but eventually I found out the extra quotes are being added by the icinga2::object:: class.
When I remove the quotes entirely, the file is created as expected, with a double quote around each string in the assign clause.
This behavior is unexpected and is not consistent with the way we modeled our data when using the legacy module.
Why was this change introduced?

@lbetz
Copy link
Contributor

lbetz commented Aug 16, 2017 via email

@lbetz
Copy link
Contributor

lbetz commented Aug 16, 2017

have a look at the documentation to Object Config, Parsing Configuration.

@yaron-idan
Copy link
Author

yaron-idan commented Aug 17, 2017

True, I've missed that part of the docs, thanks for the reference.
I'm building a new version of the missing objects class to fit our use case, would you be interested in adding it to this module or are you keen on keep doing more with less?
I find it's nice to have a way of syncing hiera and icinga, and since the old module supported this I don't see why the new one shouldn't.

@lbetz
Copy link
Contributor

lbetz commented Aug 30, 2017

Inspired by you I wrote a blog post. It's in german sorry for that but the code say it all, I think.

https://blog.netways.de/2017/08/18/icinga-2-monitoring-automatisiert-mit-puppet-teil-5-konfiguration-ii/

I will write an example and a short documentation.

@lbetz lbetz changed the title Syncing hiera data to icinga objects Example and documentation for syncing hiera data to icinga objects Aug 30, 2017
@bobapple
Copy link
Contributor

I agree with @lbetz, adding an example and docs is sufficient. Thanks for the effort @yaron-idan

@lbetz lbetz added the docs label Sep 5, 2017
@lbetz lbetz added this to the v1.3.1 milestone Sep 23, 2017
@lbetz lbetz self-assigned this Sep 27, 2017
@lbetz lbetz closed this as completed in 05a16c3 Sep 29, 2017
n00by pushed a commit to n00by/puppet-icinga2 that referenced this issue Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants