I wanted to configure file monitoring on puppet. every time file change I wanted the service to be restarted... it seemed easy but I can''t do it... i used it: http://www.puppetcookbook.com/posts/restart-a-service-when-a-file-changes.html (..) service { ''nagios3'': ensure => "running", enable => "true", hasstatus => "true", hasrestart=> "true", require => Package["nagios3"], } (..) file { ''/etc/nagios3/conf.d/puppet_services.cfg'': ensure => "present", owner => "root", group => "root", mode => 644, notify => Service["nagios3"], } when i change the file puppet sees it , but it doesn''t restart nagios service could anyone help me on that? :) Best regards nichu -- 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.
Nagios is not being restarted because the _state_ of the file isn''t changing, it went from present to present. If you want the contents of the file to trigger the restart, then you have to manage the contents of the file with puppet (either with a content or source parameter) If you just want a trigger file — and don''t care about the contents themselves —to restart nagios, you could use "ensure => absent". That would delete the file and notify the nagios3 resource. That being said, the nagios resources are pretty easy to work with, if you want to build that file with puppet. — Mason Turner (mobile) On May 15, 2012, at 7:21 AM, nichu <nichuspam@gmail.com> wrote:> I wanted to configure file monitoring on puppet. every time file > change I wanted the service to be restarted... > it seemed easy but I can''t do it... > > i used it: > http://www.puppetcookbook.com/posts/restart-a-service-when-a-file-changes.html > > (..) > > service { ''nagios3'': > ensure => "running", > enable => "true", > hasstatus => "true", > hasrestart=> "true", > require => Package["nagios3"], > } > > (..) > file { ''/etc/nagios3/conf.d/puppet_services.cfg'': > ensure => "present", > owner => "root", > group => "root", > mode => 644, > notify => Service["nagios3"], > } > > > when i change the file puppet sees it , but it doesn''t restart nagios > service > could anyone help me on that? :) > > Best regards > nichu > > -- > 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.
Thank you for fast response... But in my case I manage the content of the file with puppet... I use built in functions of nagios... Nagios_service <<||>> @@nagios_service { "Proc-$fqdn": use => ''generic-service'', check_command => ''check-p[roc'', host_name => $fqdn, service_description => ''Total Processess'', target => "/etc/nagios3/conf.d/puppet_services.cfg", } isn''t it enough? i have to use content or source? Those definition before file { ''/etc/nagios3/conf.d/puppet_services.cfg'': is only to ensure that file is created with valid permissions etc. Regards, nichu On May 15, 1:37 pm, Mason Turner <opsma...@gmail.com> wrote:> Nagios is not being restarted because the _state_ of the file isn''t changing, it went from present to present. If you want the contents of the file to trigger the restart, then you have to manage the contents of the file with puppet (either with a content or source parameter) >> — Mason Turner (mobile) > > On May 15, 2012, at 7:21 AM, nichu <nichus...@gmail.com> wrote: > > > > > > > > > I wanted to configure file monitoring on puppet. every time file > > change I wanted the service to be restarted... > > it seemed easy but I can''t do it... > > > i used it: > >http://www.puppetcookbook.com/posts/restart-a-service-when-a-file-cha... > > > (..) > > > service { ''nagios3'': > > ensure => "running", > > enable => "true", > > hasstatus => "true", > > hasrestart=> "true", > > require => Package["nagios3"], > > } > > > (..) > > file { ''/etc/nagios3/conf.d/puppet_services.cfg'': > > ensure => "present", > > owner => "root", > > group => "root", > > mode => 644, > > notify => Service["nagios3"], > > } > > > when i change the file puppet sees it , but it doesn''t restart nagios > > service > > could anyone help me on that? :) > > > Best regards > > nichu > > > -- > > 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 athttp://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.
OK I found solution Sorry for bothering ;) in case someone has the same problem: we should use: Nagios_service <<||>> { notify => Service[''nagios3''] } BR On May 15, 1:51 pm, marcin <m...@gmail.com> wrote:> Thank you for fast response... > > But in my case I manage the content of the file with puppet... > I use built in functions of nagios... > > Nagios_service <<||>> > > @@nagios_service { "Proc-$fqdn": > use => ''generic-service'', > check_command => ''check-p[roc'', > host_name => $fqdn, > service_description => ''Total Processess'', > target => "/etc/nagios3/conf.d/puppet_services.cfg", > } > > isn''t it enough? i have to use content or source? > > Those definition before > file { ''/etc/nagios3/conf.d/puppet_services.cfg'': > is only to ensure that file is created with valid permissions etc. > > Regards, > nichu > > On May 15, 1:37 pm, Mason Turner <opsma...@gmail.com> wrote: > > > > > > > > > Nagios is not being restarted because the _state_ of the file isn''t changing, it went from present to present. If you want the contents of the file to trigger the restart, then you have to manage the contents of the file with puppet (either with a content or source parameter) > > > — Mason Turner (mobile) > > > On May 15, 2012, at 7:21 AM, nichu <nichus...@gmail.com> wrote: > > > > I wanted to configure file monitoring on puppet. every time file > > > change I wanted the service to be restarted... > > > it seemed easy but I can''t do it... > > > > i used it: > > >http://www.puppetcookbook.com/posts/restart-a-service-when-a-file-cha... > > > > (..) > > > > service { ''nagios3'': > > > ensure => "running", > > > enable => "true", > > > hasstatus => "true", > > > hasrestart=> "true", > > > require => Package["nagios3"], > > > } > > > > (..) > > > file { ''/etc/nagios3/conf.d/puppet_services.cfg'': > > > ensure => "present", > > > owner => "root", > > > group => "root", > > > mode => 644, > > > notify => Service["nagios3"], > > > } > > > > when i change the file puppet sees it , but it doesn''t restart nagios > > > service > > > could anyone help me on that? :) > > > > Best regards > > > nichu > > > > -- > > > 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 athttp://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.