Hi Matthew,

Thanks for your response. I know your approach will work, but I'm reluctant to go through my manifests and change every reference to nagios_* to include a 'target' parameter. It's not only an effort to change now, but I also have to remember to add a 'target' every time I add Nagios resources in future. That's why I was asking if there was a way to bulk-apply the 'target' parameter, either client-side or server-side. If not then I'll have to do it this way :)

Cheers,
Jonathan


On 22/07/13 17:47, Matthew Nicholson wrote:
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] <mailto:[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 [email protected]
    <mailto:puppet-users%[email protected]>.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit 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.



--
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