Jonathan,

You would want to do it on the client level, when its exporting its host
definition, like:

@@nagios_host { $hostname:
      ensure => present,
      alias => $hostname,
      address => $ipaddress,
      use => $template,
      hostgroups => $hostgroups,
      notes => "$manufacturer $productname",
      target => "/etc/nagios/conf.d/puppet/$hostname.cfg",
    }

etc.


On Mon, Jul 22, 2013 at 10:08 AM, Jonathan Gazeley <
[email protected]> wrote:

> Hi all,
>
> We've been using Puppet to write out our Nagios configs for ages. I think
> I understand it pretty well. Recently we've had reason to set 'target' on
> all Nagios resources, based on the fqdn of the monitored host. However I
> don't want to have to set 'target' by hand on all Nagios resources (nor
> remember to set it on all future ones).
>
> So my question is: what's the easiest way to bulk-set the 'target'
> parameter according to the fqdn?
>
> So far I tried setting it on the Nagios server, which didn't work because
> $::fqdn is always the name of the Nagios server, not the monitored host
>
>   Nagios_host <<| |>> {
>     notify => Service['nagios'],
>     target => "/etc/nagios/conf.d/${::fqdn}.**cfg",
>   }
>
> I also tried including this on the monitored host, which didn't work
> because it attempts to realise all Nagios_host resources on the monitored
> host, not the Nagios server.
>
> Nagios_host <<| |>> { target => "/etc/nagios/conf.d/${::fqdn}.**cfg", }
>
> Is there an easy way to easily making all nagios_* resources have a
> fqdn-specific target?
>
> Thanks,
> Jonathan
>
> --
> 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+unsubscribe@**googlegroups.com<puppet-users%[email protected]>
> .
> To post to this group, send email to [email protected].
> Visit this group at 
> http://groups.google.com/**group/puppet-users<http://groups.google.com/group/puppet-users>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>


-- 
Matthew Nicholson

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to