On Wednesday, September 11, 2013 2:59:22 PM UTC-5, phundisk wrote:
>
> I am using the nagios puppet module to create and manage services via 
> stored configurations.  The original module, stored all service cheks in 
> one file and this was causing my puppet run on my nagios server to take 30+ 
> minutes.  I have read here (
> http://pieter.barrezeele.be/2009/05/11/puppet-and-nagios/) that if you 
> split up the services files into multiple, puppet can run faster since it 
> doesn't have to look through one huge file.  I would like to split this up 
> by host.  (i.e. nagios_service_$::fqdn.cfg)  One issue I am running into, 
> is that the file that is created  using the target method has the 
> permissions of root:root 600, and thus nagios will crash when trying to 
> read it since it does not have permissions.  The original nagios_service 
> file is controlled via the following...  
>
> I could add each hostname below, but that does not scale well.  Is there 
> another way in which this can be more easily managed?
>
>

You could do this:

exec { 'make_nagios_config_readable':
  command => "chmod 0644 
${nagios::defaults::vars::int_cfgdir}/conf.d/*.cfg",
  onlyif => "find ${nagios::defaults::vars::int_cfgdir}/conf.d/* -maxdepth 
0 -not -perm 0644 | grep -q '\.cfg'",
  provider => 'sh',
  notify => Service['nagios']
}

Nagios_command<| |> -> Exec['make_nagios_config_readable']
Nagios_contact<| |> -> Exec['make_nagios_config_readable']
Nagios_contactgroup<| |> -> Exec['make_nagios_config_readable']
Nagios_host<| |> -> Exec['make_nagios_config_readable']
Nagios_hostdependency<| |> -> Exec['make_nagios_config_readable']
Nagios_hostescalation<| |> -> Exec['make_nagios_config_readable']
Nagios_hostextinfo<| |> -> Exec['make_nagios_config_readable']
Nagios_hostgroup<| |> -> Exec['make_nagios_config_readable']
Nagios_service<| |> -> Exec['make_nagios_config_readable']
Nagios_servicedependency<| |> -> Exec['make_nagios_config_readable']
Nagios_serviceescalation<| |> -> Exec['make_nagios_config_readable']
Nagios_serviceextinfo<| |> -> Exec['make_nagios_config_readable']
Nagios_servicegroup<| |> -> Exec['make_nagios_config_readable']
Nagios_timeperiod<| |> -> Exec['make_nagios_config_readable']


John

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