voxpupuli / puppet-zabbix

Puppet module for creating and maintaining zabbix components with puppet.
https://forge.puppet.com/puppet/zabbix
Apache License 2.0
80 stars 227 forks source link

zabbix-agent-systemd.init.erb #962

Closed KIvanov-1984 closed 4 months ago

KIvanov-1984 commented 4 months ago

Hello, you have an error in this file for zabbix-agent2

ExecStart=/usr/sbin/zabbix_agentd in file

ExecStart=/usr/sbin/zabbix_agent2 systemd file for zabbix-agent2

Valantin commented 4 months ago

as mentioned here #951 and documented in README and REFERENCE you need to set manage_startup_script to false

KIvanov-1984 commented 4 months ago

This will not work, since the /usr/sbin/zabbix_agent2 binary is used to run Zabbix Agent 2, and for Zabbix Agent /usr/sbin/zabbix_agentd, in the template file for systemd it is written in plain text without variables:

# THIS FILE IS MANAGED BY PUPPET
[Unit]
Description=Zabbix Agent
After=network.target

[Service]
<% if @service_type %>Type=<%= @service_type %><% end %>
Restart=on-failure
<% if @pidfile %>PIDFile=<%= @pidfile %><% end %>
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agentd <%= @additional_service_params %> -c <%= @agent_configfile_path %>
<% if @zabbix_user %>User=<%= @zabbix_user %><% end %>
RestartSec=10s

[Install]
WantedBy=multi-user.target

Thus Zabbix Agent 2 will not start

Valantin commented 4 months ago

ok, probably I assume something not know by other, but in this section of the readme https://github.com/voxpupuli/puppet-zabbix/blob/master/README.md#usage-zabbix-agent2 as reported the minimal code to run agent2 if you not use the minimal code provided to use agent2, agent2 not run properly.

I'm working to a future release to make manage_startup_script false as default to prevent this misanderstanding.