Good day, I''m very new to Puppet and am trying to manage the snmpd daemon and associated config on our Red Hat servers using Puppet (for a start). My problem is not ensuring that the config file is present or that the package is installed. My problem is that the NMS we''re using to monitor our servers needs to have extra config in the snmpd.conf file in order for it to monitor the space usage of mounted disks. Like so: disk / disk /var/log disk /var/lib/mysql This needs to be added somewhere in the snmpd.conf file; usually the bottom. Now, this is obviously never going to be the same on every single server... How would I accomplish this using Puppet? I''m guessing that I will need to use a template with some erb code and some facts from facter, but I''m just not sure what to do or how the code should look. Even if Puppet could ensure that all the disks (/dev/ shm, /boot etc) are in there that would be fine. We could just tell our NMS which disks we want it to monitor. But it has to be in the above format! Any suggestions would be appreciated! J -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Nov 18, 3:24 am, Jonathan van der Watt <jonathan.vanderw...@gmail.com> wrote:> Good day, > > I''m very new to Puppet and am trying to manage the snmpd daemon and > associated config on our Red Hat servers using Puppet (for a start). > My problem is not ensuring that the config file is present or that the > package is installed. My problem is that the NMS we''re using to > monitor our servers needs to have extra config in the snmpd.conf file > in order for it to monitor the space usage of mounted disks. Like so: > > disk / > disk /var/log > disk /var/lib/mysql > > This needs to be added somewhere in the snmpd.conf file; usually the > bottom. Now, this is obviously never going to be the same on every > single server... How would I accomplish this using Puppet? I''m > guessing that I will need to use a template with some erb code and > some facts from facter, but I''m just not sure what to do or how the > code should look.Your instincts seem good to me.> Even if Puppet could ensure that all the disks (/dev/ > shm, /boot etc) are in there that would be fine. We could just tell > our NMS which disks we want it to monitor. But it has to be in the > above format!Formatting is the least of your problems. Templates are all about formatting, and the format you presented is very simple. Suppose, for instance, that the mount points you want to list in snmpd.conf are available as a comma-delimited list communicated by a custom fact "disks". Off the top of my head, your template might look something like this: === snmpd.conf.erb ==[... everything else you want in snmpd.conf, as literal text] <% @disks.split(",").each do |disk| -%> disk <%= disk %> <% end %> === end snmpd.conf.erb == That''s not bad, even with the need to split a string to get the individual disks. The slightly bigger trick is to communicate the needed disks to the Puppetmaster, because all template evaluations are performed there. If you wondered why I couched the example in terms of a custom fact, then that''s why. Generally speaking, custom facts are pretty easy to write and distribute; see the docs on Puppetlabs''s site, and feel free to raise questions here. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Fri, Nov 18, 2011 at 4:24 AM, Jonathan van der Watt < jonathan.vanderwatt@gmail.com> wrote:> Good day, > > I''m very new to Puppet and am trying to manage the snmpd daemon and > associated config on our Red Hat servers using Puppet (for a start). > My problem is not ensuring that the config file is present or that the > package is installed. My problem is that the NMS we''re using to > monitor our servers needs to have extra config in the snmpd.conf file > in order for it to monitor the space usage of mounted disks. Like so: > > disk / > disk /var/log > disk /var/lib/mysql > > This needs to be added somewhere in the snmpd.conf file; usually the > bottom. Now, this is obviously never going to be the same on every > single server... How would I accomplish this using Puppet? I''m > guessing that I will need to use a template with some erb code and > some facts from facter, but I''m just not sure what to do or how the > code should look. Even if Puppet could ensure that all the disks (/dev/ > shm, /boot etc) are in there that would be fine. We could just tell > our NMS which disks we want it to monitor. But it has to be in the > above format! > > Any suggestions would be appreciated! >You could centrally manage the snmp.conf files by class of server, or by individual host. Or you could go the route of custom facts. Here is a ticket discussing this: http://projects.puppetlabs.com/issues/2847 (It does look like if you wait, it will be included in facter.) J> > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- <http://aws.amazon.com/solutions/solution-providers/brandorr/> -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.