Here's the init script:
(by the way, I changed the service to rsyslog [in the zabbix manifest
file] and this works like a charm. So the service action works in
puppet...)
#! /bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/etc/zabbix:/etc/zabbix/bin:/etc/
zabbix/sbin
DAEMON=/etc/zabbix/sbin/zabbix_agentd
NAME=zabbix_agentd
DESC="Zabbix agent"
PID=/var/tmp/$NAME.pid
test -f $DAEMON || exit 0
set -e
case "$1" in
start)
echo "Starting $DESC: $NAME"
start-stop-daemon --oknodo --start --pidfile $PID \
--exec $DAEMON
;;
stop)
echo "Stopping $DESC: $NAME"
start-stop-daemon --oknodo --stop --pidfile $PID \
--exec $DAEMON
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
On 30 sep, 17:24, Nigel Kersten <[email protected]> wrote:
> Can you post the init script?
>
> Is it possible it's a PATH problem inside the script? Something that
> works under your environment, but not under the user puppet is running
> as?
>
> On Thu, Sep 30, 2010 at 8:16 AM, D.N. van der Meijden
>
>
>
> <[email protected]> wrote:
> > My bad!! I understand the puppet command now...
>
> > client:/tmp# puppet --verbose --debug --trace test.pp
> > debug: file /sbin/chkconfig does not exist
> > debug: file /usr/sbin/svcadm does not exist
> > debug: file /sbin/rc-update does not exist
> > debug: Creating default schedules
> > debug: Service[zabbix_agent](provider=debian): Executing '/etc/init.d/
> > zabbix_agent status'
> > debug: Puppet::Type::Service::ProviderDebian: Executing '/usr/sbin/
> > update-rc.d -n -f zabbix_agent remove'
> > debug: //Service[zabbix_agent]: Changing ensure
> > debug: //Service[zabbix_agent]: 1 change(s)
> > debug: Service[zabbix_agent](provider=debian): Executing '/etc/init.d/
> > zabbix_agent start'
> > /usr/lib/ruby/1.8/puppet/util/errors.rb:51:in `fail'
> > /usr/lib/ruby/1.8/puppet/provider/service/base.rb:122:in `texecute'
> > /usr/lib/ruby/1.8/puppet/provider/service/base.rb:134:in `ucommand'
> > /usr/lib/ruby/1.8/puppet/provider/service/base.rb:78:in `start'
> > /usr/lib/ruby/1.8/puppet/type/service.rb:61:in `set_running'
> > /usr/lib/ruby/1.8/puppet/property.rb:163:in `send'
> > /usr/lib/ruby/1.8/puppet/property.rb:163:in `call_valuemethod'
> > /usr/lib/ruby/1.8/puppet/property.rb:349:in `set'
> > /usr/lib/ruby/1.8/puppet/property.rb:421:in `sync'
> > /usr/lib/ruby/1.8/puppet/type/service.rb:72:in `sync'
> > /usr/lib/ruby/1.8/puppet/transaction/change.rb:54:in `go'
> > /usr/lib/ruby/1.8/puppet/transaction/change.rb:74:in `forward'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:118:in `apply_changes'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:111:in `collect'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:111:in `apply_changes'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:83:in `apply'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:239:in `eval_resource'
> > /usr/lib/ruby/1.8/puppet/util.rb:445:in `thinmark'
> > /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
> > /usr/lib/ruby/1.8/puppet/util.rb:444:in `thinmark'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:238:in `eval_resource'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:310:in `evaluate'
> > /usr/lib/ruby/1.8/puppet/util.rb:445:in `thinmark'
> > /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
> > /usr/lib/ruby/1.8/puppet/util.rb:444:in `thinmark'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:309:in `evaluate'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:303:in `collect'
> > /usr/lib/ruby/1.8/puppet/transaction.rb:303:in `evaluate'
> > /usr/lib/ruby/1.8/puppet/node/catalog.rb:124:in `apply'
> > /usr/bin/puppet:220
> > err: //Service[zabbix_agent]/ensure: change from stopped to running
> > failed: Could not start Service[zabbix_agent]: Execution of '/etc/
> > init.d/zabbix_agent start' returned 1: at /tmp/test.pp:6
> > debug: Finishing transaction 69992700590000 with 1 changes
>
> > On 30 sep, 17:03, "D.N. van der Meijden" <[email protected]>
> > wrote:
> >> No problem Luke, thanks for helping me out here.
> >> Since I'm still a puppet n00b, where should I place the test.pp? On
> >> the host I presume (I tried /etc/puppet/manifests/test.pp) ?
>
> >> test.pp:
> >> class test {
> >> service { "rsyslog":
> >> name => "rsyslog",
> >> enable => true,
> >> ensure => running,
> >> hasstatus => true,
> >> subscribe => File["/etc/rsyslog.conf"],
> >> }
>
> >> }
>
> >> If I start the command on the client, I get some weird output:
>
> >> client:/etc/init.d# puppet apply --verbose --debug --trace --summarize
> >> test.pp
> >> /usr/lib/ruby/1.8/puppet/parser/parser_support.rb:95:in `file='
> >> /usr/lib/ruby/1.8/puppet/parser/interpreter.rb:69:in `create_parser'
> >> /usr/lib/ruby/1.8/puppet/parser/interpreter.rb:54:in `parser'
> >> /usr/lib/ruby/1.8/puppet/parser/interpreter.rb:27:in `compile'
> >> /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:68:in
> >> `compile'
> >> /usr/lib/ruby/1.8/puppet/util.rb:217:in `benchmark'
> >> /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:66:in
> >> `compile'
> >> /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:21:in `find'
> >> /usr/lib/ruby/1.8/puppet/indirector/indirection.rb:210:in `find'
> >> /usr/lib/ruby/1.8/puppet/indirector.rb:49:in `find'
> >> /usr/bin/puppet:210
> >> Could not parse for environment production: Could not find file /etc/
> >> init.d/apply.pp
>
> >> On 30 sep, 16:45, "luke.bigum" <[email protected]> wrote:
>
> >> > My apologies, I thought you were saying it starts but were unaware of
> >> > the exit code.
>
> >> > I'm now unsure... You could try run this:
>
> >> > puppet apply --verbose --debug --trace --summarize test.pp
>
> >> > where test.pp is the simplest form of your service as possible, and
> >> > see if you get anything useful, although I've just done that on a
> >> > CentOS system and it wasn't as helpful as I imagined (didn't blatantly
> >> > tell me the exit code as I hoped).
>
> >> > On Sep 30, 3:33 pm, "D.N. van der Meijden" <[email protected]>
> >> > wrote:
>
> >> > > Hi Luke,
>
> >> > > As mentioned it works manually:
>
> >> > > 'client:~# /etc/init.d/zabbix_agent start ; echo $?
> >> > > Starting Zabbix agent: zabbix_agentd
> >> > > 0
>
> >> > > By the way, this specific client is a lenny 5.05
>
> >> > > On 30 sep, 16:28, "luke.bigum" <[email protected]> wrote:
>
> >> > > > As Nigel indicated, the exit code for your init script is not what
> >> > > > puppet expects, it is not a file permission problem.
>
> >> > > > As Nigel suggested, shut down your service then run this:
>
> >> > > > /etc/init.d/zabbix_agent start ; echo $?
>
> >> > > > And tell us what number is printed on the screen. If it prints 1,
> >> > > > that
> >> > > > would explain your Puppet error message. Not sure what operating
> >> > > > system you use, but init scripts SHOULD return 0 when they run
> >> > > > successfully. If your init script is returning 1 on success, it's
> >> > > > broken.
>
> >> > > > -Luke
>
> >> > > > On Sep 30, 3:04 pm, "D.N. van der Meijden" <[email protected]>
> >> > > > wrote:
>
> >> > > > > Thanks for the quick reply Nigel.
> >> > > > > I understand that the puppet is reporting back the exit status, but
> >> > > > > what I don't understand is why it keeps failing when trying to
> >> > > > > start
> >> > > > > via puppet.
> >> > > > > All files are available on the client, permissions are ok and
> >> > > > > starting
> >> > > > > the daemon manually works without problems.
>
> >> > > > > On 30 sep, 15:57, Nigel Kersten <[email protected]> wrote:
>
> >> > > > > > On Thu, Sep 30, 2010 at 6:42 AM, D.N. van der Meijden
>
> >> > > > > > <[email protected]> wrote:
> >> > > > > > > I'm trying to get a service running, but I keep getting the
> >> > > > > > > following
> >> > > > > > > error message:
> >> > > > > > > "err: //Node[debiannode]/zabbix/Service[zabbix_agent]/ensure:
> >> > > > > > > change
> >> > > > > > > from stopped to running failed: Could not start
> >> > > > > > > Service[zabbix_agent]:
> >> > > > > > > Execution of '/etc/init.d/zabbix_agent start' returned 1: at
> >> > > > > > > /etc/
> >> > > > > > > puppet/modules/zabbix/manifests/init.pp:62"
>
> >> > > > > > > The part of the init.pp script:
> >> > > > > > > service { "zabbix_agent":
> >> > > > > > > name => "zabbix_agent",
> >> > > > > > > enable => true,
> >> > > > > > > ensure => running,
> >> > > > > > > hasstatus => true,
> >> > > > > > > subscribe => File["zabbix_agentd.conf"],
> >> > > > > > > require => [ File["/etc/zabbix"],
> >> > > > > > > File["zabbix_agentd.conf"] ],
> >> > > > > > > } # <-- line 62
>
> >> > > > > > > If I start the daemon manually [as root or normal user zabbix]
> >> > > > > > > (i.e. /
> >> > > > > > > etc/init.d/zabbix_agent start), it works.
> >> > > > > > > I checked the permissions, but these are set at 755 so that
> >> > > > > > > shouldn't
> >> > > > > > > be a problem.
>
> >> > > > > > > client:~# /etc/init.d/zabbix_agent start
> >> > > > > > > Starting Zabbix agent: zabbix_agentd
> >> > > > > > > client:~# ps -ef | grep zabbix
> >> > > > > > > zabbix 2116 1 0 15:37 ? 00:00:00
> >> > > > > > > /etc/zabbix/sbin/
> >> > > > > > > zabbix_agentd
> >> > > > > > > zabbix 2117 2116 0 15:37 ? 00:00:00
> >> > > > > > > /etc/zabbix/sbin/
> >> > > > > > > zabbix_agentd
> >> > > > > > > zabbix 2118 2116 0 15:37 ? 00:00:00
> >> > > > > > > /etc/zabbix/sbin/
> >> > > > > > > zabbix_agentd
> >> > > > > > > zabbix 2119 2116 0 15:37 ? 00:00:00
> >> > > > > > > /etc/zabbix/sbin/
> >> > > > > > > zabbix_agentd
> >> > > > > > > zabbix 2120 2116 0 15:37 ? 00:00:00
> >> > > > > > > /etc/zabbix/sbin/
> >> > > > > > > zabbix_agentd
> >> > > > > > > zabbix 2121 2116 0 15:37 ? 00:00:00
> >> > > > > > > /etc/zabbix/sbin/
> >> > > > > > > zabbix_agentd
> >> > > > > > > zabbix 2122 2116 0 15:37 ? 00:00:00
> >> > > > > > > /etc/zabbix/sbin/
> >> > > > > > > zabbix_agentd
> >> > > > > > > root 2124 1890 0 15:37 pts/2 00:00:00 grep zabbix
>
> >> > > > > > > What am I missing here?
>
> >> > > > > > The exit status of starting the daemon, which is what Puppet is
> >> > > > > > reporting back to you.
>
> >> > > > > > /etc/init.d/zabbix_agent start ; echo $?
>
> >> > > > > > It sounds like puppet is actually starting it but thinking the
> >> > > > > > operation failed because the init script exits non-zero.
>
> >> > > > > > > --
> >> > > > > > > You received this message because you are subscribed to the
> >> > > > > > > Google Groups "Puppet Users" group.
> >> > > > > > > To post to this group, send email to
> >> > > > > > > [email protected].
> >> > > > > > > To unsubscribe from this group, send email to
> >> > > > > > > [email protected].
> >> > > > > > > For more options, visit this group
> >> > > > > > > athttp://groups.google.com/group/puppet-users?hl=en.
>
> >> > > > > > --
> >> > > > > > nigel- Tekst uit oorspronkelijk bericht niet weergeven -
>
> >> > > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit
> >> > > > > > oorspronkelijk bericht niet weergeven -
>
> >> > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit
> >> > > > oorspronkelijk bericht niet weergeven -
>
> >> > - Tekst
>
> ...
>
> meer lezen »- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.