Agreed with what Matthias said. Puppet's naginator stuff doesn't play very well with non-Puppet nagios configurations. Essentially, you have to pick one of: - remove the default template from that file, and create it with Puppet elsewhere
- put all of the contents of that file in Puppet
- totally remove all of the default object configuration, and have Puppet do everything (what I do)

On the other hand, I don't use templates in Nagios anymore, I find them to be redundant. I use a combination of defines and parameterized classes (hiera would be good here too, though I don't use it) and have Puppet write out complete definitions for hosts/services/etc without any templates. I find that makes it much more clear to look at one resource in Puppet and know what it does, and reduces the likelihood that a template will get modified and have unintended consequences for objects that use it.

-Jason

On 02/11/2014 11:14 AM, Matthias Saou wrote:
On Tue, 11 Feb 2014 06:53:42 -0800 (PST)
druide.st...@gmail.com wrote:

I have a strange problem here. Most of my Nagios configuration are
from file {} directive, but I also need to modify a couple of Nagios'
default configuration. To do this, I use classes like this:

class nagios::gabarits {

    nagios_host { 'linux-server':
      use => 'generic-host',
[...]
      target => '/etc/nagios/objects/templates.cfg',
      ensure => present,
    }

  }

Problem is: it replace the content
of /etc/nagios/objects/templates.cfg with the new host definition,
but everything else in the file is gone!
I think that's the expected behaviour.
The proper fix is to also declare the other nagios resources you want
to see in that file.

That's more or less how I solved it in my own module :
https://github.com/thias/puppet-nagios/blob/master/manifests/server.pp#L550
(feel free to copy/paste those lines!)

Though I did "move" all of the resources to their default files and
stopped using the objects/templates.cfg file.

HTH,
Matthias


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/52FAA665.8080703%40jasonantman.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to