Sans
2013-Oct-05 20:33 UTC
[Puppet Users] Puppet is always trying ''service start'' instead of ''restart'' - how to force restart?
Dear all, As stated in the title, I have a module for ganglia gmond, where puppet is always doing ''*/etc/init.d/ganglia-monitor start*'' instead of ''*restart*'' whenever a ''refresh'' is triggered for the service. This is what I have in my module: file { ''gmond_conf'':> name => ''/etc/ganglia/gmond.conf'', > ensure => file, mode => ''0644'', > owner => ''root'', group => ''root'', > content => template(''ganglia/slv_gmond_conf.erb''), > require => Package[''ganglia-monitor''], > notify => Service[''ganglia-monitor''], > } ~> > > service { ''ganglia-monitor'': > ensure => running, > enable => true, > hasrestart => true, > hasstatus => false, > #restart => undef, > subscribe => File[''gmond_conf''], > require => [ File[''gmond_conf''], Package[''ganglia-monitor''] ]; > } > >And this is the error I get: Info: FileBucket adding {md5}ac59a119cca8e15b40e85ea496d39970> Info: /Stage[main]/Ganglia::Install/File[gmond_conf]: Filebucketed > /etc/ganglia/gmond.conf to puppet with sum ac59a119cca8e15b40e85ea496d39970 > Notice: /Stage[main]/Ganglia::Install/File[gmond_conf]/content: content > changed ''{md5}ac59a119cca8e15b40e85ea496d39970'' to > ''{md5}29218a6ac8b11868c311dcbbf26cdf83'' > Info: /Stage[main]/Ganglia::Install/File[gmond_conf]: Scheduling refresh > of Service[ganglia-monitor] > Info: /Stage[main]/Ganglia::Install/File[gmond_conf]: Scheduling refresh > of Service[ganglia-monitor] > Info: /Stage[main]/Ganglia::Install/File[gmond_conf]: Scheduling refresh > of Service[ganglia-monitor] > Debug: /Stage[main]/Ganglia::Install/File[gmond_conf]: The container > Class[Ganglia::Install] will propagate my refresh event > Debug: Service[ganglia-monitor](provider=debian): Executing ''ps -ef'' > Debug: Executing ''/etc/init.d/ganglia-monitor start'' > Error: Could not start Service[ganglia-monitor]: Execution of > ''/etc/init.d/ganglia-monitor start'' returned 1: > Error: /Stage[main]/Ganglia::Install/Service[ganglia-monitor]/ensure: > change from stopped to running failed: Could not start > Service[ganglia-monitor]: Execution of ''/etc/init.d/ganglia-monitor start'' > returned 1: >As a result, *gmond* never restarted when the config file is changed. In fact it actually fails (returns 1) id "start'' is used whilst the service is still running.> root@ip-10-0-24-28:~# /usr/sbin/service ganglia-monitor start; echo $? > Starting Ganglia Monitor Daemon: /usr/sbin/gmond already running. > 1 > root@ip-10-0-24-28:~# >Am I missing something here? Or how can I force puppet to use ''restart'' instead? I''m using Puppet v3.2.3. Thanks in advance. Cheers!! -- 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.
Trevor Vaughan
2013-Oct-06 01:40 UTC
Re: [Puppet Users] Puppet is always trying ''service start'' instead of ''restart'' - how to force restart?
Sans, This is probably because you don''t have a process named ganglia-monitor running on your system. service { ''ganglia-monitor'': ensure => running, enable => true, hasrestart => true, # This says to look for a process called ''ganglia-monitor'' if it doesn''t exist, the service isn''t running. hasstatus => false, #restart => undef, subscribe => File[''gmond_conf''], require => [ File[''gmond_conf''], Package[''ganglia-monitor''] ]; } You''ll need to add a custom ''status'' command using the ''status'' parameter. Or fix the init script to work properly when called with ''status'' and set ''hasstatus => true''. Trevor On Sat, Oct 5, 2013 at 4:33 PM, Sans <r.santanu.das@gmail.com> wrote:> Dear all, > > As stated in the title, I have a module for ganglia gmond, where puppet is > always doing ''*/etc/init.d/ganglia-monitor start*'' instead of ''*restart*'' > whenever a ''refresh'' is triggered for the service. This is what I have in > my module: > > > file { ''gmond_conf'': >> name => ''/etc/ganglia/gmond.conf'', >> ensure => file, mode => ''0644'', >> owner => ''root'', group => ''root'', >> content => template(''ganglia/slv_gmond_conf.erb''), >> require => Package[''ganglia-monitor''], >> notify => Service[''ganglia-monitor''], >> } ~> >> >> service { ''ganglia-monitor'': >> ensure => running, >> enable => true, >> hasrestart => true, >> hasstatus => false, >> #restart => undef, >> subscribe => File[''gmond_conf''], >> require => [ File[''gmond_conf''], Package[''ganglia-monitor''] ]; >> } >> >> > And this is the error I get: > > > Info: FileBucket adding {md5}ac59a119cca8e15b40e85ea496d39970 >> Info: /Stage[main]/Ganglia::Install/File[gmond_conf]: Filebucketed >> /etc/ganglia/gmond.conf to puppet with sum ac59a119cca8e15b40e85ea496d39970 >> Notice: /Stage[main]/Ganglia::Install/File[gmond_conf]/content: content >> changed ''{md5}ac59a119cca8e15b40e85ea496d39970'' to >> ''{md5}29218a6ac8b11868c311dcbbf26cdf83'' >> Info: /Stage[main]/Ganglia::Install/File[gmond_conf]: Scheduling refresh >> of Service[ganglia-monitor] >> Info: /Stage[main]/Ganglia::Install/File[gmond_conf]: Scheduling refresh >> of Service[ganglia-monitor] >> Info: /Stage[main]/Ganglia::Install/File[gmond_conf]: Scheduling refresh >> of Service[ganglia-monitor] >> Debug: /Stage[main]/Ganglia::Install/File[gmond_conf]: The container >> Class[Ganglia::Install] will propagate my refresh event >> Debug: Service[ganglia-monitor](provider=debian): Executing ''ps -ef'' >> Debug: Executing ''/etc/init.d/ganglia-monitor start'' >> Error: Could not start Service[ganglia-monitor]: Execution of >> ''/etc/init.d/ganglia-monitor start'' returned 1: >> Error: /Stage[main]/Ganglia::Install/Service[ganglia-monitor]/ensure: >> change from stopped to running failed: Could not start >> Service[ganglia-monitor]: Execution of ''/etc/init.d/ganglia-monitor start'' >> returned 1: >> > > > As a result, *gmond* never restarted when the config file is changed. In > fact it actually fails (returns 1) id "start'' is used whilst the service is > still running. > > > >> root@ip-10-0-24-28:~# /usr/sbin/service ganglia-monitor start; echo $? >> Starting Ganglia Monitor Daemon: /usr/sbin/gmond already running. >> 1 >> root@ip-10-0-24-28:~# >> > > > Am I missing something here? Or how can I force puppet to use ''restart'' > instead? I''m using Puppet v3.2.3. > Thanks in advance. Cheers!! > > -- > 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. >-- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 tvaughan@onyxpoint.com -- This account not approved for unencrypted proprietary information -- -- 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.
Sans
2013-Oct-06 17:32 UTC
Re: [Puppet Users] Puppet is always trying ''service start'' instead of ''restart'' - how to force restart?
Thanks Trevor! Although I was wondering about it but never thought that''s actually causing this problem. On Debian/Ubuntu, the name of the init.d script (ganglia-monitor) is different than the daemon (gmond). Fixed now. Cheers!! -- 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.