Hello,
I am currently expanding on the Monit recipes that are available on
the Wiki (as well as github). One of the oft-used features of Monit
is the ability to load arbitrary configuration files at runtime (i.e.
include /etc/monit.d/*.conf). This seems like it could be a good fit
for integrating service configs with their respective Monit configs in
Puppet ; however, consider the following :
class httpd {
...
file { ''/etc/monit.d/httpd.conf'':
...
}
}
class monit {
file { ''/etc/monit.conf'':
...
}
service { ''monit'':
subscribe => File["/etc/monit.conf"]
...
}
}
The problem here is that Monit only reads its config files when it is
(re)started ; based on the subscribe relationship described above,
Monit will be restarted when /etc/monit.conf changes, but not when /
etc/monit.d/httpd.conf changes (or appears for the first time, as the
case may be).
Thus the question : is it possible / advisable to subscribe a service
to multiple files, and if so, how would it be done ?
Alternatively, i may be taking entirely the wrong approach here, in
which case the question would be : what would be the best way to
trigger a Monit reload from outside of the Monit class ? Would it be
advisable to, for example, define a service-subscribe relationship in
every class that has a Monit config file (i imagine scoping is an
issue here).
Thank you all for your time and consideration on this topic.
--
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.
Rob McBroom
2010-Jul-16 19:49 UTC
Re: [Puppet Users] subscribing a service to multiple files ?
On Jul 16, 2010, at 12:48 PM, phrawzty wrote:> Thus the question : is it possible / advisable to subscribe a service > to multiple files, and if so, how would it be done ?Sure. Just do this: subscribe => [ File["first_file"], File["second_file"], File["you_get_the_idea"], ], Or you can use “notify” on each individual file instead of using “subscribe” on the service if you find that easier to manage. -- Rob McBroom <http://www.skurfer.com/> -- 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.
Rob McBroom
2010-Jul-16 20:27 UTC
Re: [Puppet Users] subscribing a service to multiple files ?
Also worth mentioning: Puppet is smart enough to only restart the service once if more than one of the files it depends on are changed. -- Rob McBroom <http://www.skurfer.com/> -- 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.
steve .
2010-Jul-17 02:52 UTC
Re: [Puppet Users] subscribing a service to multiple files ?
Or: [...] subscribe => File["larry", "moe", "curly" ], [...] Seems to work as well for me in 0.25.5 ... On Fri, Jul 16, 2010 at 2:49 PM, Rob McBroom <mailinglist0@skurfer.com> wrote:> On Jul 16, 2010, at 12:48 PM, phrawzty wrote: > >> Thus the question : is it possible / advisable to subscribe a service >> to multiple files, and if so, how would it be done ? > > Sure. Just do this: > > subscribe => [ > File["first_file"], > File["second_file"], > File["you_get_the_idea"], > ], > > Or you can use “notify” on each individual file instead of using “subscribe” on the service if you find that easier to manage. > > -- > Rob McBroom > <http://www.skurfer.com/> > > -- > 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. > >-- 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.
You could also do:
class httpd {
...
file { ''/etc/monit.d/httpd.conf'':
...
notify => Service[''monit'']
}
}
But I would rather do it on the service, since then you can with ease
read one line to find out what that service response to.
On 16 Jul, 18:48, phrawzty <phraw...@gmail.com>
wrote:> Hello,
>
> I am currently expanding on the Monit recipes that are available on
> the Wiki (as well as github). One of the oft-used features of Monit
> is the ability to load arbitrary configuration files at runtime (i.e.
> include /etc/monit.d/*.conf). This seems like it could be a good fit
> for integrating service configs with their respective Monit configs in
> Puppet ; however, consider the following :
>
> class httpd {
> ...
> file { ''/etc/monit.d/httpd.conf'':
> ...
> }
>
> }
>
> class monit {
> file { ''/etc/monit.conf'':
> ...
> }
> service { ''monit'':
> subscribe => File["/etc/monit.conf"]
> ...
> }
>
> }
>
> The problem here is that Monit only reads its config files when it is
> (re)started ; based on the subscribe relationship described above,
> Monit will be restarted when /etc/monit.conf changes, but not when /
> etc/monit.d/httpd.conf changes (or appears for the first time, as the
> case may be).
>
> Thus the question : is it possible / advisable to subscribe a service
> to multiple files, and if so, how would it be done ?
>
> Alternatively, i may be taking entirely the wrong approach here, in
> which case the question would be : what would be the best way to
> trigger a Monit reload from outside of the Monit class ? Would it be
> advisable to, for example, define a service-subscribe relationship in
> every class that has a Monit config file (i imagine scoping is an
> issue here).
>
> Thank you all for your time and consideration on this topic.
--
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.
Luke Schierer
2010-Jul-20 12:12 UTC
Re: [Puppet Users] Re: subscribing a service to multiple files ?
service { "httpd":
....
subscribe => [File[''one''],File[''two'']],
}
should work
Luke
On Jul 20, 2010, at 08:10 EDT, Tore wrote:
> You could also do:
> class httpd {
> ...
> file { ''/etc/monit.d/httpd.conf'':
> ...
> notify => Service[''monit'']
> }
>
> }
>
> But I would rather do it on the service, since then you can with ease
> read one line to find out what that service response to.
>
> On 16 Jul, 18:48, phrawzty <phraw...@gmail.com> wrote:
>> Hello,
>>
>> I am currently expanding on the Monit recipes that are available on
>> the Wiki (as well as github). One of the oft-used features of Monit
>> is the ability to load arbitrary configuration files at runtime (i.e.
>> include /etc/monit.d/*.conf). This seems like it could be a good fit
>> for integrating service configs with their respective Monit configs in
>> Puppet ; however, consider the following :
>>
>> class httpd {
>> ...
>> file { ''/etc/monit.d/httpd.conf'':
>> ...
>> }
>>
>> }
>>
>> class monit {
>> file { ''/etc/monit.conf'':
>> ...
>> }
>> service { ''monit'':
>> subscribe => File["/etc/monit.conf"]
>> ...
>> }
>>
>> }
>>
>> The problem here is that Monit only reads its config files when it is
>> (re)started ; based on the subscribe relationship described above,
>> Monit will be restarted when /etc/monit.conf changes, but not when /
>> etc/monit.d/httpd.conf changes (or appears for the first time, as the
>> case may be).
>>
>> Thus the question : is it possible / advisable to subscribe a service
>> to multiple files, and if so, how would it be done ?
>>
>> Alternatively, i may be taking entirely the wrong approach here, in
>> which case the question would be : what would be the best way to
>> trigger a Monit reload from outside of the Monit class ? Would it be
>> advisable to, for example, define a service-subscribe relationship in
>> every class that has a Monit config file (i imagine scoping is an
>> issue here).
>>
>> Thank you all for your time and consideration on this topic.
>
> --
> 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.
>
--
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.
Daniel Maher
2010-Jul-20 13:18 UTC
Re: [Puppet Users] Re: subscribing a service to multiple files ?
On 07/20/2010 02:10 PM, Tore wrote:> You could also do: > class httpd { > ... > file { ''/etc/monit.d/httpd.conf'': > ... > notify => Service[''monit''] > } > > } > > But I would rather do it on the service, since then you can with ease > read one line to find out what that service response to.I suppose it comes down to where the perceived responsibility for the configuration file lies : Since it''s a Monit configuration file, one could make the argument that should it be part of the monit class (or a sub-class thereof). On the other hand, since the configuration snippet in question relates solely to the HTTPd service, and wouldn''t exist on a system that didn''t have said service, then it could easily be part of the httpd class. User preference, ultimately. -- Daniel Maher <dma PLUS puppet AT witbe DOT net> "The Internet is completely over." -- Prince -- 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.