phundisk
2013-Sep-11 19:59 UTC
[Puppet Users] Nagios Puppet Module - Multiple Service File Permissions Issues
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? file{[ "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg", "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg" ]: ensure => file, replace => false, notify => Service[''nagios''], mode => 0644, owner => root, group => 0; } -- _____________________________________________________ This email and any files transmitted with it are confidential and intended solely for the addressee. If you received this email in error, please do not disclose the contents to anyone; kindly notify the sender by return email and delete this email and any attachments from your system. © 2011 Currensee Inc. is a member of the National Futures Association (NFA) Member ID 0403251 | Over the counter retail foreign currency (Forex) trading may involve significant risk of loss. It is not suitable for all investors and you should make sure you understand the risks involved before trading and seek independent advice if necessary. Performance, strategies and charts shown are not necessarily predictive of any particular result and past performance is no indication of future results. Investor returns may vary from Trade Leader returns based on slippage, fees, broker spreads, volatility or other market conditions. Currensee Inc | 54 Canal St 4th Floor | Boston, MA 02114 | +1.617.624.3824 -- 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. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Sep-12 17:51 UTC
[Puppet Users] Re: Nagios Puppet Module - Multiple Service File Permissions Issues
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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
phundisk
2013-Sep-13 19:03 UTC
[Puppet Users] Re: Nagios Puppet Module - Multiple Service File Permissions Issues
Ah this is brilliant. Works like a charm. Once again John, you have enlightened me more about Puppet. On Thursday, September 12, 2013 1:51:40 PM UTC-4, jcbollinger wrote:> > > > 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 > >-- _____________________________________________________ This email and any files transmitted with it are confidential and intended solely for the addressee. If you received this email in error, please do not disclose the contents to anyone; kindly notify the sender by return email and delete this email and any attachments from your system. © 2011 Currensee Inc. is a member of the National Futures Association (NFA) Member ID 0403251 | Over the counter retail foreign currency (Forex) trading may involve significant risk of loss. It is not suitable for all investors and you should make sure you understand the risks involved before trading and seek independent advice if necessary. Performance, strategies and charts shown are not necessarily predictive of any particular result and past performance is no indication of future results. Investor returns may vary from Trade Leader returns based on slippage, fees, broker spreads, volatility or other market conditions. Currensee Inc | 54 Canal St 4th Floor | Boston, MA 02114 | +1.617.624.3824 -- 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. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.