I have a service that just wont restart.

197 views
Skip to first unread message

Joehillen

unread,
Jul 7, 2011, 7:59:58 PM7/7/11
to puppet...@googlegroups.com
For my nagios::nrpe class, I have the following service:

        service {"nagios-nrpe-server":
            ensure => running,
            enable => true,
            require => Package["nagios-nrpe-server"],
            hasrestart => true,
            restart => "/etc/init.d/nagios-nrpe-server restart",
            subscribe => File["/etc/nagios/nrpe.d/"],
        }

In all of the nrpe config file entries, I have:

        notify => Service["nagios-nrpe-server"]

It even says that it restarted the service:

info: /Stage[main]//Node[alpha.xxxxxxxx.net]/Nagios::Nrpe::Check_mem[alpha.xxxxxxxx.net]/Nagios::Nrpe::Check[mem]/File[/etc/nagios/nrpe.d/check_mem.cfg]: Scheduling refresh of Service[nagios-nrpe-server]
notice: /Stage[main]/Nagios::Nrpe/Service[nagios-nrpe-server]/ensure: ensure changed 'stopped' to 'running'
notice: /Stage[main]/Nagios::Nrpe/Service[nagios-nrpe-server]: Triggered 'refresh' from 1 events

However, it wont actually restart the service, and I have to do it manually:

    sudo /etc/init.d/nagios-nrpe-server restart

After that, it works perfectly.

I am running Puppet 2.6.2 on Debian Lenny

Ken Barber

unread,
Jul 7, 2011, 8:07:49 PM7/7/11
to puppet...@googlegroups.com
> notice: /Stage[main]/Nagios::Nrpe/Service[nagios-nrpe-server]/ensure: ensure
> changed 'stopped' to 'running'

That looks like its trying to start it, not restart it. Do you get
this message each time you do a puppet run (even when nothing has
changed)? If so - you might need a valid 'status' command and use
hasstatus => true. It probably thinks its not started perhaps.

Puppet falls back to looking in the process table when you don't
specify hasstatus => true to determine service status - and it uses
the name of the service (in this case nagios-nrpe-server) to do the
search.

ken.

Joehillen

unread,
Jul 7, 2011, 8:18:51 PM7/7/11
to puppet...@googlegroups.com
Yes, it says it every time. The actual process is called "nrpe", so that makes sense that it can't find it. 

Unfortunately, it doesn't have a status command. What should I do instead?

Ken Barber

unread,
Jul 7, 2011, 8:29:10 PM7/7/11
to puppet...@googlegroups.com
Use the pattern attribute, documented here:

http://docs.puppetlabs.com/references/stable/type.html#service

ken.

> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/3UvUuuLOprIJ.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

--
"Join us for PuppetConf, September 22nd and 23rd in Portland, OR:
http://bit.ly/puppetconfsig"

Joehillen

unread,
Jul 7, 2011, 8:37:01 PM7/7/11
to puppet...@googlegroups.com
Awesome! Adding `pattern => "nrpe"` solved the issue. 

Thanks for your help.
Reply all
Reply to author
Forward
0 new messages