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

Errors after using module for zabbix agent 2 #971

Open
KIvanov-1984 opened this issue Jul 2, 2024 · 4 comments
Open

Errors after using module for zabbix agent 2 #971

KIvanov-1984 opened this issue Jul 2, 2024 · 4 comments
Labels
duplicate This issue or pull request already exists skip-changelog

Comments

@KIvanov-1984
Copy link

  1. zabbix-agent-systemd.init.erb - in this file exec procces is zabbix_agentd, for zabbix agent 2 using bin file zabbix_agent2
  2. module delete /etc/zabbix/zabbix_agent2.d/plugin.d - plugins config path, it is should not be that
@Valantin
Copy link
Contributor

Valantin commented Jul 9, 2024

Hi @KIvanov-1984 As I said in your previous issue, have you used the suggested code?

class { 'zabbix::agent':
  agent_configfile_path => '/etc/zabbix/zabbix_agent2.conf',
  include_dir           => '/etc/zabbix/zabbix_agent2.d',
  include_dir_purge     => false,
  zabbix_package_agent  => 'zabbix-agent2',
  servicename           => 'zabbix-agent2',
  manage_startup_script => false,
  server                => '192.168.20.11',
}

You must use the suggested code to run agent2 without the issue you report

@Valantin Valantin added duplicate This issue or pull request already exists skip-changelog labels Jul 9, 2024
@amuckart
Copy link

If you did have manage_startup_script set to true, you need to manually remove the old scripts, do a systemctl daemon-reload (assuming Linux & systemd) and then manually enable the services that were shipped with the packages.

IMO if you have manage_startup_script set to false, and manage_service set to true, the module should do this for you.

@d1nuc0m
Copy link

d1nuc0m commented Feb 21, 2025

@Valantin manage_startup_script true generates this zabbix-agent2.service file:

[Unit]
Description=Zabbix Agent
After=network.target

[Service]
Type=simple
Restart=on-failure
PIDFile=/var/run/zabbix/zabbix_agentd.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agent2.conf
User=zabbix
RestartSec=10s

[Install]
WantedBy=multi-user.target

And the agent fails to start, as this would be the correct file for agent 2 (see usr/lib/systemd/system/zabbix-agent2.service in zabbix-agent2-7.0.9-release1.el9.x86_64.rpm

[Unit]
Description=Zabbix Agent 2
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_agent2.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent2
Type=simple
Restart=on-failure
PIDFile=/run/zabbix/zabbix_agent2.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agent2 -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix
LimitNOFILE=8192

[Install]
WantedBy=multi-user.target

manage_startup_script to false is a solution, but I think the module should at least throw a warning if the parameter is being used with agent 2

@Valantin
Copy link
Contributor

@d1nuc0m the default for manage_startup_script was false, the road is to remove it to use the the package provided init file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists skip-changelog
Projects
None yet
Development

No branches or pull requests

4 participants