example42 / puppet-splunk

Splunk Puppet Module
http://www.example42.com
Other
12 stars 29 forks source link

Splunk not added to chkconfig #25

Open neilmcbride1 opened 10 years ago

neilmcbride1 commented 10 years ago

Hi,

Is there anything extra I need to add in order to get splunk added to chkconfig?

err: /Stage[main]/Splunk/Service[splunk]/ensure: change from stopped to running failed: Could not enable splunk: Execution of '/sbin/chkconfig splunk on' returned 1: service splunk does not support chkconfig

sprink commented 9 years ago

I get this same error above on amazon AMI.

sebykrueger commented 9 years ago

The problem is that splunk does not generate a valid init.d script. if you add

chkconfig: 2345 20 80

to the /etc/init.d/splunk init script it will work.

alvagante commented 9 years ago

Yes. That's not something I would do via Puppet. I'd rather try to open an issue on Splunk.

sebykrueger commented 9 years ago

But what would you do in the mean time until an updated splunk is available?

Just add this until splunk fix it:

file_line { 'chkconfig_line': path => '/etc/init.d/splunk', after => '#!/bin/sh', line => '# chkconfig: 2345 20 80', require => Exec['splunk_create_service'] }

alvagante commented 9 years ago

I don't feel comfortable in adding to the module something that changes a file which is not marked as configuration file (ad so is not preserved on packages upgrades) in the rpm. Anyway, your solution looks fine, I might eventually accept a PR that implements it only if a boolean parameter is set to true (called for example fix_service_script) but is false by default (so that it doesn't do any change by default)

grepit commented 7 years ago

just add the following comments to /etc/init.d/splunk

# chkconfig: 2345 20 80
# description: splunk start up

then run commnad: chkconfig --add splunk