Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zabbix-agentd can't start on CentOS 6.x #264

Closed
caiohasouza opened this issue Aug 18, 2016 · 14 comments
Closed

zabbix-agentd can't start on CentOS 6.x #264

caiohasouza opened this issue Aug 18, 2016 · 14 comments

Comments

@caiohasouza
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 3.8.7
  • Ruby: 1.8.7
  • Distribution: CentOS release 6.8 (Final)
  • Module version: v2.4.0

How to reproduce (e.g Puppet code you use)

include zabbix::agent

What are you seeing

Problem 1: The service zabbix-agent on Centos 6.x have the binary in "/usr/sbin/zabbix_agentd", but template the module (https://github.com/voxpupuli/puppet-zabbix/blob/master/templates/zabbix-agent-redhat.init.erb) use the path "/usr/local/sbin/zabbix_agentd".

Problem 2: In template init.d (https://github.com/voxpupuli/puppet-zabbix/blob/master/templates/zabbix-agent-redhat.init.erb) have syntax error on "OPTS" variable, the caracter "-c" are in variable (OPTS="-c <%= @agent_configfile_path %>") and daemon (daemon "$ZABBIX_BIN -c $OPTS").

What behaviour did you expect instead

service start works

Output log

Problem 1:
Error: Could not start Service[zabbix-agent]: Execution of '/sbin/service zabbix-agent start' returned 5: /usr/local/sbin/zabbix_agentd not installed!
Error: /Stage[main]/Zabbix::Agent/Service[zabbix-agent]/ensure: change from stopped to running failed: Could not start Service[zabbix-agent]: Execution of '/sbin/service zabbix-agent start' returned 5: /usr/local/sbin/zabbix_agentd not installed!

Problem 2:
Iniciando o Zabbix Agent: zabbix_agentd [32380]: cannot open config file [-c]: [2] No such file or directory

Any additional information you'd like to impart

After correct both problems de service works.

@bastelfreak
Copy link
Member

ugh :( Thanks for reporting this. Do you think you're able to provide a patch for this?

@caiohasouza
Copy link
Author

Hello @bastelfreak,

I think that best solution are use script default from package zabbix-agentd from CentOS, see please: #265. I already tested and working.

@caiohasouza
Copy link
Author

Ah, or remove the code in startup.pp:

elsif $::osfamily in ['Debian', 'RedHat'] {
# Currently other osfamily without systemd is not supported
$osfamily_downcase = downcase($::osfamily)
file { "/etc/init.d/${name}":
ensure => file,
mode => '0755',
content => template("zabbix/${name}-${osfamily_downcase}.init.erb"),
}

Do you decide, :)

@shaunrampersad
Copy link
Contributor

shaunrampersad commented Oct 10, 2016

HI Guys

I'm experiencing the same issues on RHEL6.

Possible solution for problem1:
Change the template
from

ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"

to

ZABBIX_BIN=`which zabbix_agentd`

shaunrampersad added a commit to shaunrampersad/puppet-zabbix that referenced this issue Oct 10, 2016
shaunrampersad added a commit to shaunrampersad/puppet-zabbix that referenced this issue Oct 10, 2016
@bastelfreak
Copy link
Member

Hi,
I'm not sure if /usr/local/sbin/zabbix_agentd is valid on any RHEL clone. I checked my CentOS 6 and 7 boxes and both have /usr/sbin/zabbix_agentd. However, I like the proposal from @shaunrampersad, this should be the most flexible.

@bastelfreak
Copy link
Member

@shaunrampersad you opened the PR against your fork, not sure if this was intended. Could you open it against the Vox Pupuli repo as well?

@killermoehre
Copy link

IMHO it should be ZABBIX_BIN="$(type -P zabbix_agent)". Less forking (type is inbuild) and backticks are somehow discouraged due to nesting issues (and they look ugly).

@shaunrampersad
Copy link
Contributor

@bastelfreak , happy to do the PR to Vox Pupuli.
I did it on mine to test before I submitted to Vox.

@killermoehre , havent used type -P. I'm no expert on this, but looks like it works as well. Happy to change to this and submit PR if everyone is happy ?

shaunrampersad added a commit to shaunrampersad/puppet-zabbix that referenced this issue Oct 10, 2016
@shaunrampersad
Copy link
Contributor

@bastelfreak , submitted a PR anyways.
I've tested and agent starts up now.

shaunrampersad added a commit to shaunrampersad/puppet-zabbix that referenced this issue Oct 11, 2016
@shaunrampersad
Copy link
Contributor

I've also fixed the zabbix-server-redhat.init.erb.

ZABBIX_BIN="$(type -P zabbix_server)"
OPTS="<%= @server_configfile_path %>"

bastelfreak added a commit that referenced this issue Oct 11, 2016
@bastelfreak
Copy link
Member

@XDexter can you confirm that the changes we merged in #291 work? Than I can kick of a nother release of the module.

@admont
Copy link
Contributor

admont commented Oct 11, 2016

Yes, it works now. Thank you!

@bastelfreak
Copy link
Member

okay perfect. travis is currently busy, not sure if we can kick out a release today, I will add it to the queue.

@caiohasouza
Copy link
Author

Perfect, thank you all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants